Smooth: Multi-dimensional smoothing function.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/smoothers.r

Description

Multi-dimensional smoothing function.

Usage

1
Smooth(grids, img, sm.method="ksmooth", ...)

Arguments

grids

A list of monotonically increasing coordinate grids. For example, grids <- list(grid.x=seq(0, 100, 2), grid.y=exp(seq(1, 5, .2))).

img

An m-dim array defined on grids to be smoothed.

sm.method

Smoothing method. Valid choices: 1. ksmooth (kernel smoothing with a gauss kernel, the default choice), 2. tps (thin plate spline), 3. anisodiff (anisotropic smoothing based on Perona-Malik equation)

...

Other options passed to different smoothers such as

  • kernel: A choice of kernel (for kernel smoother; see help of function ksmooth) for more details.

  • bandwidth: For options ksmooth and Tps. The smoothing bandwidth. The kernels are scaled so that their quartiles (viewed as probability densities) are at +/- '0.25*bandwidth'.

  • niter: For option anisodiff only. Number of iterations.

  • kappa.param: For option anisodiff only. A trade-off parameter that controls the estimation of Kappa. (the diffusion contrast parameter). It is expressed as 'lambda' in Equation (8) of the iSPREAD paper (Liu et al Phys. Med. Biol. 2016).

  • lambda: For option anisodiff only. This is 'lamdba' in Equation (7), Perona and Malik IEEE/TPAMI 1990. This parameter controls the speed of numerical scheme and must be in [0, 1/4] to ensure the stability of the algorithm.

  • option: For option anisodiff only. 1. Use Gaussian p.d.f. as the diffusivity function. 2. Use Charbonier conductivity function as the diffusivity function. The second one is the default option because it gives more stable results. There are other options for function Tps() implemented in fields.

Details

This function is a wrapper of different smoothing methods. The default method, "ksmooth", is a multi-dimensional generalization of ksmooth(). The second method, "anisodiff", implements an anisotropic smoother based on Perona-Malik equation. Care must be taken on the boundary points because currently there is no mechanism to take care of them automatically. I may add some code to deal with the boundary points more gracefully in a future release. Another method, "tps", is the thin plate spline smoother, depends on package fields. This function is too slow for very large scale data, it is included primarily as an example.

Value

An array of the same dimension as img.

Author(s)

Xing Qiu

References

[kernel smoothing, multi-dim]

See Also

ksmooth, Tps

Examples

1
2
3
4
5
6
7
8
grid.x <- seq(1, 255, 2); grid.y <- seq(1, 255, 2); grid.z <- seq(1,5,2)
grids <- list(grid.x, grid.y, grid.z)
Y <- array(rnorm(128*128*3), c(128,128,3))
myfit1 <- Smooth(grids, Y, bandwidth=5.0, kernel="normal")
myfit2 <- Smooth(grids, Y, bandwidth=5.0, kernel="box")
myfit3 <- Smooth(grids, Y, kappa.param=0.2, sm.method="anisodiff")
## The following command depends on package fields.
## Not run: myfit3 <- Smooth(grids, Y, bandwidth=5.0, sm.method="tps")

ygu427/iSPREADR documentation built on May 20, 2019, 4:37 p.m.