read_nisurfacefile: S3 method to read a neuroimaging surface file.

View source: R/read_nisurface.R

read_nisurfacefileR Documentation

S3 method to read a neuroimaging surface file.

Description

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"), ...)

Arguments

filepath

character string, the full path to the input surface file.

methods

list of character strings, the formats to try. Each of these must have a function called read_nisurface.<method>, which must return an 'fs.surface' instance on success.

...

parameters passed on to the individual methods

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.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.fs.surface(), read.mesh.brainvoyager(), read_nisurface(), write.fs.surface.asc(), write.fs.surface.byu(), write.fs.surface.gii(), write.fs.surface.mz3(), write.fs.surface.vtk(), write.fs.surface()

Examples

    surface_file = system.file("extdata", "lh.tinysurface",
                            package = "freesurferformats", mustWork = TRUE);
    mesh = read_nisurface(surface_file);
    mesh;


freesurferformats documentation built on May 29, 2024, 5:29 a.m.