apply_inverse_raw with multiple labels

  • 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:

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!

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

1 Like

Thank you very much Alex.