read.fs.curv {freesurferformats} | R Documentation |
Read file in FreeSurfer curv format
Description
Read vertex-wise brain morphometry data from a file in FreeSurfer 'curv' format. Both the binary and ASCII versions are supported. For a subject (MRI image pre-processed with FreeSurfer) named 'bert', an example file would be 'bert/surf/lh.thickness', which contains n values. Each value represents the cortical thickness at the respective vertex in the brain surface mesh of bert.
Usage
read.fs.curv(filepath, format = "auto", with_header = FALSE)
Arguments
filepath |
string. Full path to the input curv file. Note: gzipped binary curv files are supported and gz binary format is assumed if the filepath ends with ".gz". |
format |
one of 'auto', 'asc', 'bin', 'nii' or 'txt'. The format to assume. If set to 'auto' (the default), binary format will be used unless the filepath ends with '.asc' or '.txt'. The latter is just one float value per line in a text file. |
with_header |
logical, whether to return named list with 'header' and 'data' parts. Only valid with FreeSurfer binary curv format. |
Value
data vector of floats. The brain morphometry data, one value per vertex.
See Also
Other morphometry functions:
fs.get.morph.file.ext.for.format()
,
fs.get.morph.file.format.from.filename()
,
read.fs.mgh()
,
read.fs.morph.gii()
,
read.fs.morph()
,
read.fs.volume()
,
read.fs.weight()
,
write.fs.curv()
,
write.fs.label.gii()
,
write.fs.mgh()
,
write.fs.morph.asc()
,
write.fs.morph.gii()
,
write.fs.morph.ni1()
,
write.fs.morph.ni2()
,
write.fs.morph.smp()
,
write.fs.morph.txt()
,
write.fs.morph()
,
write.fs.weight.asc()
,
write.fs.weight()
Examples
curvfile = system.file("extdata", "lh.thickness",
package = "freesurferformats", mustWork = TRUE);
ct = read.fs.curv(curvfile);
cat(sprintf("Read data for %d vertices. Values: min=%f, mean=%f, max=%f.\n",
length(ct), min(ct), mean(ct), max(ct)));