mne.read_surface#

mne.read_surface(fname, read_metadata=False, return_dict=False, file_format='auto', verbose=None)[source]#

Load a Freesurfer surface mesh in triangular format.

Parameters:
fnamepath-like

The name of the file containing the surface.

read_metadatabool

Read metadata as key-value pairs. Only works when reading a FreeSurfer surface file. For .obj files this dictionary will be empty.

Valid keys:

  • ‘head’ : array of int

  • ‘valid’ : str

  • ‘filename’ : str

  • ‘volume’ : array of int, shape (3,)

  • ‘voxelsize’ : array of float, shape (3,)

  • ‘xras’ : array of float, shape (3,)

  • ‘yras’ : array of float, shape (3,)

  • ‘zras’ : array of float, shape (3,)

  • ‘cras’ : array of float, shape (3,)

New in v0.13.0.

return_dictbool

If True, a dictionary with surface parameters is returned.

file_format‘auto’ | ‘freesurfer’ | ‘obj’

File format to use. Can be ‘freesurfer’ to read a FreeSurfer surface file, or ‘obj’ to read a Wavefront .obj file (common format for importing in other software), or ‘auto’ to attempt to infer from the file name. Defaults to ‘auto’.

New in v0.21.0.

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:
rrarray, shape=(n_vertices, 3)

Coordinate points.

trisint array, shape=(n_faces, 3)

Triangulation (each line contains indices for three points which together form a face).

volume_infodict-like

If read_metadata is true, key-value pairs found in the geometry file.

surfdict

The surface parameters. Only returned if return_dict is True.

Examples using mne.read_surface#

Source alignment and coordinate frames

Source alignment and coordinate frames

How MNE uses FreeSurfer’s outputs

How MNE uses FreeSurfer's outputs

Fixing BEM and head surfaces

Fixing BEM and head surfaces