# apply\_inverse\_raw with multiple labels

**URL:** <https://mne.discourse.group/t/apply-inverse-raw-with-multiple-labels/3436>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization\
**Created:** [July 21, 2021, 5:04am UTC](https://mne.discourse.group/t/apply-inverse-raw-with-multiple-labels/3436 "2021-07-21T05:04:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neurothew](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/neurothew/32/682_2.png) [@neurothew](https://mne.discourse.group/u/neurothew)\
**Post date:** [July 21, 2021, 5:04am UTC](https://mne.discourse.group/t/apply-inverse-raw-with-multiple-labels/3436/1 "2021-07-21T05:04:32Z")

</div>

- MNE-Python version: 0.23.0
- operating system: CentOS 7

Hi, recently I am trying to perform source localization with MNE. Thanks for the amazing tutorials on relevant topics and I have seemed to reconstrcuted things successfully with a template MRI.

However, since I have a very long time series, reconstructing with the whole brain would instantly kill my computer. I decided to select specific ROI and reconstruct the source only from them. For instance, let’s say the **caudlamiddlefrontal-lh** from the **aparc** parcellation.

The command is pretty standard, labels[roi\_idx] is the corresponding ROI:

```python
stc = apply_inverse_raw(raw_file, inverse_operator, lambda2, label=labels[roi_idx], method='dSPM', pick_ori=None, verbose=None

```

The command executed successfully while generating both \*\*\*\*-lh.stc and \*\*\*\*-rh.stc. I checked both file, there were data in \*\*\*\*-lh.stc but no data in \*\*\*\*-rh.stc (which is the expected behavior i guess). So, I deleted all \*\*\*\*-rh.stc file manually. Then, performed the whole thing again for **caudlamiddlefrontal-rh** , and deleted all \*\*\*\*-lh this time.

After that, I used mne.read\_source\_estimate(\*\*\*\*-lh.stc) from the folder storing only the \*\*\*\*-lh.stc and there was an error stating that there were missing files for another hemisphere. So, I put all \*\*\*\*-lh.stc and \*\*\*\*-rh.stc in one folder and it works.

So I wonder:

1. If we can use apply\_inverse\_raw with multiple labels at once? Such that we do not have generate source files for both hemi and delete the one that was not included everytime.
2. If we can use read\_source\_estimate with file from a single hemisphere?

Thank you very much for the amazing package!

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [July 24, 2021, 7:10am UTC](https://mne.discourse.group/t/apply-inverse-raw-with-multiple-labels/3436/2 "2021-07-24T07:10:51Z")

</div>

hi

do not delete the empty stc files. mne requires to have both -lh.stc and -rh.stc on read (even if one is empty).

I would save the left label as:

caudlamiddlefrontal\_left-lh.stc  
caudlamiddlefrontal\_left-rh.stc

caudlamiddlefrontal\_right-lh.stc  
caudlamiddlefrontal\_right-rh.stc

otherwise you can also export your STCs with the .h5 extension (see save method).

HTH  
Alex

---

<div class="post-metadata">

**Author:** ![neurothew](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/neurothew/32/682_2.png) [@neurothew](https://mne.discourse.group/u/neurothew)\
**Post date:** [August 19, 2021, 7:00am UTC](https://mne.discourse.group/t/apply-inverse-raw-with-multiple-labels/3436/3 "2021-08-19T07:00:42Z")

</div>

Thank you very much Alex.
