transform2ras: Convert a transformation to RAS world coordinates.

View source: R/transforms_convert.R

transform2rasR Documentation

Convert a transformation to RAS world coordinates.

Description

ITK and the tools built on it (3D Slicer, ANTs, SimpleITK and the workflows that use them) work in world coordinates that are left-posterior-superior (LPS), while the other file formats of this package use right-anterior-superior (RAS) coordinates. The two conventions differ in the sign of the first two axes only, so converting a transformation between them neither needs nor uses the geometry of a volume, unlike the conversion between voxel and world coordinates, see transform2world. A transformation that is already in RAS coordinates is returned unchanged.

Usage

transform2ras(tf)

Arguments

tf

an fs.transform instance whose matrix operates on world coordinates, i.e. space_in and space_out are either 'lps' or 'ras'.

Value

an fs.transform instance whose matrix operates on RAS coordinates.

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.lta(), read.fs.transform.xfm(), sm0to1(), sm1to0(), summary.fs.transform(), transform2lps(), 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

# An ITK transform operates on LPS coordinates, the FreeSurfer formats on RAS coordinates.
tf <- read.fs.transform(system.file("extdata", "talairach.xfm",
  package = "freesurferformats", mustWork = TRUE
))
summary(tf)$space_in
summary(transform2lps(tf))$space_in
summary(transform2ras(transform2lps(tf)))$space_in


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