if (FALSE) {
# 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.vtk(tempfile(fileext = ".vtk"), mesh$vertices, mesh$faces)
# Or as a binary file using the layout of VTK 5.1:
write.fs.surface.vtk(tempfile(fileext = ".vtk"), mesh$vertices, mesh$faces,
version = 5.1, binary = TRUE
)
}
Run the code above in your browser using DataLab