R/voxres.R

Defines functions voxres

Documented in voxres

#' @title Gets Voxel Resolution
#' @return Scalar numeric, one number, in cubic mm or cubic cm (cc/mL).
#' @param img nifti object
#' @param units output unit, either cubic mm or cubic cm.
#' @description Grabs the 3 voxel dimensions and takes the product
#' @export
voxres = function(img, units = c("mm", "cm")){
  units = match.arg(units)
  divisor = switch(units,
    "mm" = 1,
    "cm" = 1000
  )
  prod(voxdim(img))/divisor
}

Try the oro.nifti package in your browser

Any scripts or data that you put into this service are public.

oro.nifti documentation built on Aug. 10, 2022, 5:09 p.m.