# Can't morph sparse volume source estimate to fsaverage

**URL:** <https://mne.discourse.group/t/cant-morph-sparse-volume-source-estimate-to-fsaverage/3904>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization, meg, eeg\
**Created:** [November 3, 2021, 2:19pm UTC](https://mne.discourse.group/t/cant-morph-sparse-volume-source-estimate-to-fsaverage/3904 "2021-11-03T14:19:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmalezieux](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/bmalezieux/32/926_2.png) [@bmalezieux](https://mne.discourse.group/u/bmalezieux)\
**Post date:** [November 3, 2021, 2:19pm UTC](https://mne.discourse.group/t/cant-morph-sparse-volume-source-estimate-to-fsaverage/3904/1 "2021-11-03T14:19:00Z")

</div>

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:

```python
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:

```python
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:

```python
<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:

```python
<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

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [November 3, 2021, 3:26pm UTC](https://mne.discourse.group/t/cant-morph-sparse-volume-source-estimate-to-fsaverage/3904/2 "2021-11-03T15:26:24Z")

</div>

Hello @bmalezieux and welcome to the forum!

> [@bmalezieux](#):
>
> ```python
> morph = mne.compute_source_morph(fwd["src"], subject_from='CC110033',
> subject_to='fsaverage', src_to=src_fs,
> subjects_dir=BEM_DIR)
> 
> ```

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

Best wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![bmalezieux](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/bmalezieux/32/926_2.png) [@bmalezieux](https://mne.discourse.group/u/bmalezieux)\
**Post date:** [November 3, 2021, 3:43pm UTC](https://mne.discourse.group/t/cant-morph-sparse-volume-source-estimate-to-fsaverage/3904/3 "2021-11-03T15:43:56Z")

</div>

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.
