mne.setup_volume_source_space(subject, fname=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, overwrite=False, subjects_dir=None, volume_label=None, add_interpolator=True, verbose=None)

Setup a volume source space with grid spacing or discrete source space


subject : str

Subject to process.

fname : str | None

Filename to use. If None, the source space will not be saved (only returned).

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 : array_like (length 4)

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.

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.

overwrite: bool

If True, overwrite output file (if it exists).

subjects_dir : string, or None

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

volume_label : str | 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).


src : list

The source space. Note that this list will have length 1 for compatibility reasons, as most functions expect source spaces to be provided as lists).


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

Examples using mne.setup_volume_source_space