Tries to read the file with all implemented surface format reader methods. The file must exist. With the default settings, one can read files in the following surface formats: 1) FreeSurfer binary surface format (e.g., surf/lh.white). 2) FreeSurfer ASCII surface format (e.g., surf/lh.white,asc). 3) GIFTI surface format, only if package gifti is installed. See gifti::read_gifti for details. Feel free to implement additional methods. Hint:keep in mind that they should return one-based indices.
Usage
read_nisurfacefile(filepath, methods = c("fsnative", "fsascii", "gifti"), ...)Value
an instance of fs.surface, read from the file. See read.fs.surface for details. If none of the reader methods succeed, an error is raised.
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(),
write.fs.surface(),
write.fs.surface.asc(),
write.fs.surface.byu(),
write.fs.surface.gii(),
write.fs.surface.mz3(),
write.fs.surface.vtk()
Examples
surface_file <- system.file("extdata", "lh.tinysurface",
package = "freesurferformats", mustWork = TRUE
)
mesh <- read_nisurface(surface_file)
mesh
#> Brain surface trimesh with 5 vertices and 3 faces.
#> -Surface coordinates: minimal values are (0.30, 0.30, 0.30), maximal values are (0.30, 0.30, 0.30).