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,
)
| 1376 | |
| 1377 | @verbose |
| 1378 | def 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) |