This documentation is for development version 0.18.dev0.

mne.SourceMorph

class mne.SourceMorph(subject_from, subject_to, kind, zooms, niter_affine, niter_sdr, spacing, smooth, xhemi, morph_mat, vertices_to, shape, affine, pre_affine, sdr_morph, src_data, verbose=None)[source]

Morph source space data from one subject to another.

Note

This class should not be instantiated directly. Use mne.compute_source_morph() instead.

New in version 0.17.

Parameters:
subject_from : str | None

Name of the subject from which to morph as named in the SUBJECTS_DIR.

subject_to : str | array | list of array

Name of the subject on which to morph as named in the SUBJECTS_DIR. The default is ‘fsaverage’. If morphing a volume source space, subject_to can be the path to a MRI volume. Can also be a list of two arrays if morphing to hemisphere surfaces.

kind : str | None

Kind of source estimate. E.g. ‘volume’ or ‘surface’.

zooms : float | tuple

See mne.compute_source_morph().

niter_affine : tuple of int

Number of levels (len(niter_affine)) and number of iterations per level - for each successive stage of iterative refinement - to perform the affine transform.

niter_sdr : tuple of int

Number of levels (len(niter_sdr)) and number of iterations per level - for each successive stage of iterative refinement - to perform the Symmetric Diffeomorphic Registration (sdr) transform [2].

spacing : int | list | None

See mne.compute_source_morph().

smooth : int | None

Number of iterations for the smoothing of the surface data. If None, smooth is automatically defined to fill the surface with non-zero values.

xhemi : bool

Morph across hemisphere.

morph_mat : scipy.sparse.csr_matrix

The sparse surface morphing matrix for spherical surface based morphing [1].

vertices_to : list of ndarray

The destination surface vertices.

shape : tuple

The volume MRI shape.

affine : ndarray

The volume MRI affine.

pre_affine : instance of dipy.align.imaffine.AffineMap

The dipy.align.imaffine.AffineMap transformation that is applied before the before sdr_morph.

sdr_morph : instance of dipy.align.imwarp.DiffeomorphicMap

The dipy.align.imwarp.DiffeomorphicMap that applies the the symmetric diffeomorphic registration (SDR) morph.

src_data : dict

Additional source data necessary to perform morphing.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

References

[1](1, 2) Greve D. N., Van der Haegen L., Cai Q., Stufflebeam S., Sabuncu M. R., Fischl B., Brysbaert M. A Surface-based Analysis of Language Lateralization and Cortical Asymmetry. Journal of Cognitive Neuroscience 25(9), 1477-1492, 2013.
[2](1, 2) Avants, B. B., Epstein, C. L., Grossman, M., & Gee, J. C. (2009). Symmetric Diffeomorphic Image Registration with Cross- Correlation: Evaluating Automated Labeling of Elderly and Neurodegenerative Brain, 12(1), 26-41.

Methods

__hash__($self, /) Return hash(self).
apply(stc_from[, output, mri_resolution, …]) Morph source space data.
save(fname[, overwrite, verbose]) Save the morph for source estimates to a file.
__hash__($self, /)

Return hash(self).

apply(stc_from, output='stc', mri_resolution=False, mri_space=False, verbose=None)[source]

Morph source space data.

Parameters:
stc_from : VolSourceEstimate | SourceEstimate | VectorSourceEstimate

The source estimate to morph.

output : str

Can be ‘stc’ (default), ‘nifti1’, or ‘nifti2’.

mri_resolution: bool | tuple | int | float

If True the image is saved in MRI resolution. Default False. WARNING: if you have many time points the file produced can be huge. The default is mri_resolution=False.

mri_space : bool

Whether the image to world registration should be in mri space. The default is mri_space=mri_resolution.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). Defaults to self.verbose.

Returns:
stc_to : VolSourceEstimate | SourceEstimate | VectorSourceEstimate | Nifti1Image | Nifti2Image

The morphed source estimates.

save(fname, overwrite=False, verbose=None)[source]

Save the morph for source estimates to a file.

Parameters:
fname : str

The stem of the file name. ‘-morph.h5’ will be added if fname does not end with ‘.h5’

overwrite : bool

If True, overwrite existing file.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). Defaults to self.verbose.