Read vertex-wise brain surface data from a file. The file can be in any of the supported formats, and the format will be determined from the file extension.
read.fs.morph(filepath, format = "auto")
filepath, | string. Full path to the input file. The suffix determines the expected format as follows: ".mgz" and ".mgh" will be read with the read.fs.mgh function, all other file extensions will be read with the read.fs.curv function. |
---|---|
format | character string, the format to use. One of c("auto", "mgh", "mgz", "curv", "gii"). The default setting "auto" will determine the format from the file extension. |
data, vector of floats. The brain morphometry data, one value per vertex.
Other morphometry functions:
fs.get.morph.file.ext.for.format()
,
fs.get.morph.file.format.from.filename()
,
read.fs.curv()
,
read.fs.mgh()
,
read.fs.morph.gii()
,
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()
curvfile = system.file("extdata", "lh.thickness",
package = "freesurferformats", mustWork = TRUE);
ct = read.fs.morph(curvfile);
cat(sprintf("Read data for %d vertices. Values: min=%f, mean=%f, max=%f.\n",
length(ct), min(ct), mean(ct), max(ct)));
#> Read data for 149244 vertices. Values: min=0.000000, mean=2.437466, max=5.000000.
mghfile = system.file("extdata", "lh.curv.fwhm10.fsaverage.mgz",
package = "freesurferformats", mustWork = TRUE);
curv = read.fs.morph(mghfile);
cat(sprintf("Read data for %d vertices. Values: min=%f, mean=%f, max=%f.\n",
length(ct), min(ct), mean(ct), max(ct)));
#> Read data for 149244 vertices. Values: min=0.000000, mean=2.437466, max=5.000000.