smooth_image: Gaussian smooth image using ANTsR

Description Usage Arguments Value Examples

View source: R/smooth_image.R

Description

This function calls smoothIamge to smooth an image and either saves the image or returns an object of class nifti

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
smooth_image(
  file,
  sigma = 10,
  mask = NULL,
  smooth_mask = TRUE,
  smoothed_mask = NULL,
  verbose = TRUE,
  retfile = FALSE,
  ...
)

Arguments

file

(character) image to be smoothed

sigma

(numeric) sigma (in mm) of Gaussian kernel for smoothing

mask

(character) optional mask given for image

smooth_mask

(logical) Smooth mask? If TRUE, the masked image will be divided by the smoothed mask.

smoothed_mask

(character or antsImage) If specified and smooth_mask = TRUE, then will use this as the smoothed mask for division.

verbose

(logical) print out command before running

retfile

logical to indicate if an antsImage should be returned (useful for chaining)

...

additional arguments passed to smoothImage.

Value

Object of class nifti

Examples

1
2
3
4
5
6
7
8
9
system.time({
library(oro.nifti)
dims = c(50, 50, 50)
x = array(rnorm(prod(dims)), dim = dims)
img = nifti(x, dim= dims,
datatype = convert.datatype()$FLOAT32, cal.min = min(x), 
cal.max = max(x), pixdim = rep(1, 4))
s.img = smooth_image(img, sigma = 3, sigmaInPhysicalCoordinates = TRUE)
})

muschellij2/extrantsr documentation built on July 27, 2021, 7:41 a.m.