How to get volumetric source estimates for all vertices across multiple labels

Dear MNE community,

I’ll begin with saying that I am very much a python and mne-python beginner, so my apologies if I haven’t provided enough information for you to make sense of my question!

• MNE version: 1.1.0
• OS: Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17

Summary of question: I would like to do decoding in volumetric, vectorised source space for a number of ROIs/volumetric labels. While I have seen that the in_label method allows you to restrict your source estimate to all sources within a label (which is what I want), I cannot see how to scale this method up to take into account multiple labels. Thus, my main question is, how can I get source time courses for all sources across multiple labels in volumetric vectorised source space?

I have described my question and what I’ve done so far in more detail below in case this helps :slightly_smiling_face:

I have a volumetric source space (for the whole brain)…

surface = op.join(anat_path, subject, 'bem', '')
src = mne.setup_volume_source_space(subject, subjects_dir=anat_path,

…and then have gotten source time courses for each of my epochs:

stcs = apply_inverse_epochs(epochs_dec, inverse_operator, lambda2, method, 
                            pick_ori="vector", nave=evoked_dec.nave)

What I want to do from this point is get time courses for each of my vertices within my ROIs/labels of interest in order to input these into my classifier. I have used the in_label method attached to volumetric vectorised source spaces to get stcs for a given label, but I cannot see how this can easily scale up to incorporate multiple labels.

To illustrate, first, these are the labels I am interested in from my volumetric parcellation (e.g., all occipital labels):

atlas_path = op.join(anat_path, subject, 'mri/aparc.a2009s+aseg.mgz') # Destrieux atlas
label_names_d = mne.get_volume_labels_from_aseg(atlas_path) 
occ_d = [label for label in label_names_d \
                    if 'occ' in label or 'oc-' in label \
                        or 'oc_' in label or '_cuneus' in label]

I have seen that I can then apply the in_label method to restrict my source estimate one of these labels, but only one at a time as the label input here needs to either be a string or an integer. For instance, this works:

stcs = stcs[0].in_label(label = occ_d [0], 
                              mri = atlas_path,
                              src = src)

But is there a way to upscale this to incorporate multiple labels? Ideally, I would like to get source estimates for all vertices within the labels in occ_d. I currently have a workaround that loops through the labels and epochs using in_label, but it feels a bit clunky. In contrast to this VolVectorSourceEstimate version of in_label, the SourceEstimate in_label method takes mne.label objects, thus allowing one to add labels of interest together – is there a way to do something similar with volumetric source spaces or volumetric vectorised source spaces?

Alternatively, I wondered whether there might be a way to restrict my source estimate to my labels of interest at an earlier stage, for instance at the apply_inverse_epochs stage. I saw that this method allows one to input labels to restrict source estimates, however, it requires a mne.label input. As far as I can see, the volume labels are only strings. I tried to use read_labels_from_annot with the aparc.a2009s parcellation to get mne.label objects to then input into apply_inverse_epochs, but I get type errors.

For example, this here yields a type error:

regexp = 'occipital_inf'
label = mne.read_labels_from_annot(subject = subject, parc = 'aparc.a2009s',
                                          hemi='both', regexp=regexp)[0]
stcs = apply_inverse_epochs(epochs_dec, inverse_operator, lambda2, method, 
                            label = label,
                            pick_ori="vector", nave=evoked_dec.nave)

Does anyone have any suggestions or thoughts on how to get source estimates for all vertices across multiple labels with a volumetric vectorised source space?

Thanks very much!