Volume morphing and labels

External Email - Use Caution

Dear mne community,

I am experimenting with the new class mne.compute_source_morph() which was just added to the mne-python master. My goal is to morph volume source time courses to fsaverage and to create a list containing the vertices which belong to the different volume labels.

I have stc_from and src_from both with 11359 vertices. I morphed stc_from to fsaverage using mne.compute_source_morph(). The resulting stc_fsaverage has in total 23568 vertices.

I would like to separate these 23568 vertices into groups based on freesurfer volume labels. The names of the volume labels I can get using volume_labels = mne.get_volume_labels_from_aseg('path/to/fsaverage/mri/aseg.mgz').

Now I need to find out which vertices belong to which label, which is where the problem lies.

Using srcs = mne.setup_volume_source_space(...,volume_labels=volume_labels) I get a list of one volume source space per label. For the ith label in volume_labels, I can get the source space with src_label = srcs[i]. src_label[0]["vertno"] contains a list of all vertices belonging to that label.

However, I do not know how I can get the correct src_fsaverage which has the same 23536 vertices as stc_fsaverage. For example, using the argument pos=5 in mne.setup_volume_source_space() the resulting source space has 14629 vertices which is obviously wrong since we need 23536 vertices. I could try and adjust pos in such a way that the resulting source space has 23536 vertices but even then I could not be sure that these vertices are actually the same ones as in stc_fsaverage.

So how can I get the correct src_fsaverage which corresponds to the morphed stc_fsaverage and how do I know which of these vertices belong to which label?

I created some sample code which you can find here<https://www.dropbox.com/sh/axc2keq2s3gill2/AABJXrQNr5b_3aIkxm1LbnuSa?dl=0>.

Kind regards,

Christian Kiefer

External Email - Use Caution

hi,

I would try to do it with:

https://nilearn.github.io/modules/generated/nilearn.input_data.NiftiMasker.html
https://nilearn.github.io/modules/generated/nilearn.regions.img_to_signals_labels.html

these functions can take care of the resampling if needs be.

You'll need to work with nibabel images and not STCs though

HTH
Alex