mne.split_label#

mne.split_label(label, parts=2, subject=None, subjects_dir=None, freesurfer=False)[source]#

Split a Label into two or more parts.

Parameters
labelLabel | str

Label which is to be split (Label object or path to a label file).

partsint >= 2 | tuple of str

A sequence of strings specifying label names for the new labels (from posterior to anterior), or the number of new labels to create (default is 2). If a number is specified, names of the new labels will be the input label’s name with div1, div2 etc. appended.

subjectstr | None

Subject which this label belongs to. Should only be specified if it is not specified in the label.

subjects_dirpath-like | None

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

freesurferbool

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.

Returns
labelslist of Label, shape (n_parts,)

The labels, starting from the lowest to the highest end of the projection axis.

Notes

Works by finding the label’s principal eigen-axis on the spherical surface, projecting all label vertex coordinates onto this axis and dividing them at regular spatial intervals.