mne.setup_subcortical_source_space#

mne.setup_subcortical_source_space(subject, label=None, surface=None, aseg='auto', subjects_dir=None, keep_largest_component=True, smooth=0, fill_hole_size=None, add_dist=False, *, verbose=None)[source]#

Set up a subcortical or cerebellar surface source space.

This builds a SourceSpaces from a triangulated mesh of a subcortical or cerebellar structure, either tessellated directly from an anatomical segmentation (label) or supplied as an externally-produced mesh (surface, e.g. one fitted by another package such as CMB). Exactly one of label or surface must be provided.

Warning

This is experimental functionality. SourceSpaces created by this function are not (yet) compatible with morphing (SourceMorph), mne.extract_label_time_course() does not yet know how to select vertices within a subcortical-surface label, and plotting support is limited (for example, the plot() method does not yet support these source spaces).

Parameters:
subjectstr

Subject to process.

labelstr | list | dict | None

Region(s) of interest to tessellate from the anatomical segmentation given by aseg. One source space is created per entry (a single str is turned into a one-element list). If dict, maps region names to atlas id numbers, allowing the use of other atlases. Mutually exclusive with surface.

surfacepath-like | dict | None

A FreeSurfer-compatible surface file (e.g. a .surf file), or a dict with 'rr' and 'tris' entries in FreeSurfer surface RAS coordinates (mm), such as those returned by mne.read_surface() or produced by an external mesh-fitting tool. Creates a single source space. Mutually exclusive with label.

asegstr

The anatomical segmentation file. Default auto uses aparc+aseg if available and wmparc if not. This may be any anatomical segmentation file in the mri subdirectory of the FreeSurfer subject directory.

Changed in version 1.8: Added support for the new default 'auto'.

Only used when label is provided.

subjects_dirpath-like | None

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

keep_largest_componentbool

If True (default), keep only the largest connected component of each tessellated mesh, discarding disconnected islands (the marching-cubes equivalent of FreeSurfer’s mris_extract_main_component).

smoothfloat in [0, 1)

The smoothing factor to be applied. Default 0 is no smoothing.

Only used when label is provided.

fill_hole_sizeint | None

The size of holes to remove in the mesh in voxels. Default is None, no holes are removed. This dilates the boundaries of the surface by fill_hole_size voxels, so use the minimal size needed. Only used when label is provided.

add_distbool

If True, compute inter-source distances along the mesh (see mne.add_source_space_distances()). Default False, as this can be slow and is not needed for a forward solution.

verbosebool | str | int | None

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

Returns:
srcinstance of SourceSpaces

The subcortical/cerebellar surface source space(s), one per label entry, or a single one if surface was used.

Notes

This is a first, deliberately narrow proof of concept: it has been validated interactively on the sample subject. See the warning above for known gaps, to be addressed in follow-up work.

New in v1.12.