orient_rpi: Reorient an Image to RPI orientation

View source: R/orient_rpi.R

orient_rpiR Documentation

Reorient an Image to RPI orientation

Description

Reorient an Image to RPI orientation

Usage

orient_rpi(file, verbose = TRUE)

orient_rpi_file(file, verbose = TRUE)

is_rpi_oriented(file, verbose = FALSE)

Arguments

file

Object of class nifti or character path

verbose

print diagnostic messages

Value

List of 3 elements

  • img: Reoriented image of class nifti

  • convention: Convention (Neurological/Radiological) of original image

  • orientation: Original image orientations

Note

'orient_rpi' and 'orient_rpi_file' uses 'RNifti' to ensure the reading orientation

Examples

lr_fname = system.file( "nifti", "mniLR.nii.gz", package = "oro.nifti")
img = readnii(lr_fname)

rl_fname = system.file( "nifti", "mniRL.nii.gz", package = "oro.nifti")
rl_img = readnii(rl_fname)
stopifnot(all(rl_img[nrow(rl_img):1,,] == img))

reor = orient_rpi(rl_fname)
stopifnot(all(img == reor$img))

rev = reverse_orient_rpi(reor$img, convention = reor$convention,
orientation = reor$orientation)
stopifnot(all(rev == rl_img))

neurobase documentation built on May 29, 2024, 2:17 a.m.