MCPcopy
hub / github.com/mne-tools/mne-python / compute_vol_morph_mat

Method compute_vol_morph_mat

mne/morph.py:573–606  ·  view source on GitHub ↗

Compute the sparse matrix representation of the volumetric morph. Parameters ---------- %(verbose)s Returns ------- morph : instance of SourceMorph The instance (modified in-place). Notes ----- For a volumetric mo

(self, *, verbose=None)

Source from the content-addressed store, hash-verified

571
572 @verbose
573 def compute_vol_morph_mat(self, *, verbose=None):
574 """Compute the sparse matrix representation of the volumetric morph.
575
576 Parameters
577 ----------
578 %(verbose)s
579
580 Returns
581 -------
582 morph : instance of SourceMorph
583 The instance (modified in-place).
584
585 Notes
586 -----
587 For a volumetric morph, this will compute the morph for an identity
588 source volume, i.e., with one source vertex active at a time, and store
589 the result as a :class:`sparse <scipy.sparse.csr_array>`
590 morphing matrix. This takes a long time (minutes) to compute initially,
591 but drastically speeds up :meth:`apply` for STCs, so it can be
592 beneficial when many time points or many morphs (i.e., greater than
593 the number of volumetric ``src_from`` vertices) will be performed.
594
595 When calling :meth:`save`, this sparse morphing matrix is saved with
596 the instance, so this only needs to be called once. This function does
597 nothing if the morph matrix has already been computed, or if there is
598 no volume morphing necessary.
599
600 .. versionadded:: 0.22
601 """
602 if self.affine is None or self.vol_morph_mat is not None:
603 return
604 logger.info("Computing sparse volumetric morph matrix (will take some time...)")
605 self.vol_morph_mat = self._morph_vols(None, "Vertex")
606 return self
607
608 def _morph_vols(self, vols, mesg, subselect=True):
609 from dipy.align.reslice import reslice

Callers 3

compute_source_morphFunction · 0.95
_apply_morph_dataFunction · 0.80

Calls 2

_morph_volsMethod · 0.95
infoMethod · 0.80

Tested by 1