mne.label.select_sources#

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.

Parameters
subjectstr

The FreeSurfer subject name.

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’.

extentfloat

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.

grow_outsidebool

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

subjects_dirpath-like | None

The path to the directory containing the FreeSurfer subjects reconstructions. If None, defaults to the SUBJECTS_DIR environment variable.

nameNone | str

Assign name to the new label.

random_stateNone | int | instance of RandomState

A seed for the NumPy random number generator (RNG). If None (default), the seed will be obtained from the operating system (see RandomState for details), meaning it will most likely produce different output every time this function or method is run. To achieve reproducible results, pass a value here to explicitly initialize the RNG with a defined state.

surfstr

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

Returns
labelinstance of Label

The label that contains the selected sources.

Notes

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#

Generate simulated source data

Generate simulated source data

Generate simulated source data