Skip to contents

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.

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
#> [1] "ras"
summary(transform2lps(tf))$space_in
#> [1] "lps"
summary(transform2ras(transform2lps(tf)))$space_in
#> [1] "ras"