Can't morph sparse volume source estimate to fsaverage

Hello,

I am trying to morph a sparse volume source estimate obtained with mne.inverse_sparse.mixed_norm to fsaverage but there seems to be a problem with the number of vertices.

After having processed the data and computed the forward operator, I run the following code:

sources, residual = mne.inverse_sparse.mixed_norm(
    evokeds, fwd, noise_cov, alpha, loose=loose, depth=depth, maxit=3000,
    tol=1e-4, active_set_size=None, debias=True, n_mxne_iter=1, return_residual=True,
    return_as_dipoles=False, verbose=True)

src_fs = mne.read_source_spaces(fname_src_fsaverage)

morph = mne.compute_source_morph(fwd["src"], subject_from='CC110033',
                                 subject_to='fsaverage', src_to=src_fs,
                                 subjects_dir=BEM_DIR)

stc_fsaverage = morph.apply(sources)

I get the following error:

ValueError: vertices do not match between morph (11192) and stc (19) for volume[0]:
[ 2680  2681  2682 ... 32318 32319 32320]
[13018 13324 13383 14987 15016 15309 16440 18417 18730 19861 24179 24180
 24208 24209 25310 25340 27699 28802 28832]
Perhaps src_to=fwd["src"] needs to be passed when calling compute_source_morph. Vertices were likely excluded during forward computation.

sources contains:

<VolSourceEstimate | 19 vertices, tmin : -1700.0 (ms), tmax : 1700.0 (ms), tstep : 1.0 (ms), data shape : (19, 3401), ~253 kB>

whereas the source space fwd['src'] contains:

<SourceSpaces: [<volume, shape=(29, 39, 31), n_used=11192>] head coords, subject 'CC110033', ~73.2 MB>
  • MNE-Python version: 0.23.4
  • operating system: Ubuntu 18.04.5 LTS

Is there a way to add missing vertices to volume source estimates or should I do something differently ?

Thank you

Hello @bmalezieux and welcome to the forum!

Have you tried passing stc as the first parameter of mne.compute_source_morph()?

Best wishes,
Richard

Thanks for your answer.

I tried, but it seems that compute_source_morph only takes source estimates as input if they come from surface source spaces.