Represent a list of source space.
This class acts like a list of dictionaries containing the source space information, one entry in the list per source space type. See Notes for details.
Warning
This class should not be created or modified by the end user. Use
mne.setup_source_space(), mne.setup_volume_source_space(),
or mne.read_source_spaces() to create SourceSpaces.
See also
mne.setup_source_spaceSetup a surface source space.
mne.setup_volume_source_spaceSetup a volume source space.
mne.read_source_spacesRead source spaces from a file.
Notes
Each element in SourceSpaces (e.g., src[0]) is a dictionary. For
example, a surface source space will have len(src) == 2, one entry for
each hemisphere. A volume source space will have len(src) == 1 if it
uses a single monolithic grid, or len(src) == len(volume_label) when
created with a list-of-atlas-labels. A mixed source space consists of both
surface and volumetric source spaces in a single SourceSpaces object.
Each of those dictionaries can be accessed using standard Python
dict access using the string keys listed below (e.g.,
src[0]['type'] == 'surf'). The relevant key/value pairs depend on
the source space type:
Relevant to all source spaces
The following are always present:
- idint
The FIF ID, either
FIFF.FIFFV_MNE_SURF_LEFT_HEMIorFIFF.FIFFV_MNE_SURF_RIGHT_HEMIfor surfaces, orFIFF.FIFFV_MNE_SURF_UNKNOWNfor volume source spaces.- typestr
The type of source space, one of
{'surf', 'vol', 'discrete'}.- npint
Number of vertices in the dense surface or complete volume.
- coord_frameint
The coordinate frame, usually
FIFF.FIFFV_COORD_MRI.- rrndarray, shape (np, 3)
The dense surface or complete volume vertex locations.
- nnndarray, shape (np, 3)
The dense surface or complete volume normals.
- nuseint
The number of points in the subsampled surface.
- inusendarray, shape (np,)
An integer array defining whether each dense surface vertex is used (
1) or unused (0).- vertnondarray, shape (n_src,)
The vertex numbers of the dense surface or complete volume that are used (i.e.,
np.where(src[0]['inuse'])[0]).- subject_his_idstr
The FreeSurfer subject name.
Surface source spaces
Surface source spaces created using mne.setup_source_space() can have
the following additional entries (which will be missing, or have values of
None or 0 for volumetric source spaces):
- ntriint
Number of triangles in the dense surface triangulation.
- trisndarray, shape (ntri, 3)
The dense surface triangulation.
- nuse_triint
The number of triangles in the subsampled surface.
- use_trisndarray, shape (nuse_tri, 3)
The subsampled surface triangulation.
- distscipy.sparse.csr_matrix, shape (n_src, n_src) | None
The distances (euclidean for volume, along the cortical surface for surfaces) between source points.
- dist_limitfloat
The maximum distance allowed for inclusion in
nearest.- pinfodict
Information about the patch of cortex represented by a vertex in the subsampled surface.
- patch_indslist of ndarray
For each vertex in the subsampled surface, the indices of the vertices in the dense surface that it represents (i.e., is closest to of all subsampled indices).
- nearestndarray, shape (np,)
For each vertex on the dense surface, this gives the vertex index on the subsampled surface that it’s closest to.
- nearest_distndarray, shape (np,)
The distances corresponding to
nearest.
Volume source spaces
Volume source spaces created using mne.setup_volume_source_space()
can have the following additional entries (which will be missing, or
have values of None or 0 for surface source spaces):
- mri_width, mri_height, mri_depthint
The MRI dimensions (in voxels).
- neighbor_vertndarray
The 26-neighborhood information for each vertex.
- interpolatorscipy.sparse.csr_matrix | None
The linear interpolator to go from the subsampled volume vertices to the high-resolution volume.
- shapetuple of int
The shape of the subsampled grid.
- mri_ras_tinstance of
TransformThe transformation from MRI surface RAS (
FIFF.FIFFV_COORD_MRI) to MRI scanner RAS (FIFF.FIFFV_MNE_COORD_RAS).- src_mri_tinstance of
TransformThe transformation from subsampled source space voxel to MRI surface RAS.
- vox_mri_tinstance of
TransformThe transformation from the original MRI voxel (
FIFF.FIFFV_MNE_COORD_MRI_VOXEL) space to MRI surface RAS.- mri_volume_namestr
The MRI volume name, e.g.
'subjects_dir/subject/mri/T1.mgz'.- seg_namestr
The MRI atlas segmentation name (e.g.,
'Left-Cerebellum-Cortex'from the parametervolume_label).
Source spaces also have some attributes that are accessible via .
access, like src.kind.
Methods
|
Combine source spaces. |
|
Get an item. |
|
Make a copy of the source spaces. |
|
Export source spaces to nifti or mgz file. |
|
Plot the source space. |
|
Save the source spaces to a fif file. |
Make a copy of the source spaces.
SourceSpacesThe copied source spaces.
Export source spaces to nifti or mgz file.
strName of nifti or mgz file to write.
If True, include surface source spaces.
If True, include discrete source spaces.
If ‘mri’ the volume is defined in the coordinate system of the original T1 image. If ‘surf’ the coordinate system of the FreeSurfer surface is used (Surface RAS).
dict, str, or NoneEither a transformation filename (usually made using mne_analyze)
or an info dict (usually opened using read_trans()). If string, an
ending of .fif or .fif.gz will be assumed to be in FIF
format, any other ending will be assumed to be a text file with a
4x4 transformation matrix (like the --trans MNE-C option.
Must be provided if source spaces are in head coordinates and
include_surfaces and mri_resolution are True.
strIf True, the image is saved in MRI resolution (e.g. 256 x 256 x 256), and each source region (surface or segmentation volume) filled in completely. If “sparse”, only a single voxel in the high-resolution MRI is filled in for each source point.
Changed in version 0.21.0: Support for “sparse” was added.
If True, assigns a numeric value to each source space that corresponds to a color on the freesurfer lookup table.
If True (default False), overwrite the destination file if it exists.
New in version 0.19.
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
This method requires nibabel.
Examples using export_volume:
Compute MNE inverse solution on evoked data with a mixed source space
Plot the source space.
If True, show head surface.
strIf True, show the brain surfaces. Can also be a str for surface type (e.g., ‘pial’, same as True). Default is None, which means ‘white’ for surface source spaces and False otherwise.
str | list of str | list of dict | NoneWhether to plot skull surface. If string, common choices would be
‘inner_skull’, or ‘outer_skull’. Can also be a list to plot
multiple skull surfaces. If a list of dicts, each dict must
contain the complete surface info (such as you get from
mne.make_bem_model()). True is an alias of ‘outer_skull’.
The subjects bem and bem/flash folders are searched for the ‘surf’
files. Defaults to None, which is False for surface source spaces,
and True otherwise.
str | NonePath to SUBJECTS_DIR if it is not set in the environment.
str | ‘auto’ | dict | NoneThe full path to the head<->MRI transform *-trans.fif file
produced during coregistration. If trans is None, an identity
matrix is assumed. This is only needed when the source space is in
head coordinates.
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.
Figure3DThe figure.
Examples using plot:
Compute MNE inverse solution on evoked data with a mixed source space
Save the source spaces to a fif file.
strFile to write.
If True (default False), overwrite the destination file if it exists.
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.
mne.SourceSpaces#Permutation t-test on source data with spatio-temporal clustering
2 samples permutation test on source data with spatio-temporal clustering
Repeated measures ANOVA on source data with spatio-temporal clustering
Compute MNE-dSPM inverse solution on evoked data in volume source space
Extracting the time series of activations in a label
Compute sparse inverse solution with mixed norm: MxNE and irMxNE
Compute MNE inverse solution on evoked data with a mixed source space
Visualize source leakage among labels using a circular graph