issue with volumetric source estimate morphing

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,
                                    tmin=stc.tmin, tstep=stc.tstep,
                                    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,
                                    subject_from=stc_vol.subject,
                                    subject_to = 'fsaverage',
                                    subjects_dir=subjects_dir,
                                    niter_affine=[10, 10, 5], niter_sdr=[10, 10, 5], # just for speed
                                    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

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

External Email - Use Caution

Yes, it's done, thank you.

Fleur