Write mesh to file in mz3 binary format.
Arguments
- filepath
string. Full path to the output surface file, should end with '.mz3', but that is not enforced.
- vertex_coords
n x 3 matrix of doubles. Each row defined the x,y,z coords for a vertex.
- faces
n x 3 matrix of integers. Each row defined the 3 vertex indices that make up the face. WARNING: Vertex indices should be given in R-style, i.e., the index of the first vertex is 1. However, they will be written in FreeSurfer style, i.e., all indices will have 1 substracted, so that the index of the first vertex will be zero.
- gzipped
logical, whether to write a gzip compressed file
Value
string the format that was written. One of "tris" or "quads". Currently only triangular meshes are supported, so always 'tris'.
Note
This format is used by the surf-ice renderer. The format spec is at https://github.com/neurolabusc/surf-ice/tree/master/mz3.
See also
Other mesh functions:
faces.quad.to.tris(),
read.fs.surface(),
read.fs.surface.asc(),
read.fs.surface.bvsrf(),
read.fs.surface.geo(),
read.fs.surface.gii(),
read.fs.surface.ico(),
read.fs.surface.obj(),
read.fs.surface.off(),
read.fs.surface.ply(),
read.fs.surface.vtk(),
read.mesh.brainvoyager(),
read_nisurface(),
read_nisurfacefile(),
write.fs.surface(),
write.fs.surface.asc(),
write.fs.surface.byu(),
write.fs.surface.gii(),
write.fs.surface.vtk()
Examples
if (FALSE) { # \dontrun{
# Read a surface from a file:
surface_file <- system.file("extdata", "lh.tinysurface",
package = "freesurferformats", mustWork = TRUE
)
mesh <- read.fs.surface(surface_file)
# Now save it:
write.fs.surface.mz3(tempfile(fileext = ".mz3"), mesh$vertices, mesh$faces)
} # }