invert.fs.transform: Invert a transformation.

View source: R/transforms_common.R

invert.fs.transformR Documentation

Invert a transformation.

Description

Compute the transformation that undoes the given one, i.e. the one that maps the target coordinates back to the source coordinates. The source and target of the result are swapped, along with the coordinate spaces, and the matrix is inverted. A transformation is never stored inverted, use this function when you need the reverse mapping.

Usage

invert.fs.transform(tf)

Arguments

tf

an fs.transform instance.

Value

an fs.transform instance that maps from the target of tf back to its source.

Note

The format-specific fields of tf (e.g. the parsed header and the volume info of an LTA file, or the intensity of a register.dat file) describe the file that tf was read from and are therefore copied to the result unchanged. They are metadata, not part of the mapping.

See Also

Other header coordinate space: 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.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

tf <- read.fs.transform(system.file("extdata", "talairach.xfm",
  package = "freesurferformats", mustWork = TRUE
))
tf_back <- invert.fs.transform(tf)
tf_back$space_in # the spaces are swapped
max(abs(tf_back$matrix %*% tf$matrix - diag(4))) # the identity


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