knnSmoothImage: k-nearest neighbors constrained image smoothing

View source: R/multiscaleSVDxpts.R

knnSmoothImageR Documentation

k-nearest neighbors constrained image smoothing

Description

Compute a smoothing matrix based on an input matrix of point coordinates as well as neighborhood intensity patterns. this performs a form of edge preserving smoothing.

Usage

knnSmoothImage(
  img,
  mask,
  radius,
  intensityWeight = 0.1,
  spatialSigma = 20,
  iterations = 1,
  returnMatrix = FALSE
)

Arguments

img

input image to smooth

mask

input image mask

radius

number of neighbors, higher causes more smoothing

intensityWeight

weight for intensity component, value 1 will weight local voxel intensity roughly equally to spatial component

spatialSigma

for gaussian defining spatial distances

iterations

number of iterations over which to apply smoothing kernel

returnMatrix

boolean, will return smoothing matrix instead of image.

Value

antsImage is output

Author(s)

Avants BB

Examples

## Not run: 
img <- antsImageRead(getANTsRData("r16"))
mask <- getMask(img)
simg <- knnSmoothImage(
  img = img, mask = mask, radius = 2, intensityWeight = 1,
  spatialSigma = 1.5, iterations = 1
)

## End(Not run)

stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.