# issue with volumetric source estimate morphing

**URL:** <https://mne.discourse.group/t/issue-with-volumetric-source-estimate-morphing/2139>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [April 6, 2020, 11:18am UTC](https://mne.discourse.group/t/issue-with-volumetric-source-estimate-morphing/2139 "2020-04-06T11:18:48Z")\
**Posts on this page:** 3\
**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:** [April 6, 2020, 11:18am UTC](https://mne.discourse.group/t/issue-with-volumetric-source-estimate-morphing/2139/1 "2020-04-06T11:18:48Z")

</div>

External Email - Use Caution

Hello,

I have mixed source estimates that I wish to morph to the fsaverage brain. To do so, I separated the mixed source estimates into a surface source estimate and a volume source estimate. When trying to morph the lastest (using morph\_apply), I get the following error:

ValueError: vertices do not match between morph (453) and stc (216) for the volume:

(I believe there is a small mistake in morph\_apply and what it means is actually that vertices do not match between morph (216) and stc (453) for the volume.)

Here is my code:

#recuperating volume source estimate from mixed source estimate stc  
nb\_sources\_cortex = stc.vertices[0].shape[0] + stc.vertices[1].shape[0]  
vertices\_vol = np.concatenate((stc.vertices[2], stc.vertices[3]))  
stc\_volume = mne.VolSourceEstimate(stc.data[nb\_sources\_cortex:], vertices\_vol,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmin=stc.tmin, tstep=stc.tstep,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subject = subject\_mri)  
#Maybe not the cleanest way to isolate a volume source estimate from a mixed source estimate?

#recuperating the source space I want to morph to  
src\_fsaverage\_vol = subjects\_dir + '/fsaverage/bem/fsaverage-vol-5-src.fif'  
src\_vol = mne.read\_source\_spaces(src\_fsaverage\_vol)

#recuperating the source space to morph from  
cereb\_used = mne.SourceSpaces(inverse\_op['src'][2:])  
#the source space (inverse\_op['src']) is made of 4 source spaces: 2 surface source spaces and 2 volume source spaces  
#- here I recuperate the 2 volume source spaces, made of 216 and 237 vertices (respectively)

morph = mne.compute\_source\_morph(src = cereb\_used,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subject\_from=stc\_vol.subject,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subject\_to = 'fsaverage',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subjects\_dir=subjects\_dir,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;niter\_affine=[10, 10, 5], niter\_sdr=[10, 10, 5], # just for speed  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src\_to=src\_vol, verbose=True)

stc\_vol = morph.apply(stc\_vol)

I'm sorry that I cannot provide a replicable code.

I believe the error is coming from the fact that when computing the source morph, mne only considers the first of the two volume source spaces in cereb\_used, hence generating a morph with 216 vertices instead of 216+237 vertices, but I do not know how to fix it.

King regards,

Fleur  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200406/bf8bb2d1/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200406/bf8bb2d1/attachment.html)

---

<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:** [April 6, 2020, 1:18pm UTC](https://mne.discourse.group/t/issue-with-volumetric-source-estimate-morphing/2139/2 "2020-04-06T13:18:55Z")

</div>

External Email - Use Caution

This indeed looks like a bug. Can you open an issue on GitHub and we can  
work on it there?

Thanks,  
Eric

---

<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:** [April 6, 2020, 2:02pm UTC](https://mne.discourse.group/t/issue-with-volumetric-source-estimate-morphing/2139/3 "2020-04-06T14:02:21Z")

</div>

External Email - Use Caution

Yes, it's done, thank you.

Fleur
