mne.label.select_sources(subject, label, location='center', extent=0.0, grow_outside=True, subjects_dir=None, name=None, random_state=None, surf='white')[source]

Select sources from a label.


Name of the subject as in SUBJECTS_DIR.

labelinstance of Label | str

Define where the seed will be chosen. If str, can be ‘lh’ or ‘rh’, which correspond to left or right hemisphere, respectively.

location‘random’ | ‘center’ | int

Location to grow label from. If the location is an int, it represents the vertex number in the corresponding label. If it is a str, it can be either ‘random’ or ‘center’.


Extents (radius in mm) of the labels, i.e. maximum geodesic distance on the white matter surface from the seed. If 0, the resulting label will contain only one vertex.


Let the region grow outside the original label where location was defined.

subjects_dirstr | None

The path to the freesurfer subjects reconstructions. It corresponds to Freesurfer environment variable SUBJECTS_DIR.

nameNone | str

Assign name to the new label.

random_stateNone | int | instance of RandomState

If random_state is an int, it will be used as a seed for RandomState. If None, the seed will be obtained from the operating system (see RandomState for details). Default is None.


The surface used to simulated the label, defaults to the white surface.

labelinstance of Label

The label that contains the selected sources.


This function selects a region of interest on the cortical surface based on a label (or a hemisphere). The sources are selected by growing a region around a seed which is selected randomly, is the center of the label, or is a specific vertex. The selected vertices can extend beyond the initial provided label. This can be prevented by setting grow_outside to False.

The selected sources are returned in the form of a new Label object. The values of the label contain the distance from the seed in millimeters.

New in version 0.18.

Examples using mne.label.select_sources