mne.write_surface#

mne.write_surface(fname, coords, faces, create_stamp='', volume_info=None, file_format='auto', overwrite=False, *, verbose=None)[source]#

Write a triangular Freesurfer surface mesh.

Accepts the same data format as is returned by read_surface().

Parameters
fnamestr

File to write.

coordsarray, shape=(n_vertices, 3)

Coordinate points.

facesint array, shape=(n_faces, 3)

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

create_stampstr

Comment that is written to the beginning of the file. Can not contain line breaks.

volume_infodict-like or None

Key-value pairs to encode at the end of the file. 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 version 0.13.0.

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

File format to use. Can be ‘freesurfer’ to write a FreeSurfer surface file, or ‘obj’ to write 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 version 0.21.0.

overwritebool

If True (default False), overwrite the destination file if it exists.

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.

Examples using mne.write_surface#

Editing BEM surfaces in Blender

Editing BEM surfaces in Blender

Editing BEM surfaces in Blender