Smooth image or multi-channel image

smoothImage(inimg, sigma, sigmaInPhysicalCoordinates = TRUE,
  FWHM = FALSE, max_kernel_width = 70)

Arguments

inimg

Image to smooth

sigma

Smoothing factor. Can be scalar, in which case the same sigma is applied to each dimension, or a vector of length dim(inimg) to specify a unique smoothness for each dimension.

sigmaInPhysicalCoordinates

If true, the smoothing factor is in millimeters; if false, it is in pixels.

FWHM

If true, sigma is interpreted as the full-width-half-max (FWHM) of the filter, not the sigma of a Gaussian kernel.

max_kernel_width

Maximum kernel width

Value

antsImage smoothed image

Examples

set.seed(1234) img <- makeImage(c(5,5), rnorm(25)) simg <- smoothImage(img, c(1.2,1.5)) testthat::expect_equal(sum(simg), -5.59352651424706) testthat::expect_error(smoothImage(img, c(1.2,1.5, 3))) simg2 <- smoothImage(img, c(1.2,1.5), FWHM = TRUE) multi = antsImageRead(getANTsRData("multi_component_image")) smulti <- smoothImage(multi, c(1.2,1.5)) means = sapply(splitChannels(smulti), mean) testthat::expect_equal(means, c(86.0794883092244, 81.913664855957, 85.519760093689))