Morph the label. Useful for transforming a label from one subject to another. Parameters ---------- subject_from : str | None The name of the subject of the current label. If None, the initial subject will be taken from self.subject.
(
self,
subject_from=None,
subject_to=None,
smooth=5,
grade=None,
subjects_dir=None,
n_jobs=None,
verbose=None,
)
| 620 | |
| 621 | @verbose |
| 622 | def morph( |
| 623 | self, |
| 624 | subject_from=None, |
| 625 | subject_to=None, |
| 626 | smooth=5, |
| 627 | grade=None, |
| 628 | subjects_dir=None, |
| 629 | n_jobs=None, |
| 630 | verbose=None, |
| 631 | ): |
| 632 | """Morph the label. |
| 633 | |
| 634 | Useful for transforming a label from one subject to another. |
| 635 | |
| 636 | Parameters |
| 637 | ---------- |
| 638 | subject_from : str | None |
| 639 | The name of the subject of the current label. If None, the |
| 640 | initial subject will be taken from self.subject. |
| 641 | subject_to : str |
| 642 | The name of the subject to morph the label to. This will |
| 643 | be put in label.subject of the output label file. |
| 644 | smooth : int |
| 645 | Number of iterations for the smoothing of the surface data. |
| 646 | Cannot be None here since not all vertices are used. |
| 647 | grade : int, list of shape (2,), array, or None |
| 648 | Resolution of the icosahedral mesh (typically 5). If None, all |
| 649 | vertices will be used (potentially filling the surface). If a list, |
| 650 | values will be morphed to the set of vertices specified in grade[0] |
| 651 | and grade[1], assuming that these are vertices for the left and |
| 652 | right hemispheres. Note that specifying the vertices (e.g., |
| 653 | ``grade=[np.arange(10242), np.arange(10242)]`` for fsaverage on a |
| 654 | standard grade 5 source space) can be substantially faster than |
| 655 | computing vertex locations. If one array is used, it is assumed |
| 656 | that all vertices belong to the hemisphere of the label. To create |
| 657 | a label filling the surface, use None. |
| 658 | %(subjects_dir)s |
| 659 | %(n_jobs)s |
| 660 | %(verbose)s |
| 661 | |
| 662 | Returns |
| 663 | ------- |
| 664 | label : instance of Label |
| 665 | The morphed label. |
| 666 | |
| 667 | See Also |
| 668 | -------- |
| 669 | mne.morph_labels : Morph a set of labels. |
| 670 | |
| 671 | Notes |
| 672 | ----- |
| 673 | This function will set label.pos to be all zeros. If the positions |
| 674 | on the new surface are required, consider using `mne.read_surface` |
| 675 | with ``label.vertices``. |
| 676 | """ |
| 677 | from .morph import compute_source_morph, grade_to_vertices |
| 678 | |
| 679 | subject_from = _check_subject(self.subject, subject_from) |