R/dim_.R

#' @docType methods
#' @rdname dim_-methods
#' @title Extract Image dim_ attribute 
#' @name dim_-methods
#' @description \code{dim_} method for class character
#' @aliases dim_,character-method
#' @param object is a filename to pass to \link{fslval}
#' @import oro.nifti
#' @export
setMethod("dim_", "character", function(object){
  object = path.expand(object)
  stopifnot(file.exists(object))
  slots = paste0("dim", 0:7)
  res = sapply(slots, function(key) {
    fslval(object, keyword = key, verbose = FALSE)
  })
  res = as.numeric(res)
  return(res)
})

Try the fslr package in your browser

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

fslr documentation built on Aug. 25, 2022, 5:07 p.m.