View source: R/write_fs_label.R
| write.fs.label | R Documentation |
Write vertex coordinates and vertex indices defining faces to a file in FreeSurfer binary surface format. For a subject (MRI image pre-processed with FreeSurfer) named 'bert', an example file would be 'bert/label/lh.cortex'.
write.fs.label(
filepath,
vertex_indices,
vertex_coords = NULL,
vertex_data = NULL,
indices_are_one_based = TRUE
)
filepath |
string. Full path to the output label file. If it ends with ".gz", the file is written in gzipped format. Note that this is not common, and that other software may not handle this transparently. |
vertex_indices |
instance of class |
vertex_coords |
an n x 3 float matrix of vertex coordinates, where n is the number of 'vertex_indices'. Optional, defaults to NULL, which will write placeholder data. The vertex coordinates are not used by any software I know (you should get them from the surface file). Will be used from |
vertex_data |
a numerical vector of length n, where n is the number of 'vertex_indices'. Optional, defaults to NULL, which will write placeholder data. The vertex data are not used by any software I know (you should get them from a morphometry file). Will be used from |
indices_are_one_based |
logical, whether the given indices are one-based, as is standard in R. Indices are stored zero-based in label files, so if this is TRUE, all indices will be incremented by one before writing them to the file. Defaults to TRUE. If FALSE, it is assumed that they are zero-based and they are written to the file as-is. Will be used from |
dataframe, the dataframe that was written to the file (after the header lines).
Other label functions:
read.fs.label(),
read.fs.label.gii(),
read.fs.label.native()
## Not run:
# Write a simple label containing only vertex indices:
label_vertices <- c(1, 2, 3, 4, 5, 1000, 2000, 2323, 34, 34545, 42)
write.fs.label(tempfile(fileext = ".label"), label_vertices)
# Load a full label, write it back to a file:
labelfile <- system.file("extdata", "lh.entorhinal_exvivo.label",
package = "freesurferformats", mustWork = TRUE
)
label <- read.fs.label(labelfile, full = TRUE)
write.fs.label(tempfile(fileext = ".label"), label)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.