Reorients a neuroimaging volume or vector to the canonical RAS+
(Right-Anterior-Superior) orientation by permuting and flipping axes.
This is equivalent to nibabel's as_closest_canonical().
Usage
as_canonical(x, target = c("R", "A", "S"))Details
The function works by computing the orientation transform from the current axis codes to the target codes, then applying the necessary axis permutations and flips. The affine matrix is updated to reflect the new orientation while preserving world-coordinate mapping.
Examples
sp <- NeuroSpace(c(10L, 10L, 10L), c(2, 2, 2))
vol <- DenseNeuroVol(array(rnorm(1000), c(10,10,10)), sp)
ras_vol <- as_canonical(vol)
axcodes(ras_vol) # "R" "A" "S"
#> [1] "R" "A" "S"