R/antsImageStats.R

Defines functions antsImageStats

antsImageStats <- function(image, mask = NULL, na.rm = FALSE) {
  if (!is.null(mask)) {
    mask <- check_ants(mask)
  }
  image <- antsImageClone(image, out_pixeltype = "double")
  res <- ANTsRCore::AntsImageStats(image, mask, na.rm)
  check <- !any(sapply(res, is.raw))
  if (!check) {
    stop("raw output form antsImageStats, please report this bug")
  }
  res <- lapply(res, drop)
  return(res)
}
ANTsX/ANTsR documentation built on March 29, 2025, 6:24 p.m.