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)
| 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 |