# Active transform: convert point coordinates from RAS to LPS
trans <- transform_orientation(orientation_from = "RAS",
orientation_to = "LPS",
interpretation = "active")
trans$data[[1]] # diag(-1, -1, 1, 1)
# Apply to a point
point_ras <- c(10, 20, 30, 1)
point_lps <- trans$data[[1]] %*% point_ras
# Using a space object
space <- new_space("scanner", orientation = "RAS")
trans <- transform_orientation(space_from = space,
orientation_to = "LPS")
# Passive transform: transform coordinate axes
trans_passive <- transform_orientation(orientation_from = "RAS",
orientation_to = "LPS",
interpretation = "passive")
# With axis permutation
trans <- transform_orientation(orientation_from = "RAS",
orientation_to = "PIR")
if (FALSE) {
# FSL to RAS conversion (requires image)
trans_fsl2ras <- transform_orientation(orientation_from = "FSL",
orientation_to = "RAS",
image = "brain.nii.gz")
}
Run the code above in your browser using DataLab