mne.setup_volume_source_space(subject=None, pos=5.0, mri=None, sphere=(0.0, 0.0, 0.0, 90.0), bem=None, surface=None, mindist=5.0, exclude=0.0, subjects_dir=None, volume_label=None, add_interpolator=True, verbose=None)[source]

Set up a volume source space with grid spacing or discrete source space.

subject : str | None

Subject to process. If None, the path to the mri volume must be absolute. Defaults to None.

pos : float | dict

Positions to use for sources. If float, a grid will be constructed with the spacing given by pos in mm, generating a volume source space. If dict, pos[‘rr’] and pos[‘nn’] will be used as the source space locations (in meters) and normals, respectively, creating a discrete source space. NOTE: For a discrete source space (pos is a dict), mri must be None.

mri : str | None

The filename of an MRI volume (mgh or mgz) to create the interpolation matrix over. Source estimates obtained in the volume source space can then be morphed onto the MRI volume using this interpolator. If pos is a dict, this can be None.

sphere : ndarray, shape (4,) | ConductorModel

Define spherical source space bounds using origin and radius given by (ox, oy, oz, rad) in mm. Only used if bem and surface are both None. Can also be a spherical ConductorModel, which will use the origin and radius.

bem : str | None

Define source space bounds using a BEM file (specifically the inner skull surface).

surface : str | dict | None

Define source space bounds using a FreeSurfer surface file. Can also be a dictionary with entries ‘rr’ and ‘tris’, such as those returned by mne.read_surface().

mindist : float

Exclude points closer than this distance (mm) to the bounding surface.

exclude : float

Exclude points closer than this distance (mm) from the center of mass of the bounding surface.

subjects_dir : string, or None

Path to SUBJECTS_DIR if it is not set in the environment.

volume_label : str | list | None

Region of interest corresponding with freesurfer lookup table.

add_interpolator : bool

If True and mri is not None, then an interpolation matrix will be produced.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

src : SourceSpaces

A SourceSpaces object containing one source space for each entry of volume_labels, or a single source space if volume_labels was not specified.


To create a discrete source space, pos must be a dict, ‘mri’ must be None, and ‘volume_label’ must be None. To create a whole brain volume source space, pos must be a float and ‘mri’ must be provided. To create a volume source space from label, ‘pos’ must be a float, ‘volume_label’ must be provided, and ‘mri’ must refer to a .mgh or .mgz file with values corresponding to the freesurfer lookup-table (typically aseg.mgz).