knnSmoothImage.RdCompute 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.
knnSmoothImage( img, mask, radius, intensityWeight = 0.1, spatialSigma = 20, iterations = 1, returnMatrix = FALSE )
| 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. |
antsImage is output
Avants BB
if (FALSE) { img = antsImageRead( getANTsRData( 'r16' ) ) mask = getMask( img ) simg = knnSmoothImage( img=img, mask=mask, radius=2, intensityWeight=1, spatialSigma=1.5, iterations=1 ) }