Learn R Programming

freesurferformats (version 1.1.0)

read.fs.transform.itk: Read a transformation matrix from an ITK text transform file.

Description

Read the plain text file format that ITK and the tools built on it (3D Slicer, ANTs via ConvertTransformFile, SimpleITK and the workflows of fMRIPrep/QSIPrep that are based on them) use to store linear transformations, usually with the extension .tfm or .txt.

Usage

read.fs.transform.itk(filepath)

Value

an fs.transform instance. An ITK transform operates on the world coordinates of the images, which in ITK are left-posterior-superior, so space_in and space_out are 'lps' and voxel_base is NA. This is not the RAS space that the other formats of this package use, and it is not converted silently: use transform2ras to get a transformation in RAS coordinates. The volumes are not recorded in the file, so src and dst are NULL. The ITK class name (e.g. 'AffineTransform_float_3_3') is stored in the type field, and the values of the FixedParameters entry in the fixed_parameters field.

Arguments

filepath

character string, the full path to the transform file.

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.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
xfm_file <- system.file("extdata", "talairach.xfm", package = "freesurferformats", mustWork = TRUE)
tf <- transform2ras(transform2lps(read.fs.transform(xfm_file)))
summary(tf)$space_in

Run the code above in your browser using DataLab