Learn R Programming

freesurferformats (version 1.1.0)

read.fs.transform: Load transformation matrix from a file.

Description

Load transformation matrix from a file.

Usage

read.fs.transform(filepath, format = "auto")

Value

an fs.transform instance, see fs.transform. Its fields include the 'matrix', and the coordinate spaces the matrix maps between (space_in, space_out and voxel_base). Which of them are known depends on the format: an xfm file states neither (both sides are RAS), a register.dat file states both by definition, an FSL matrix maps voxel coordinates (zero-based) to voxel coordinates, and an LTA file states the spaces in its header.

Arguments

filepath

character string, the full path to the transform file.

format

character string, the file format. 'auto' guesses it from the file extension and the file content, and 'xfm' (for xform format), 'dat' (for tkregister style, e.g. register.dat), 'lta' (for FreeSurfer LTA), 'fslmat' (for an FSL/FLIRT matrix) and 'itk' (for an ITK text transform, e.g. a .tfm file) can be given explicitly.

See Also

Other header coordinate space: invert.fs.transform(), is.fs.transform(), mghheader.is.ras.valid(), mghheader.ras2vox(), mghheader.ras2vox.tkreg(), mghheader.scanner2tkreg(), mghheader.tkreg2scanner(), mghheader.vox2ras(), mghheader.vox2ras.tkreg(), print.fs.transform(), read.fs.transform.dat(), read.fs.transform.fslmat(), read.fs.transform.itk(), read.fs.transform.lta(), read.fs.transform.xfm(), sm0to1(), sm1to0(), summary.fs.transform(), transform2lps(), transform2ras(), transform2voxel(), transform2world(), write.fs.transform(), write.fs.transform.dat(), write.fs.transform.fslmat(), write.fs.transform.itk(), write.fs.transform.lta(), write.fs.transform.xfm()

Examples

Run this code
tf_file <- system.file("extdata", "talairach.xfm",
  package = "freesurferformats",
  mustWork = TRUE
)
transform <- read.fs.transform(tf_file)
transform$matrix

Run the code above in your browser using DataLab