R/nifti_to_afni.R

Defines functions nifti_to_afni

Documented in nifti_to_afni

#' @title Convert NIfTI Image to AFNI FIle
#' @description Converts a NIfTI image to an AFNI file using \code{afni_3dcalc}
#' 
#' @param file NIfTI image or \code{nifti} object
#' @param outfile output filename or prefix.  
#'
#' @return A character filename of the output BRIK
#' @export
nifti_to_afni = function(file,
                         outfile = NULL) {
  expression = "'a'"
  opts = "-prefix"
  if (is.null(outfile)) {
    outfile = tempfile()
  }
  res = afni_3dcalc(file = file,
              expression = expression,
              outfile = outfile,
              opts = opts)
  return(res)
}
neuroconductor-devel/afnir documentation built on May 6, 2021, 7:33 a.m.