mne.viz.plot_bem#

mne.viz.plot_bem(subject, subjects_dir=None, orientation='coronal', slices=None, brain_surfaces=None, src=None, show=True, show_indices=True, mri='T1.mgz', show_orientation=True)[source]#

Plot BEM contours on anatomical MRI slices.

Parameters:
subjectstr

The FreeSurfer subject name.

subjects_dirpath-like | None

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

orientationstr

‘coronal’ or ‘axial’ or ‘sagittal’.

sliceslist of int | None

The indices of the MRI slices to plot. If None, automatically pick 12 equally-spaced slices.

brain_surfacesstr | list of str | None

One or more brain surface to plot (optional). Entries should correspond to files in the subject’s surf directory (e.g. "white").

srcSourceSpaces | path-like | None

SourceSpaces instance or path to a source space to plot individual sources as scatter-plot. Sources will be shown on exactly one slice (whichever slice is closest to each source in the given orientation plane). Path can be absolute or relative to the subject’s bem folder.

Changed in version 0.20: All sources are shown on the nearest slice rather than some being omitted.

showbool

Show figure if True.

show_indicesbool

Show slice indices if True.

New in v0.20.

mristr

The name of the MRI to use. Can be a standard FreeSurfer MRI such as 'T1.mgz', or a full path to a custom MRI file.

New in v0.21.

show_orientationbool | str

Show the orientation (L/R, P/A, I/S) of the data slices. True (default) will only show it on the outside most edges of the figure, False will never show labels, and “always” will label each plot.

New in v0.21.

Changed in version 0.24: Added support for “always”.

Returns:
figinstance of matplotlib.figure.Figure

The figure.

Notes

Images are plotted in MRI voxel coordinates.

If src is not None, for a given slice index, all source points are shown that are halfway between the previous slice and the given slice, and halfway between the given slice and the next slice. For large slice decimations, this can make some source points appear outside the BEM contour, which is shown for the given slice index. For example, in the case where the single midpoint slice is used slices=[128], all source points will be shown on top of the midpoint MRI slice with the BEM boundary drawn for that slice.

Examples using mne.viz.plot_bem#

Head model and forward computation

Head model and forward computation