R/oro2nii.R

Defines functions oro2nii

Documented in oro2nii

#' @title Convert oro.nifti nifti to RNifti niftiImage object
#' @description Converts a nifti from oro.nifti to a 
#' niftiImage object from the RNifti package
#' @param image \code{\link{nifti}} object
#' @param verbose print messages, passed to \code{\link{writeNIfTI}}
#' @return Object of class \code{niftiImage}
#' @export
#' @importFrom RNifti readNifti
oro2nii = function(image, verbose = FALSE) {
  outfile = tempfile()
  writeNIfTI(image, 
             filename = outfile, 
             onefile = TRUE,
             gzipped = TRUE,
             verbose = verbose)
  outfile = paste0(outfile, ".nii.gz")
  img = RNifti::readNifti(outfile)
  return(img)
}

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.