read.fs.transform.lta: Load transformation matrix from a FreeSurfer linear transform...

View source: R/read_fs_transform.R

read.fs.transform.ltaR Documentation

Load transformation matrix from a FreeSurfer linear transform array (LTA) file.

Description

Load transformation matrix from a FreeSurfer linear transform array (LTA) file.

Usage

read.fs.transform.lta(filepath)

Arguments

filepath

character string, the full path to the transform file.

Value

an fs.transform instance. The header of an LTA file states whether the matrix operates on voxel indices (type 0, LINEAR_VOX_TO_VOX) or on RAS world coordinates (type 1, LINEAR_RAS_TO_RAS), and that is used to set space_in, space_out and voxel_base. FreeSurfer voxel indices are zero-based. The file also records both volumes it relates, so src and dst contain the file name, the dimensions, the voxel size and the voxel-to-RAS matrix of each of them. The parsed header and volume info sections are kept in the header and volumes fields.

Note

I found no spec for the LTA file format, only example files, so this function should be used with care. If you have a file that is not parsed correctly, please open an issue and attach it.

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(), read.fs.transform.dat(), read.fs.transform.fslmat(), read.fs.transform.itk(), 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

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


freesurferformats documentation built on Sept. 25, 2026, 1:07 a.m.