A FreeSurfer/MNE label with vertices restricted to one hemisphere.
Labels can be combined with the + operator:
Duplicate vertices are removed.
If duplicate vertices have conflicting position values, an error is raised.
Values of duplicate vertices are summed.
array, shape (N,)Vertex indices (0 based).
array, shape (N, 3) | NoneLocations in meters. If None, then zeros are used.
array, shape (N,) | NoneValues at the vertices. If None, then ones are used.
Hemisphere to which the label applies.
strKept as information but not used by the object itself.
strKept as information but not used by the object itself.
strKept as information but not used by the object itself.
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
None | matplotlib colorDefault label color and alpha (e.g., (1., 0., 0., 1.) for red).
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
None | tupleDefault label color, represented as RGBA tuple with values between 0 and 1.
strComment from the first line of the label file.
Hemisphere.
None | strA name for the label. It is OK to change that attribute manually.
array, shape (N, 3)Locations in meters.
str | NoneThe label subject. It is best practice to set this to the proper value on initialization, but it can also be set manually.
array, shape (N,)Values at the vertices.
array, shape (N,)Vertex indices (0 based)
Methods
|
Add Labels. |
|
Return the number of vertices. |
|
Subtract Labels. |
|
Compute the center of mass of the label. |
|
Compute the surface area of a label. |
|
Copy the label instance. |
|
Compute the distance from each vertex to outside the label. |
|
Fill the surface between sources for a source space label. |
|
Get the source space's triangles inside the label. |
|
Get the source space's vertices inside the label. |
|
Morph the label. |
|
Restrict a label to a source space. |
|
Write to disk as FreeSurfer *.label file. |
|
Smooth the label. |
|
Split the Label into two or more parts. |
Compute the center of mass of the label.
This function computes the spatial center of mass on the surface as in [1].
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
array of int | instance of SourceSpacesIf True, returned vertex will be one from the label. Otherwise, it could be any vertex from surf. If an array of int, the returned vertex will come from that array. If instance of SourceSpaces (as of 0.13), the returned vertex will be from the given source space. For most accuruate estimates, do not restrict vertices.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
strThe surface to use for Euclidean distance center of mass finding. The default here is “sphere”, which finds the center of mass on the spherical surface to help avoid potential issues with cortical folding.
intVertex of the spatial center of mass for the inferred hemisphere, with each vertex weighted by its label value.
Notes
New in version 0.13.
References
Compute the surface area of a label.
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
strThe surface along which to do the computations, defaults to 'white'
(the gray-white matter boundary).
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
floatThe area (in m²) of the label.
Notes
..versionadded:: 0.24
Examples using compute_area:
Compute the distance from each vertex to outside the label.
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
strThe surface along which to do the computations, defaults to 'white'
(the gray-white matter boundary).
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
Notes
Distances are computed along the cortical surface.
New in version 0.24.
Examples using distances_to_outside:
Fill the surface between sources for a source space label.
SourceSpacesSource space in which the label was defined. If a source space is
provided, the label is expanded to fill in surface vertices that
lie between the vertices included in the source space. For the
added vertices, pos is filled in with positions from the
source space, and values is filled in from the closest source
space vertex.
None | strName for the new Label (default is self.name).
LabelThe label covering the same vertices in source space but also including intermediate surface vertices.
See also
Get the source space’s triangles inside the label.
Morph the label.
Useful for transforming a label from one subject to another.
str | NoneThe name of the subject of the current label. If None, the initial subject will be taken from self.subject.
strThe name of the subject to morph the label to. This will be put in label.subject of the output label file.
intNumber of iterations for the smoothing of the surface data. Cannot be None here since not all vertices are used.
int, list of shape (2,), array, or NoneResolution of the icosahedral mesh (typically 5). If None, all
vertices will be used (potentially filling the surface). If a list,
values will be morphed to the set of vertices specified in grade[0]
and grade[1], assuming that these are vertices for the left and
right hemispheres. Note that specifying the vertices (e.g.,
grade=[np.arange(10242), np.arange(10242)] for fsaverage on a
standard grade 5 source space) can be substantially faster than
computing vertex locations. If one array is used, it is assumed
that all vertices belong to the hemisphere of the label. To create
a label filling the surface, use None.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
int | NoneThe number of jobs to run in parallel. If -1, it is set
to the number of CPU cores. Requires the joblib package.
None (default) is a marker for ‘unset’ that will be interpreted
as n_jobs=1 (sequential execution) unless the call is performed under
a joblib.parallel_backend() context manager that sets another
value for n_jobs.
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
LabelThe morphed label.
See also
mne.morph_labelsMorph a set of labels.
Notes
This function will set label.pos to be all zeros. If the positions
on the new surface are required, consider using mne.read_surface
with label.vertices.
Restrict a label to a source space.
SourceSpacesThe source spaces to use to restrict the label.
None | strName for the new Label (default is self.name).
LabelThe Label restricted to the set of source space vertices.
See also
Notes
New in version 0.20.
Write to disk as FreeSurfer *.label file.
strPath to label file to produce.
Notes
Note that due to file specification limitations, the Label’s subject and color attributes are not saved to disk.
Smooth the label.
Useful for filling in labels made in a decimated source space for display.
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
intNumber of iterations for the smoothing of the surface data. Cannot be None here since not all vertices are used. For a grade of 5 (e.g., fsaverage), a smoothing of 2 will fill a label.
int, list of shape (2,), array, or NoneResolution of the icosahedral mesh (typically 5). If None, all vertices will be used (potentially filling the surface). If a list, values will be morphed to the set of vertices specified in grade[0] and grade[1], assuming that these are vertices for the left and right hemispheres. Note that specifying the vertices (e.g., grade=[np.arange(10242), np.arange(10242)] for fsaverage on a standard grade 5 source space) can be substantially faster than computing vertex locations. If one array is used, it is assumed that all vertices belong to the hemisphere of the label. To create a label filling the surface, use None.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
int | NoneThe number of jobs to run in parallel. If -1, it is set
to the number of CPU cores. Requires the joblib package.
None (default) is a marker for ‘unset’ that will be interpreted
as n_jobs=1 (sequential execution) unless the call is performed under
a joblib.parallel_backend() context manager that sets another
value for n_jobs.
str | int | NoneControl verbosity of the logging output. If None, use the default
verbosity level. See the logging documentation and
mne.verbose() for details. Should only be passed as a keyword
argument.
LabelThe smoothed label.
Notes
This function will set label.pos to be all zeros. If the positions
on the new surface are required, consider using mne.read_surface
with label.vertices.
Split the Label into two or more parts.
int >= 2 | tuple of str | strNumber of labels to create (default is 2), or tuple of strings specifying label names for new labels (from posterior to anterior), or ‘contiguous’ to split the label into connected components. If a number or ‘contiguous’ is specified, names of the new labels will be the input label’s name with div1, div2 etc. appended.
str | NoneSubject which this label belongs to. Should only be specified if it is not specified in the label.
NoneThe path to the directory containing the FreeSurfer subjects
reconstructions. If None, defaults to the SUBJECTS_DIR environment
variable.
By default (False) split_label uses an algorithm that is
slightly optimized for performance and numerical precision. Set
freesurfer to True in order to replicate label splits from
FreeSurfer’s mris_divide_parcellation.
Notes
If using ‘contiguous’ split, you must ensure that the label being split
uses the same triangular resolution as the surface mesh files in
subjects_dir Also, some small fringe labels may be returned that
are close (but not connected) to the large components.
The spatial split finds the label’s principal eigen-axis on the spherical surface, projects all label vertex coordinates onto this axis, and divides them at regular spatial intervals.
mne.Label#Cortical Signal Suppression (CSS) for removal of cortical signals
Compute Power Spectral Density of inverse solution from single epochs
Compute power and phase lock in label of the source space
Compute source power spectral density (PSD) in a label
Compute MNE-dSPM inverse solution on single epochs
Extracting time course from source_estimate object
Extracting the time series of activations in a label