

@values
def read_labels_from_annot(subject, parc='aparc', hemi='both', surf_name='white', annot_fname=None, regexp=None, subjects_dir=None, verbose=None):
    "Read labels from a FreeSurfer annotation file\n\n    Note: Only cortical labels will be returned.\n\n    Parameters\n    ----------\n    subject : str\n        The subject for which to read the parcellation for.\n    parc : str\n        The parcellation to use, e.g., 'aparc' or 'aparc.a2009s'.\n    hemi : str\n        The hemisphere to read the parcellation for, can be 'lh', 'rh',\n        or 'both'.\n    surf_name : str\n        Surface used to obtain vertex locations, e.g., 'white', 'pial'\n    annot_fname : str or None\n        Filename of the .annot file. If not None, only this file is read\n        and 'parc' and 'hemi' are ignored.\n    regexp : str\n        Regular expression or substring to select particular labels from the\n        parcellation. E.g. 'superior' will return all labels in which this\n        substring is contained.\n    subjects_dir : string, or None\n        Path to SUBJECTS_DIR if it is not set in the environment.\n    verbose : bool, str, int, or None\n        If not None, override default verbose level (see mne.verbose).\n\n    Returns\n    -------\n    labels : list of Label\n        The labels, sorted by label name (ascending).\n    "
    logger.info('Reading labels from parcellation..')
    subjects_dir = get_subjects_dir(subjects_dir)
    (annot_fname, hemis) = _get_annot_fname(annot_fname, subject, hemi, parc, subjects_dir)
    if (regexp is not None):
        r_ = re.compile((('.*%s.*' % regexp) if regexp.replace('_', '').isalnum() else regexp))
    n_read = 0
    labels = list()
    for (fname, hemi) in zip(annot_fname, hemis):
        (annot, ctab, label_names) = _read_annot(fname)
        label_rgbas = ctab[:, :4]
        label_ids = ctab[:, (- 1)]
        fname_surf = op.join(subjects_dir, subject, 'surf', ('%s.%s' % (hemi, surf_name)))
        (vert_pos, _) = read_surface(fname_surf)
        vert_pos /= 1000.0
        for (label_id, label_name, label_rgba) in zip(label_ids, label_names, label_rgbas):
            vertices = np.where((annot == label_id))[0]
            if (len(vertices) == 0):
                continue
            name = ((label_name.decode() + '-') + hemi)
            if ((regexp is not None) and (not r_.match(name))):
                continue
            pos = vert_pos[vertices, :]
            values = np.zeros(len(vertices))
            label_rgba = tuple((label_rgba / 255.0))
            label = Label(vertices, pos, values, hemi, name=name, subject=subject, color=label_rgba)
            labels.append(label)
        n_read = (len(labels) - n_read)
        logger.info(('   read %d labels from %s' % (n_read, fname)))
    labels = sorted(labels, key=(lambda l: l.name))
    if (len(labels) == 0):
        msg = 'No labels found.'
        if (regexp is not None):
            msg += (' Maybe the regular expression %r did not match?' % regexp)
        raise RuntimeError(msg)
    logger.info('[done]')
    return labels

dataset/ETHPy150Open mne-tools/mne-python/mne/label.py read_labels_from_annot/VarMisuse@3/3 `verbose`->`values`