MCPcopy
hub / github.com/mne-tools/mne-python / write_surface

Function write_surface

mne/surface.py:1378–1459  ·  view source on GitHub ↗

Write a triangular Freesurfer surface mesh. Accepts the same data format as is returned by read_surface(). Parameters ---------- fname : path-like File to write. coords : array, shape=(n_vertices, 3) Coordinate points. faces : int array, shape=(n_faces, 3)

(
    fname,
    coords,
    faces,
    create_stamp="",
    volume_info=None,
    file_format="auto",
    overwrite=False,
    *,
    verbose=None,
)

Source from the content-addressed store, hash-verified

1376
1377@verbose
1378def write_surface(
1379 fname,
1380 coords,
1381 faces,
1382 create_stamp="",
1383 volume_info=None,
1384 file_format="auto",
1385 overwrite=False,
1386 *,
1387 verbose=None,
1388):
1389 """Write a triangular Freesurfer surface mesh.
1390
1391 Accepts the same data format as is returned by read_surface().
1392
1393 Parameters
1394 ----------
1395 fname : path-like
1396 File to write.
1397 coords : array, shape=(n_vertices, 3)
1398 Coordinate points.
1399 faces : int array, shape=(n_faces, 3)
1400 Triangulation (each line contains indices for three points which
1401 together form a face).
1402 create_stamp : str
1403 Comment that is written to the beginning of the file. Can not contain
1404 line breaks.
1405 volume_info : dict-like or None
1406 Key-value pairs to encode at the end of the file.
1407 Valid keys:
1408
1409 * 'head' : array of int
1410 * 'valid' : str
1411 * 'filename' : str
1412 * 'volume' : array of int, shape (3,)
1413 * 'voxelsize' : array of float, shape (3,)
1414 * 'xras' : array of float, shape (3,)
1415 * 'yras' : array of float, shape (3,)
1416 * 'zras' : array of float, shape (3,)
1417 * 'cras' : array of float, shape (3,)
1418
1419 .. versionadded:: 0.13.0
1420 file_format : 'auto' | 'freesurfer' | 'obj'
1421 File format to use. Can be 'freesurfer' to write a FreeSurfer surface
1422 file, or 'obj' to write a Wavefront .obj file (common format for
1423 importing in other software), or 'auto' to attempt to infer from the
1424 file name. Defaults to 'auto'.
1425
1426 .. versionadded:: 0.21.0
1427 %(overwrite)s
1428 %(verbose)s
1429
1430 See Also
1431 --------
1432 read_surface
1433 read_tri
1434 """
1435 fname = _check_fname(fname, overwrite=overwrite)

Callers 8

test_io_surfaceFunction · 0.90
test_bem_model_topologyFunction · 0.90
tinyFunction · 0.90
scale_mriFunction · 0.85
make_watershed_bemFunction · 0.85
make_flash_bemFunction · 0.85
_decimate_surface_sphereFunction · 0.85

Calls 4

_check_fnameFunction · 0.85
_check_optionFunction · 0.85
_import_nibabelFunction · 0.85
writeMethod · 0.80

Tested by 4

test_io_surfaceFunction · 0.72
test_bem_model_topologyFunction · 0.72
tinyFunction · 0.72