

@verbose
def morph(self, subject_from=None, subject_to=None, smooth=5, grade=None, subjects_dir=None, n_jobs=1, copy=None, verbose=None):
    'Morph the label\n\n        Useful for transforming a label from one subject to another.\n\n        Parameters\n        ----------\n        subject_from : str | None\n            The name of the subject of the current label. If None, the\n            initial subject will be taken from self.subject.\n        subject_to : str\n            The name of the subject to morph the label to. This will\n            be put in label.subject of the output label file.\n        smooth : int\n            Number of iterations for the smoothing of the surface data.\n            Cannot be None here since not all vertices are used.\n        grade : int, list (of two arrays), array, or None\n            Resolution of the icosahedral mesh (typically 5). If None, all\n            vertices will be used (potentially filling the surface). If a list,\n            values will be morphed to the set of vertices specified in grade[0]\n            and grade[1], assuming that these are vertices for the left and\n            right hemispheres. Note that specifying the vertices (e.g.,\n            ``grade=[np.arange(10242), np.arange(10242)]`` for fsaverage on a\n            standard grade 5 source space) can be substantially faster than\n            computing vertex locations. If one array is used, it is assumed\n            that all vertices belong to the hemisphere of the label. To create\n            a label filling the surface, use None.\n        subjects_dir : string, or None\n            Path to SUBJECTS_DIR if it is not set in the environment.\n        n_jobs : int\n            Number of jobs to run in parallel.\n        copy : bool\n            This parameter has been deprecated and will be removed in 0.13.\n            Use inst.copy() instead.\n            Whether to return a new instance or modify in place.\n        verbose : bool, str, int, or None\n            If not None, override default verbose level (see mne.verbose).\n\n        Returns\n        -------\n        label : instance of Label\n            The morphed label.\n\n        Notes\n        -----\n        This function will set label.pos to be all zeros. If the positions\n        on the new surface are required, consider using `mne.read_surface`\n        with `label.vertices`.\n        '
    subject_from = _check_subject(self.subject, subject_from)
    if (not isinstance(subject_to, string_types)):
        raise TypeError('"subject_to" must be entered as a string')
    if (not isinstance(smooth, int)):
        raise TypeError('smooth must be an integer')
    if np.all((self.values == 0)):
        raise ValueError('Morphing label with all zero values will result in the label having no vertices. Consider using something like label.values.fill(1.0).')
    if isinstance(subject_from, np.ndarray):
        if (self.hemi == 'lh'):
            grade = [grade, np.array([], int)]
        else:
            grade = [np.array([], int), grade]
    if (self.hemi == 'lh'):
        vertices = [self.vertices, np.array([], int)]
    else:
        vertices = [np.array([], int), self.vertices]
    data = self.values[:, np.newaxis]
    stc = SourceEstimate(data, vertices, tmin=1, tstep=1, subject=subject_from)
    stc = morph_data(subject_from, subject_to, stc, grade=grade, smooth=smooth, subjects_dir=subjects_dir, warn=False, n_jobs=n_jobs)
    inds = np.nonzero(stc.data)[0]
    label = _check_copy_dep(self, copy, default=True)
    label.values = stc.data[inds, :].ravel()
    label.pos = np.zeros((len(inds), 3))
    if (label.hemi == 'lh'):
        label.vertices = stc.vertices[0][inds]
    else:
        label.vertices = stc.vertices[1][inds]
    label.subject = subject_to
    return label

dataset/ETHPy150Open mne-tools/mne-python/mne/label.py Label.morph/VarMisuse@124/1026 `grade`->`subject_from`