Compute a smoothing matrix based on an input matrix of point coordinates

knnSmoothingMatrix(x, k, sigma, segmentation, ...)

Arguments

x

input matrix of point coordinates of dimensions n-spatial spatial dimensions by p points

k

number of neighbors, higher causes more smoothing

sigma

sigma for the gaussian function

segmentation

optional boolean to restrict specific rows to have minimal respons

...

arguments passed to sparseDistanceMatrix

Value

sparse matrix is output

Author

Avants BB

Examples

if (FALSE) { # \dontrun{
mask <- getMask(antsImageRead(getANTsRData("r16")))
spatmat <- t(imageDomainToSpatialMatrix(mask, mask))
smoothingMatrix <- knnSmoothingMatrix(spatmat, k = 25, sigma = 3.0)
rvec <- rnorm(nrow(smoothingMatrix))
srvec <- smoothingMatrix %*% rvec
rvi <- makeImage(mask, rvec)
srv <- makeImage(mask, as.numeric(srvec))
} # }