# Volume morphing and labels

**URL:** <https://mne.discourse.group/t/volume-morphing-and-labels/1606>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [September 5, 2018, 1:23pm UTC](https://mne.discourse.group/t/volume-morphing-and-labels/1606 "2018-09-05T13:23:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [September 5, 2018, 1:23pm UTC](https://mne.discourse.group/t/volume-morphing-and-labels/1606/1 "2018-09-05T13:23:48Z")

</div>

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](https://www.dropbox.com/sh/axc2keq2s3gill2/AABJXrQNr5b_3aIkxm1LbnuSa?dl=0)\>.

Kind regards,

Christian Kiefer

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [September 5, 2018, 1:49pm UTC](https://mne.discourse.group/t/volume-morphing-and-labels/1606/2 "2018-09-05T13:49:02Z")

</div>

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.input_data.NiftiMasker.html)  
[https://nilearn.github.io/modules/generated/nilearn.regions.img\_to\_signals\_labels.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
