Version: | 2.5-6 |
Date: | 2024-09-29 |
Title: | Adaptive Weights Smoothing |
Author: | Joerg Polzehl [aut, cre], Felix Anker [ctb] |
Maintainer: | Joerg Polzehl <joerg.polzehl@wias-berlin.de> |
Depends: | R (≥ 3.4.0), awsMethods (≥ 1.1-1) |
Imports: | methods, gsl |
Description: | We provide a collection of R-functions implementing adaptive smoothing procedures in 1D, 2D and 3D. This includes the Propagation-Separation Approach to adaptive smoothing, the Intersecting Confidence Intervals (ICI), variational approaches and a non-local means filter. The package is described in detail in Polzehl J, Papafitsoros K, Tabelow K (2020). Patch-Wise Adaptive Weights Smoothing in R. Journal of Statistical Software, 95(6), 1-27. <doi:10.18637/jss.v095.i06>, Usage of the package in MR imaging is illustrated in Polzehl and Tabelow (2023), Magnetic Resonance Brain Imaging, 2nd Ed. Appendix A, Springer, Use R! Series. <doi:10.1007/978-3-031-38949-8>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Copyright: | This package is Copyright (C) 2005-2024 Weierstrass Institute for Applied Analysis and Stochastics. |
URL: | https://www.wias-berlin.de/people/polzehl/ |
RoxygenNote: | 5.0.1 |
NeedsCompilation: | yes |
Packaged: | 2024-09-29 20:05:48 UTC; polzehl |
Repository: | CRAN |
Date/Publication: | 2024-09-30 17:40:01 UTC |
Adaptive Weights Smoothing
Description
We provide a collection of R-functions implementing adaptive smoothing procedures in 1D, 2D and 3D. This includes the Propagation-Separation Approach to adaptive smoothing, the Intersecting Confidence Intervals (ICI), variational approaches and a non-local means filter. The package is described in detail in Polzehl J, Papafitsoros K, Tabelow K (2020). Patch-Wise Adaptive Weights Smoothing in R. Journal of Statistical Software, 95(6), 1-27. <doi:10.18637/jss.v095.i06>, Usage of the package in MR imaging is illustrated in Polzehl and Tabelow (2023), Magnetic Resonance Brain Imaging, 2nd Ed. Appendix A, Springer, Use R! Series. <doi:10.1007/978-3-031-38949-8>.
Details
The DESCRIPTION file:
Package: | aws |
Version: | 2.5-6 |
Date: | 2024-09-29 |
Title: | Adaptive Weights Smoothing |
Authors@R: | c(person("Joerg","Polzehl",role=c("aut","cre"),email="joerg.polzehl@wias-berlin.de"),person("Felix","Anker",role=c("ctb"))) |
Author: | Joerg Polzehl [aut, cre], Felix Anker [ctb] |
Maintainer: | Joerg Polzehl <joerg.polzehl@wias-berlin.de> |
Depends: | R (>= 3.4.0), awsMethods (>= 1.1-1) |
Imports: | methods, gsl |
Description: | We provide a collection of R-functions implementing adaptive smoothing procedures in 1D, 2D and 3D. This includes the Propagation-Separation Approach to adaptive smoothing, the Intersecting Confidence Intervals (ICI), variational approaches and a non-local means filter. The package is described in detail in Polzehl J, Papafitsoros K, Tabelow K (2020). Patch-Wise Adaptive Weights Smoothing in R. Journal of Statistical Software, 95(6), 1-27. <doi:10.18637/jss.v095.i06>, Usage of the package in MR imaging is illustrated in Polzehl and Tabelow (2023), Magnetic Resonance Brain Imaging, 2nd Ed. Appendix A, Springer, Use R! Series. <doi:10.1007/978-3-031-38949-8>. |
License: | GPL (>=2) |
Copyright: | This package is Copyright (C) 2005-2024 Weierstrass Institute for Applied Analysis and Stochastics. |
URL: | https://www.wias-berlin.de/people/polzehl/ |
RoxygenNote: | 5.0.1 |
Index of help topics:
ICIcombined Adaptive smoothing by Intersection of Confidence Intervals (ICI) using multiple windows ICIsmooth Adaptive smoothing by Intersection of Confidence Intervals (ICI) ICIsmooth-class Class '"ICIsmooth"' TV_denoising TV/TGV denoising of image data aws AWS for local constant models on a grid aws-class Class '"aws"' aws-package Adaptive Weights Smoothing aws.gaussian Adaptive weights smoothing for Gaussian data with variance depending on the mean. aws.irreg local constant AWS for irregular (1D/2D) design aws.segment Segmentation by adaptive weights for Gaussian models. awsLocalSigma 3D variance estimation awsdata Extract information from an object of class aws awssegment-class Class '"awssegment"' awstestprop Propagation condition for adaptive weights smoothing awsweights Generate weight scheme that would be used in an additional aws step binning Binning in 1D, 2D or 3D extract-methods Methods for Function 'extract' in Package 'aws' gethani Auxiliary functions (for internal use) kernsm Kernel smoothing on a 1D, 2D or 3D grid kernsm-class Class '"kernsm"' lpaws Local polynomial smoothing by AWS nlmeans NLMeans filter in 1D/2D/3D paws Adaptive weigths smoothing using patches plot-methods Methods for Function 'plot' from package 'graphics' in Package 'aws' print-methods Methods for Function 'print' from package 'base' in Package 'aws' qmeasures Quality assessment for image reconstructions. risk-methods Compute risks characterizing the quality of smoothing results show-methods Methods for Function 'show' in Package 'aws' smooth3D Auxiliary 3D smoothing routines smse3ms Adaptive smoothing in orientation space SE(3) summary-methods Methods for Function 'summary' from package 'base' in Package 'aws' vaws vector valued version of function 'aws' The function implements the propagation separation approach to nonparametric smoothing (formerly introduced as Adaptive weights smoothing) for varying coefficient likelihood models with vector valued response on a 1D, 2D or 3D grid. vpaws vector valued version of function 'paws' with homogeneous covariance structure
Author(s)
Joerg Polzehl [aut, cre], Felix Anker [ctb]
Maintainer: Joerg Polzehl <joerg.polzehl@wias-berlin.de>
References
J. Polzehl, K. Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Appendix A. Doi:10.1007/978-3-030-29184-6.
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
J. Polzehl and V. Spokoiny (2006) Propagation-Separation Approach for Local Likelihood Estimation, Prob. Theory and Rel. Fields 135(3), 335-362. DOI:10.1007/s00440-005-0464-1.
J. Polzehl, V. Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354. DOI:10.1111/1467-9868.00235.
V. Katkovnik, K. Egiazarian and J. Astola (2006) Local Approximation Techniques in Signal and Image Processing, SPIE Press Monograph Vol. PM 157
A. Buades, B. Coll and J. M. Morel (2006). A review of image denoising algorithms, with a new one. Simulation, 4, 490-530. DOI:10.1137/040616024.
Rudin, L.I., Osher, S. and Fatemi, E. (1992). Nonlinear total variation based noise removal algorithms. Phys. D, 60, 259-268. DOI: 10.1016/0167-2789(92)90242-F.
Bredies, K., Kunisch, K. and Pock, T. (2010). Total Generalized Variation. SIAM J. Imaging Sci., 3, 492-526. DOI:10.1137/090769521.
Adaptive smoothing by Intersection of Confidence Intervals (ICI) using multiple windows
Description
The function performs adaptive smoothing by Intersection of Confidence Intervals (ICI) using multiple windows as described in Katkovnik et al (2006)
Usage
ICIcombined(y, hmax, hinc = 1.45, thresh = NULL, kern = "Gaussian", m = 0,
sigma = NULL, nsector = 1, symmetric = FALSE, presmooth = FALSE,
combine = "weighted", unit = c("SD","FWHM"))
Arguments
y |
Object of class |
hmax |
maximum bandwidth |
hinc |
factor used to increase the bandwidth from scale to scale |
thresh |
threshold used in tests to determine the best scale |
kern |
Determines the kernel function.
Object of class |
m |
Object of class |
sigma |
error standard deviation |
nsector |
number of sectors to use. |
symmetric |
Object of class |
presmooth |
Object of class |
combine |
Either |
unit |
How should the bandwidth be interpreted in case of a Gaussian kernel.
For |
Details
This mainly follows Chapter 6.2 in Katkovnik et al (2006).
Value
An object of class ICIsmooth
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
V. Katkovnik, K. Egiazarian and J. Astola, Local Approximation Techniques in Signal And Image Processing, SPIE Society of Photo-Optical Instrumentation Engin., 2006, PM157
See Also
ICIsmooth
, ICIsmooth-class
, kernsm
Adaptive smoothing by Intersection of Confidence Intervals (ICI)
Description
The function performs adaptive smoothing by Intersection of Confidence Intervals (ICI) as described in Katkovnik et al (2006)
Usage
ICIsmooth(y, hmax, hinc = 1.45, thresh = NULL, kern = "Gaussian", m = 0,
sigma = NULL, nsector = 1, sector = 1, symmetric = FALSE,
presmooth = FALSE, unit = c("SD","FWHM"))
Arguments
y |
Object of class |
hmax |
maximum bandwidth |
hinc |
factor used to increase the bandwidth from scale to scale |
thresh |
threshold used in tests to determine the best scale |
kern |
Determines the kernel function.
Object of class |
m |
Object of class |
sigma |
error standard deviation |
nsector |
number of sectors to use. Positive weights are restricted to the sector
selected by |
sector |
Object of class |
symmetric |
Object of class |
presmooth |
Object of class |
unit |
How should the bandwidth be interpreted in case of a Gaussian kernel.
For |
Details
This mainly follows Chapter 6.1 in Katkovnik et al (2006).
Value
An object of class ICIsmooth
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
V. Katkovnik, K. Egiazarian and J. Astola, Local Approximation Techniques in Signal And Image Processing, SPIE Society of Photo-Optical Instrumentation Engin., 2006, PM157
See Also
ICIcombined
, ICIsmooth-class
, kernsm
Class "ICIsmooth"
Description
The "ICIsmooth"
class is
used for objects obtained by functions ICIsmooth
and ICIcombined
.
Objects from the Class
Objects can be created by calls of the form new("ICIsmooth", ...)
or by functions ICIsmooth
and ICIcombined
.
Slots
.Data
:Object of class
"list"
, usually empty.y
:Object of class
"array"
containing the original (response) datady
:Object of class
"numeric"
dimension attribute ofy
x
:Object of class
"numeric"
if provided the design pointshmax
:Object of class
"numeric"
maximum bandwidthhinc
:Object of class
"numeric"
initial bandwidththresh
:Object of class
"numeric"
threshold used for bandwidth selectionkern
:Object of class
"character"
kernel, can be any ofc("Gaussian","Uniform","Triangle","Epanechnicov","Biweight","Triweight")
. Defaults tokern="Gaussian"
.m
:Object of class
"integer"
vector of lengthlength(dy)
determining the order of derivatives specified for the coordinate directios.nsector
:Object of class
"integer"
number of sectors to use.sector
:Object of class
"integer"
sector used.symmetric
:Object of class
"logical"
sectors are symmetric with respect to the origin.yhat
:Object of class
"array"
smoothed response variablevhat
:Object of class
"array"
estimated variance of smoothed response variablehbest
:Object of class
"array"
selected bandwidth(s))sigma
:Object of class
"numeric"
estimated standard deviation of errors iny
call
:Object of class
"call"
that created the object.
Methods
- extract
signature(x = "ICIsmooth")
: ...- risk
signature(y = "ICIsmooth")
: ...- plot
Method for Function ‘plot’ in Package ‘aws’.
- show
Method for Function ‘show’ in Package ‘aws’.
Method for Function ‘print’ in Package ‘aws’.
- summary
Method for Function ‘summary’ in Package ‘aws’.
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
V. Katkovnik, K. Egiazarian and J. Astola, Local Approximation Techniques in Signal And Image Processing, SPIE Society of Photo-Optical Instrumentation Engin., 2006, PM157
See Also
ICIsmooth
, ICIcombined
, kernsm
, aws
Examples
showClass("ICIsmooth")
TV/TGV denoising of image data
Description
Total variation and total generalized variation are classical energy minimizing methods for image denoising.
Usage
TV_denoising(datanoisy, alpha, iter = 1000, tolmean = 1e-06,
tolsup = 1e-04, scale = 1, verbose=FALSE)
TGV_denoising(datanoisy, alpha, beta, iter = 1000, tolmean = 1e-06,
tolsup = 1e-04, scale = 1, verbose=FALSE)
TV_denoising_colour(datanoisy, alpha, iter = 1000, tolmean = 1e-06,
tolsup = 1e-04, scale = 1, verbose=FALSE)
TGV_denoising_colour(datanoisy, alpha, beta, iter = 1000, tolmean = 1e-06,
tolsup = 1e-04, scale = 1, verbose=FALSE)
Arguments
datanoisy |
matrix of noisy 2D image data. In case of |
alpha |
TV regularization parameter. |
beta |
additional TGV regularization parameter. |
iter |
max. number of iterations |
tolmean |
requested accuracy for mean image correction |
tolsup |
requested accuracy for max (over pixel) image correction |
scale |
image scale |
verbose |
report convergence diagnostics. |
Details
Reimplementation of original matlab code by Kostas Papafitsoros (WIAS).
Value
TV/TGV reconstructed image data (2D array)
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
Rudin, L.I., Osher, S. and Fatemi, E. (1992). Nonlinear total variation based noise removal algorithms. Phys. D, 60, 259-268. DOI: 10.1016/0167-2789(92)90242-F.
Bredies, K., Kunisch, K. and Pock, T. (2010). Total Generalized Variation. SIAM J. Imaging Sci., 3, 492-526. DOI:10.1137/090769521.
Auxiliary functions (for internal use)
Description
Function gethani
determines a bandwidth that leads to, for the specified kernel, a variance reduction for a non-adaptive kernel estimate by a factor of value
.
getvofh
calculates the sum of location weights for a given bandwidth vector and kernel.
sofmchi
precomputes the variance of a non-central chi distribution
with 2*L
degrees of freedom as a function of the noncentrality parameter for an interval c(0,to)
.
Functions residualVariance
and residualSpatialCorr
are
used in package fmri
to calculate variances and spatial correlations from residual objects.
Usage
gethani(x, y, lkern, value, wght, eps = 0.01)
getvofh(bw, lkern, wght)
sofmchi(L, to = 50, delta = 0.01)
residualVariance(residuals, mask, resscale = 1, compact = FALSE)
residualSpatialCorr(residuals, mask, lags = c(5, 5, 3), compact = FALSE)
Arguments
x |
lower bound of search interval |
y |
upper bound of search interval |
lkern |
code for location kernel |
value |
target sum of location weights |
wght |
relative size of voxel dimensions |
eps |
attempted precision for bandwidth search |
bw |
vector of bandwidths, length equal to 1,2 or 3 depending on the dimensionality of the problem. |
L |
number of effective coils, |
to |
upper interval bound. |
delta |
discretization width. |
residuals |
array of residuals, if |
mask |
mask of active voxel (e.g. brain masks) |
resscale |
scale for residuals (residuals may be scaled for optimal integer*2 storage) |
compact |
logical, determines if only information for voxel within mask or full for full data cubes is given. |
lags |
positive integer vector of length 3, maximum lags for spatial correlations for each coordinate direction to be computed |
Details
These are auxiliary functions not to be used by the user. They are only exported to be available for internal use in packages fmri
, dti
, qMRI
and adimpro
.
Value
gethani
returns a vector of bandwidths,
getvofh
returns the variance reduction that would be obtained with a kernel estimate employing the specified kernel and bandwidth,
sofmchi
returns a list with, e.g., components ncp
and s2
containing vectors of noncentralityparameter values and corresponding variances, respectively, for the specified noncentral Chi distribution,
residualVariance
returns a vector (compact==TRUE) or array(compact==FALSE) of voxelwise residual variances,
residualSpatialCorr
returns an array of dimension lags
containing spatial correlations.
Note
These functions are for internal use only. They are only exported to be available in other packages.
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
AWS for local constant models on a grid
Description
The function implements the propagation separation approach to
nonparametric smoothing (formerly introduced as Adaptive weights smoothing)
for varying coefficient likelihood models on a 1D, 2D or 3D grid. For "Gaussian"
models, i.e. regression with additive "Gaussian" errors, a homoskedastic
or heteroskedastic model is used depending on the content of sigma2
Usage
aws(y,hmax=NULL, mask=NULL, aws=TRUE, memory=FALSE, family="Gaussian",
lkern="Triangle", aggkern="Uniform",
sigma2=NULL, shape=NULL, scorr=0, spmin=0.25,
ladjust=1,wghts=NULL,u=NULL,graph=FALSE,demo=FALSE,
testprop=FALSE,maxni=FALSE)
Arguments
y |
array |
hmax |
|
aws |
logical: if TRUE structural adaptation (AWS) is used. |
mask |
optional logical mask, same dimensionality as |
memory |
logical: if TRUE stagewise aggregation is used as an additional adaptation scheme. |
family |
|
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
aggkern |
character: kernel used in stagewise aggregation, either "Triangle" or "Uniform" |
sigma2 |
|
shape |
Allows to specify an additional shape parameter for certain family models. Currently only used for family="Variance", that is |
scorr |
The vector |
spmin |
Determines the form (size of the plateau) in the adaptation kernel. Not to be changed by the user. |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
graph |
If |
demo |
If |
testprop |
If set this provides diagnostics for testing the propagation condition. The values of |
maxni |
If TRUE use |
Details
The function implements the propagation separation approach to
nonparametric smoothing (formerly introduced as Adaptive weights smoothing)
for varying coefficient likelihood models on a 1D, 2D or 3D grid. For "Gaussian"
models, i.e. regression with additive "Gaussian" errors, a homoskedastic
or heteroskedastic model is used depending on the content of sigma2
.
aws==FALSE
provides the stagewise aggregation procedure from Belomestny and Spokoiny (2004).
memory==FALSE
provides Adaptive weights smoothing without control by stagewise aggregation.
The essential parameter in the procedure is a critical value lambda
. This parameter has an
interpretation as a significance level of a test for equivalence of two local
parameter estimates. Optimal values mainly depend on the choosen family
.
Values set internally are choosen to fulfil a propagation condition, i.e. in case of a
constant (global) parameter value and large hmax
the procedure
provides, with a high probability, the global (parametric) estimate.
More formally we require the parameter lambda
to be specified such that
\bf{E} |\hat{\theta}^k - \theta| \le (1+\alpha) \bf{E} |\tilde{\theta}^k - \theta|
where \hat{\theta}^k
is the aws-estimate in step k
and \tilde{\theta}^k
is corresponding nonadaptive estimate using the same bandwidth (lambda=Inf
).
The value of lambda can be adjusted by specifying the factor ladjust
. Values ladjust>1
lead to an less effective adaptation while ladjust<<1
may lead to random segmentation
of, with respect to a constant model, homogeneous regions.
The numerical complexity of the procedure is mainly determined by hmax
. The number
of iterations is approximately Const*d*log(hmax)/log(1.25)
with d
being the dimension
of y
and the constant depending on the kernel lkern
. Comlexity in each iteration step is Const*hakt*n
with hakt
being the actual bandwith in the iteration step and n
the number of design points.
hmax
determines the maximal possible variance reduction.
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function, |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
scorr |
family = "character" |
family |
shape = "numeric" |
shape |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
FALSE |
varmodel = "character" |
"Constant" |
vcoef = "numeric" |
numeric(0) |
call = "function" |
the arguments of the call to |
Note
use setCores='number of threads'
to enable parallel execution.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Appendix A. Doi:10.1007/978-3-030-29184-6.
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
J. Polzehl, V. Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354. DOI:10.1111/1467-9868.00235.
J. Polzehl, V. Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362. DOI:10.1007/s00440-005-0464-1.
See Also
See also paws
, lpaws
, vaws
,link{awsdata}
, aws.irreg
, aws.gaussian
Examples
require(aws)
# 1D local constant smoothing
## Not run: demo(aws_ex1)
## Not run: demo(aws_ex2)
# 2D local constant smoothing
## Not run: demo(aws_ex3)
Class "aws"
Description
The "aws"
class is
used for objects obtained by functions aws
, lpaws
, aws.irreg
and aws.gaussian
.
Objects from the Class
Objects are created by calls to functions aws
, lpaws
, aws.irreg
and aws.gaussian
.
Slots
.Data
:Object of class
"list"
, usually empty.y
:Object of class
"array"
containing the original (response) datady
:Object of class
"numeric"
dimension attribute ofy
nvec
:Object of class
"integer"
leading dimension ofy
in vector valued data.x
:Object of class
"numeric"
if provided the design pointsni
:Object of class
"numeric"
sum of weights used in final estimatemask
:Object of class
"logical"
mask of design points where computations are performedtheta
:Object of class
"array"
containes the smoothed object and in case of functionlpaws
its derivatives up to the specified degree. Dimension isdim(theta)=c(dy,p)
hseq
:Sequence of bandwidths employed.
mae
:Object of class
"numeric"
Mean absolute error with respect to array in argumentu
if provided.psnr
:Object of class
"numeric"
Peak Signal to Noise Ratio (PSNR) with respect to array in argumentu
if provided.var
:Object of class
"numeric"
pointwise variance oftheta[...,1]
xmin
:Object of class
"numeric"
min ofx
in case of irregular designxmax
:Object of class
"numeric"
max ofx
in case of irregular designwghts
:Object of class
"numeric"
weights used in location penalty for different coordinate directions, corresponds to ratios of distances in coordinate directions 2 and 3 to and distance in coordinate direction 1.degree
:Object of class
"integer"
degree of local polynomials used in functionlpaws
hmax
:Object of class
"numeric"
maximal bandwidthsigma2
:Object of class
"numeric"
estimated error variancescorr
:Object of class
"numeric"
estimated spatial correlationfamily
:Object of class
"character"
distribution ofy
, can be any ofc("Gaussian","Bernoulli","Poisson","Exponential", "Volatility","Variance")
shape
:Object of class
"numeric"
possible shape parameter of distribution ofy
lkern
:Object of class
"integer"
location kernel, can be any ofc("Triangle","Quadratic","Cubic","Plateau","Gaussian")
, defauts to"Triangle"
lambda
:Object of class
"numeric"
scale parameter used in adaptationladjust
:Object of class
"numeric"
factor to adjust scale parameter with respect to its predetermined default.aws
:Object of class
"logical"
Adaptation by Propagation-Separationmemory
:Object of class
"logical"
Adaptation by Stagewise Aggregationhomogen
:Object of class
"logical"
detect regions of homogeneity (used to speed up the calculations)earlystop
:Object of class
"logical"
further speedup in functionlpaws
estimates are fixed if sum of weigths does not increase with iterations.varmodel
:Object of class
"character"
variance model used in functionaws.gaussian
vcoef
:Object of class
"numeric"
estimates variance parameters in functionaws.gaussian
call
:Object of class
"call"
that created the object.
Methods
- extract
signature(x = "aws")
: ...- risk
signature(y = "aws")
: ...- plot
Method for Function ‘plot’ in Package ‘aws’.
- show
Method for Function ‘show’ in Package ‘aws’.
Method for Function ‘print’ in Package ‘aws’.
- summary
Method for Function ‘summary’ in Package ‘aws’.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de
References
Joerg Polzehl, Vladimir Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354
Joerg Polzehl, Vladimir Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362.
See Also
aws
, lpaws
, aws.irreg
, aws.gaussian
Examples
showClass("aws")
Adaptive weights smoothing for Gaussian data with variance depending on the mean.
Description
The function implements an semiparametric adaptive weights smoothing algorithm designed for regression with additive heteroskedastic Gaussian noise. The noise variance is assumed to depend on the value of the regression function. This dependence is modeled by a global parametric (polynomial) model.
Usage
aws.gaussian(y, hmax = NULL, hpre = NULL, aws = TRUE, memory = FALSE,
varmodel = "Constant", lkern = "Triangle",
aggkern = "Uniform", scorr = 0, mask=NULL, ladjust = 1,
wghts = NULL, u = NULL, varprop = 0.1, graph = FALSE, demo = FALSE)
Arguments
y |
|
hmax |
|
hpre |
Describe |
aws |
logical: if TRUE structural adaptation (AWS) is used. |
memory |
logical: if TRUE stagewise aggregation is used as an additional adaptation scheme. |
varmodel |
Implemented are "Constant", "Linear" and "Quadratic" refering to a polynomial model of degree 0 to 2. |
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
aggkern |
character: kernel used in stagewise aggregation, either "Triangle" or "Uniform" |
scorr |
The vector |
mask |
Restrict smoothing to points where |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
varprop |
Small variance estimates are replaced by |
graph |
If |
demo |
If |
Details
The function implements the propagation separation approach to
nonparametric smoothing (formerly introduced as Adaptive weights smoothing)
for varying coefficient likelihood models on a 1D, 2D or 3D grid.
In contrast to function aws
observations are assumed to follow a Gaussian distribution
with variance depending on the mean according to a specified global variance model.
aws==FALSE
provides the stagewise aggregation procedure from Belomestny and Spokoiny (2004).
memory==FALSE
provides Adaptive weights smoothing without control by stagewise aggregation.
The essential parameter in the procedure is a critical value lambda
. This parameter has an
interpretation as a significance level of a test for equivalence of two local
parameter estimates.
Values set internally are choosen to fulfil a propagation condition, i.e. in case of a
constant (global) parameter value and large hmax
the procedure
provides, with a high probability, the global (parametric) estimate.
More formally we require the parameter lambda
to be specified such that
\bf{E} |\hat{\theta}^k - \theta| \le (1+\alpha) \bf{E} |\tilde{\theta}^k - \theta|
where \hat{\theta}^k
is the aws-estimate in step k
and \tilde{\theta}^k
is corresponding nonadaptive estimate using the same bandwidth (lambda=Inf
).
The value of lambda can be adjusted by specifying the factor ladjust
. Values
ladjust>1
lead to an less effective adaptation while ladjust<<1
may lead
to random segmentation of, with respect to a constant model, homogeneous regions.
The numerical complexity of the procedure is mainly determined by hmax
. The number
of iterations is approximately Const*d*log(hmax)/log(1.25)
with d
being the dimension
of y
and the constant depending on the kernel lkern
. Comlexity in each
iteration step is Const*hakt*n
with hakt
being the actual bandwith
in the iteration step and n
the number of design points.
hmax
determines the maximal possible variance reduction.
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function, |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
scorr |
family = "character" |
"Gaussian" |
shape = "numeric" |
NULL |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
FALSE |
varmodel = "character" |
varmodel |
vcoef = "numeric" |
estimated parameters of the variance model |
call = "function" |
the arguments of the call to |
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
Joerg Polzehl, Vladimir Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354
Joerg Polzehl, Vladimir Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362.
Joerg Polzehl, Vladimir Spokoiny, in V. Chen, C.; Haerdle, W. and Unwin, A. (ed.) Handbook of Data Visualization Structural adaptive smoothing by propagation-separation methods Springer-Verlag, 2008, 471-492
See Also
See also aws
, link{awsdata}
, aws.irreg
Examples
require(aws)
local constant AWS for irregular (1D/2D) design
Description
The function implements the propagation separation approach to nonparametric smoothing (formerly introduced as Adaptive weights smoothing) for varying coefficient Gaussian models on a 1D or 2D irregulat design. The function allows for a paramertic (polynomial) mean-variance dependence.
Usage
aws.irreg(y, x, hmax = NULL, aws=TRUE, memory=FALSE, varmodel = "Constant",
lkern = "Triangle", aggkern = "Uniform", sigma2 = NULL, nbins = 100,
hpre = NULL, henv = NULL, ladjust =1, varprop = 0.1, graph = FALSE)
Arguments
y |
The observed response vector (length n) |
x |
Design matrix, dimension n x d, |
hmax |
|
aws |
logical: if TRUE structural adaptation (AWS) is used. |
memory |
logical: if TRUE stagewise aggregation is used as an additional adaptation scheme. |
varmodel |
determines the model that relates variance to mean. Either "Constant", "Linear" or "Quadratic". |
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian" |
aggkern |
character: kernel used in stagewise aggregation, either "Triangle" or "Uniform" |
sigma2 |
|
nbins |
numer of bins, can be NULL, a positive integer or a vector of positive integers (length d) |
hpre |
smoothing bandwidth for initial variance estimate |
henv |
radius of balls around each observed design point where estimates will be calculated |
ladjust |
factor to increase the default value of lambda |
varprop |
exclude the largest 100*varprop% squared residuals when estimating the error variance |
graph |
If |
Details
Data are first binned (1D/2D), then aws is performed on all datapoints within distance <= henv of nonempty bins.
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
x |
ni = "integer" |
number of observations per bin |
mask = "logical" |
bins where parameters have been estimated |
theta = "numeric" |
Estimates of regression function, |
mae = "numeric" |
numeric(0) |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
vector of minimal x-values (bins) |
xmax = "numeric" |
vector of maximal x-values (bins) |
wghts = "numeric" |
relative binwidths |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
0 |
family = "character" |
"Gaussian" |
shape = "numeric" |
numeric(0) |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
FALSE |
earlystop = "logical" |
FALSE |
varmodel = "character" |
varmodel |
vcoef = "numeric" |
estimated coefficients in variance model |
call = "function" |
the arguments of the call to |
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de
References
J. Polzehl, V. Spokoiny, in V. Chen, C.; Haerdle, W. and Unwin, A. (ed.) Handbook of Data Visualization Structural adaptive smoothing by propagation-separation methods. Springer-Verlag, 2008, 471-492. DOI:10.1007/978-3-540-33037-0_19.
See Also
See also lpaws
, link{awsdata}
, lpaws
Examples
require(aws)
# 1D local constant smoothing
## Not run: demo(irreg_ex1)
# 2D local constant smoothing
## Not run: demo(irreg_ex2)
Segmentation by adaptive weights for Gaussian models.
Description
The function implements a modification of the adaptive weights smoothing algorithm for segmentation into three classes. The
Usage
aws.segment(y, level, delta = 0, hmax = NULL, hpre = NULL, mask =NULL,
varmodel = "Constant", lkern = "Triangle", scorr = 0, ladjust = 1,
wghts = NULL, u = NULL, varprop = 0.1, ext = 0, graph = FALSE,
demo = FALSE, fov=NULL)
Arguments
y |
|
level |
center of second class |
delta |
half width of second class |
hmax |
|
hpre |
Describe |
mask |
optional logical mask, same dimensionality as |
varmodel |
Implemented are "Constant", "Linear" and "Quadratic" refering to a polynomial model of degree 0 to 2. |
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
scorr |
The vector |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
varprop |
Small variance estimates are replaced by |
ext |
Intermediate results are fixed if the test statistics exceeds the critical value by |
graph |
If |
demo |
If |
fov |
Field of view. Size of region (sample size) to adjust for in multiscale testing. |
Details
The image is segmented into three parts by performing multiscale tests
of the hypotheses H1
value >= level - delta
and H2 value <= level + delta
.
Pixel where the first hypotesis is rejected are classified as -1
(segment 1)
while rejection of H2 results in classification 1
(segment 3).
Pixel where neither H1 or H2 are rejected ar assigned to a value 0
(segment 2). Critical values for the tests are adjusted for smoothness at the different scales inspected in the iteration process using results from multiscale testing,
see e.g. Duembgen and Spokoiny (2001). Critical values also depend on the
size of the region of interest specified in parameter fov
.
Within segment 2 structural adaptive smoothing is performed while if a pair of pixel belongs to segment 1 or segment 3 the corresponding weight will be nonadaptive.
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
segment = "integer" |
Segmentation results, class numbers 1-3 |
theta = "numeric" |
Estimates of regression function, |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
scorr |
family = "character" |
"Gaussian" |
shape = "numeric" |
NULL |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
FALSE |
earlystop = "logical" |
FALSE |
varmodel = "character" |
varmodel |
vcoef = "numeric" |
estimated parameters of the variance model |
call = "function" |
the arguments of the call to |
Note
This function is still experimental and may be changes considerably in future.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, H.U. Voss, K. Tabelow (2010). Structural adaptive segmentation for statistical parametric mapping, NeuroImage, 52, pp. 515–523. DOI:10.1016/j.neuroimage.2010.04.241
Duembgen, L. and Spokoiny, V. (2001). Multiscale testing of qualitative hypoteses. Ann. Stat. 29, 124–152.
Polzehl, J. and Spokoiny, V. (2006). Propagation-Separation Approach for Local Likelihood Estimation. Probability Theory and Related Fields. 3 (135) 335 - 362. DOI:10.1007/s00440-005-0464-1
See Also
Examples
require(aws)
3D variance estimation
Description
Functions for 3D variance estimation. awsLocalSigma
implements the
local adaptive variance estimation procedure introduced in Tabelow, Voss and Polzehl (2015).
awslinsd
uses a parametric model for varianc/mesn dependence. Functions
AFLocalSigma
and estGlobalSigma
implement various proposals for local
and global variance estimates from Aja-Fernandez (2009, 2013) and a global variant of the
approach from Tabelow, Voss and Polzehl (2015).
Usage
awsLocalSigma(y, steps, mask, ncoils, vext = c(1, 1), lambda = 5,
minni = 2, hsig = 5, sigma = NULL, family = c("NCchi", "Gauss"),
verbose = FALSE, trace = FALSE, u = NULL)
awslinsd(y, hmax = NULL, hpre = NULL, h0 = NULL, mask = NULL,
ladjust = 1, wghts = NULL, varprop = 0.1, A0, A1)
AFLocalSigma(y, ncoils, level = NULL, mask = NULL, h = 2, hadj = 1,
vext = c(1, 1))
estGlobalSigma(y, mask = NULL, ncoils = 1, steps = 16, vext = c(1, 1),
lambda = 20, hinit = 2, hadj = 1, q = 0.25, level = NULL,
sequence = FALSE, method = c("awsVar", "awsMAD", "AFmodevn",
"AFmodem1chi", "AFbkm2chi", "AFbkm1chi"))
estimateSigmaCompl(magnitude, phase, mask, kstar = 20, kmin = 8, hsig = 5,
lambda = 12, verbose = TRUE)
Arguments
y |
3D array of image intensities. |
steps |
number of steps in adapive weights smoothing, used to reveal the unerlying mean structure. |
mask |
restrict computations to voxel in mask, if |
ncoils |
effective number of coils, or equivalently number of effective degrees of freedom of non-central chi distribution divided by 2. |
vext |
voxel extentions or relative voxel extensions |
lambda |
scale parameter in adaptive weights smoothing |
minni |
minimal bandwidth for calculating local variance estimates |
hsig |
bandwwidth for median filter |
sigma |
optional initial global variance estimate |
family |
type of distribution, either noncentral Chi ("NCchi") or Gaussian ("Gauss") |
verbose |
if |
trace |
if |
u |
if |
hmax |
maximal bandwidth |
hpre |
minimal bandwidth |
h0 |
bandwidth vector characterizing to spatial correlation as correlation induced by convolution with a Gaussian kernel |
ladjust |
correction factor for lambda |
wghts |
relative voxel extensions |
varprop |
defines a lower bound for the estimated variance as |
A0 |
select voxel with |
A1 |
select voxel with |
level |
threshold for mask definition |
h |
bandwidth for local variance estimates. |
hinit |
minimal bandwidth for local variance estimates with |
hadj |
bandwidth for mode estimation |
q |
Quantile for interquantile estimate of standard deviation |
sequence |
logical, return sequence of estimated variances for iterative methods. |
method |
determines variance estimation method |
magnitude |
magnitude of complex 3D image |
phase |
phase of complex 3D image |
kstar |
number of steps in adapive weights smoothing, used to reveal the unerlying mean structure. |
kmin |
iteration to start adaptation |
Value
all functions return lists with variance estimates in component sigma
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
References
K. Tabelow, H.U. Voss, J. Polzehl, Local estimation of the noise level in MRI using structural adaptation, Medical Image Analysis, 20 (2015), 76–86. DOI:10.1016/j.media.2014.10.008.
S. Aja-Fernandez, V. Brion, A. Tristan-Vega, Effective noise estimation and filtering from correlated multiple-coil MR data. Magn Reson Imaging, 31 (2013), 272-285. DOI:10.1016/j.mri.2012.07.006
S. Aja-Fernandez, A. Tristan-Vega, C. Alberola-Lopez, Noise estimation in single- and multiple-coil magnetic resonance data based on statistical models. Magn Reson Imaging, 27 (2009), 1397-1409. DOI:10.1016/j.mri.2009.05.025.
Extract information from an object of class aws
Description
Extract data and estimates from an object of class aws
Usage
awsdata(awsobj, what)
Arguments
awsobj |
an object of class |
what |
can be "data" (extracts observed response), "theta" (estimated parameters), "est" (estimated regression function), "var" (approx. variance of estimated regression function), "sd" (approx. standard deviation of estimated regression function), "sigma2" (error variance), "mae" (mean absolute error for each iteration step, if available), "ni" (number of observations per bin), "mask" (logical indicator for bins where the regression function is estimated). "bi" (array of sum of weights or NULL) "bi2" (array of sum of squared weights or NULL) |
Details
The returned object is formatted as an array if appropriate. The returned object may be NULL if the information is not available.
Value
an vector or array containing the specified information.
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
Joerg Polzehl, Vladimir Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354
Joerg Polzehl, Vladimir Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362.
Joerg Polzehl, Vladimir Spokoiny, in V. Chen, C.; Haerdle, W. and Unwin, A. (ed.) Handbook of Data Visualization Structural adaptive smoothing by propagation-separation methods Springer-Verlag, 2008, 471-492
See Also
Examples
require(aws)
# 1D local constant smoothing
## Not run: demo(aws_ex1)
## Not run: demo(aws_ex2)
# 2D local constant smoothing
## Not run: demo(aws_ex3)
# 1D local polynomial smoothing
## Not run: demo(lpaws_ex1)
# 2D local polynomial smoothing
## Not run: demo(lpaws_ex2)
# 1D irregular design
## Not run: demo(irreg_ex1)
# 2D irregular design
## Not run: demo(irreg_ex2)
Class "awssegment"
Description
The "aws"
class is
used for objects obtained by functions aws.segment
Objects from the Class
Objects are created by calls to functions aws.segment
Slots
.Data
:Object of class
"list"
, usually empty.y
:Object of class
"array"
containing the original (response) datady
:Object of class
"numeric"
dimension attribute ofy
x
:Object of class
"numeric"
if provided the design pointsni
:Object of class
"numeric"
sum of weights used in final estimatemask
:Object of class
"logical"
mask of design points where computations are performedsegment
:Object of class
"array"
segmentation results (3 segments coded byc(-1, 0, 1)
)level
:Object of class
"numeric"
center of segment0
delta
:Object of class
"numeric"
half width of segment0
theta
:Object of class
"array"
~~theta
:Object of class
"array"
containes the smoothed object and in case of functionlpaws
its derivatives up to the specified degree. Dimension isdim(theta)=c(dy,p)
mae
:Object of class
"numeric"
Mean absolute error with respect to array in argumentu
if provided.var
:Object of class
"numeric"
pointwise variance oftheta[...,1]
xmin
:Object of class
"numeric"
not usedxmax
:Object of class
"numeric"
not usedwghts
:Object of class
"numeric"
weights used in location penalty for different coordinate directionsdegree
:not used
hmax
:Object of class
"numeric"
maximal bandwidthsigma2
:Object of class
"numeric"
estimated error variancescorr
:Object of class
"numeric"
estimated spatial correlationfamily
:Object of class
"character"
distribution ofy
, can be any ofc("Gaussian","Bernoulli","Poisson","Exponential", "Volatility","Variance")
shape
:Object of class
"numeric"
possible shape parameter of distribution ofy
lkern
:Object of class
"integer"
location kernel, can be any ofc("Triangle","Quadratic","Cubic","Plateau","Gaussian")
, defauts to"Triangle"
lambda
:Object of class
"numeric"
scale parameter used in adaptationladjust
:Object of class
"numeric"
factor to adjust scale parameter with respect to its predetermined default.aws
:Object of class
"logical"
Adaptation by Propagation-Separationmemory
:Object of class
"logical"
Adaptation by Stagewise Aggregationhomogen
:Object of class
"logical"
detect regions of homogeneity (used to speed up the calculations) currentlyFALSE
earlystop
:Object of class
"logical"
currentlyFALSE
varmodel
:Object of class
"character"
variance model used currently"Gaussian"
vcoef
:Object of class
"numeric"
containsNULL
call
:Object of class
"call"
that created the object.
Methods
- extract
signature(x = "awssegment")
: ...- plot
signature(x = "awssegment")
: ...signature(x = "awssegment")
: ...- risk
signature(y = "awssegment")
: ...- show
signature(object = "awssegment")
: ...- summary
signature(object = "awssegment")
: ...
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de
See Also
Examples
showClass("awssegment")
Propagation condition for adaptive weights smoothing
Description
The function enables testing of the propagation condition in order to select
appropriate values for the parameter lambda
in function aws
.
Usage
awstestprop(dy, hmax, theta = 1, family = "Gaussian", lkern = "Triangle",
aws = TRUE, memory = FALSE, shape = 2, homogeneous=TRUE, varadapt=FALSE,
ladjust = 1, spmin=0.25, seed = 1, minlevel=1e-6, maxz=25, diffz=.5,
maxni=FALSE, verbose=FALSE)
pawstestprop(dy, hmax, theta = 1, family = "Gaussian", lkern = "Triangle",
aws = TRUE, patchsize=1, shape = 2,
ladjust = 1, spmin = 0.25, seed = 1, minlevel = 1e-6,
maxz = 25, diffz = .5, maxni = FALSE, verbose = FALSE)
Arguments
dy |
Dimension of grid used in 1D, 2D or 3D. May also be specified as an array of values.
In this case data are generated with parameters |
hmax |
Maximum bandwidth. |
theta |
Parameter determining the distribution in case of
|
family |
|
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian" |
aws |
logical: if TRUE structural adaptation (AWS) is used. |
patchsize |
patchsize in case of paws. |
memory |
logical: if TRUE stagewise aggregation is used as an additional adaptation scheme. |
shape |
Allows to specify an additional shape parameter for certain family models. Currently only used for family="Variance", that is |
homogeneous |
if |
varadapt |
if |
ladjust |
Factor to increase the default value of lambda |
spmin |
Determines the form (size of the plateau) in the adaptation kernel. Not to be changed by the user. |
seed |
Seed value for random generator. |
minlevel |
Minimum exceedence probability to use in contour plots. |
maxz |
Maximum of z-scale in plots. |
diffz |
Gridlength in z |
maxni |
If TRUE use |
verbose |
If TRUE provide additional information. |
Details
Estimates exceedence probabilities
Results for intermediate steps are provided as contour plots. For a good choice of lambda
(ladjust) the contours up to probabilities of 1e-5
should be vertical.
Value
A list with components
h |
Sequence of bandwidths used |
z |
|
prob |
the matrix of exceedence probabilities, columns corresponding to |
probna |
the matrix of exceedence probabilities for corresponding nonadaptive estimates, columns corresponding to |
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
S. Becker, P. Mathe, Electron. J. Statist. (2013), 2702-2736, doi:10.1214/13-EJS860
See Also
Generate weight scheme that would be used in an additional aws step
Description
Utility function to create a weighting scheme for an additional aws step. Inteded to be used for illustrations only.
Usage
awsweights(awsobj, spmin = 0.25, inx = NULL)
Arguments
awsobj |
object obtained by a call to function |
spmin |
Size of the plateau in the adaptation kernel. |
inx |
either a matrix of dimension length(awsobj@dy) x number of points containing the integer coordinates of points of interest or NULL. In the latter case the weight scheme for all points is generated. |
Value
an array of either dimension awsobj@dy x number of points or awsobj@dy x awsobj@dy
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
Joerg Polzehl, Vladimir Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354
Joerg Polzehl, Vladimir Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362.
Joerg Polzehl, Kostas Papafitsoros, Karsten Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06.
See Also
See also aws
Binning in 1D, 2D or 3D
Description
The function performs a binning in 1D, 2D or 3D.
Usage
binning(x, y, nbins, xrange = NULL)
Arguments
x |
design matrix, dimension n x d, |
y |
either a response vector of length n or NULL |
nbins |
vector of length d containing number of bins for each dimension, may be set to NULL |
xrange |
range for endpoints of bins for each dimension, either matrix
of dimension 2 x d or NULL. |
Value
A list with components
x |
matrix of coordinates of non-empty bin centers |
x.freq |
number of observations in nonempty bins |
midpoints.x1 |
Bin centers in dimension 1 |
midpoints.x2 |
if |
midpoints.x3 |
if |
breaks.x1 |
Break points dimension 1 |
breaks.x2 |
if |
breaks.x3 |
if |
table.freq |
number of observations per bin |
means |
if |
devs |
if |
Note
This function has been adapted from the code of function binning in package sm.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de
See Also
See Also as aws.irreg
Methods for Function extract
in Package aws
Description
The method extract and/or compute specified statistics from object of class
"aws"
, "awssegment"
, ICIsmooth
and "kernsm"
.
Usage
## S4 method for signature 'aws'
extract(x, what="y")
## S4 method for signature 'awssegment'
extract(x, what="y")
## S4 method for signature 'ICIsmooth'
extract(x, what="y")
## S4 method for signature 'kernsm'
extract(x, what="y")
Arguments
x |
object |
what |
Statistics to extract, defaults to |
Methods
signature(x = "ANY")
-
Returns a message that method
extract
is not defined. signature(x = "aws")
-
Returns a list with components containing the requested statistics. Component names correspond to
tolower(what)
signature(x = "awssegment")
-
Returns a list with components containing the requested statistics. Component names correspond to
tolower(what)
signature(x = "ICIsmooth")
-
Returns a list with components containing the requested statistics. Component names correspond to
tolower(what)
. signature(x = "kernsm")
-
Returns a list with components containing the requested statistics. Component names correspond to
tolower(what)
.
Kernel smoothing on a 1D, 2D or 3D grid
Description
Performs Kernel smoothing on a 1D, 2D or 3D grid by fft
Usage
kernsm(y, h = 1, kern = "Gaussian", m = 0, nsector = 1, sector = 1,
symmetric = FALSE, unit = c("SD","FWHM"))
Arguments
y |
Object of class |
h |
bandwidth |
kern |
Determines the kernel function.
Object of class |
m |
Object of class |
nsector |
number of sectors to use. Positive weights are restricted to the sector
selected by |
sector |
Object of class |
symmetric |
Object of class |
unit |
How should the bandwidth be interpreted in case of a Gaussian kernel.
For |
Details
In case of any(m>0)
derivative kernels are generated and applied for the
corresponding coordinate directions. If nsector>1
the support of the kernel
is restricted to a circular sector determined by sector
.
Value
An object of class kernsm
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06 .
V. Katkovnik, K. Egiazarian and J. Astola, Local Approximation Techniques in Signal And Image Processing, SPIE Society of Photo-Optical Instrumentation Engin., 2006, PM157
See Also
kernsm-class
, ICIsmooth
,ICIcombined
Class "kernsm"
Description
This class refers to objects created by function kernsm. These objects contain
Objects from the Class
Objects can be created by calls of the form new("kernsm", ...). they are usually
created by a call to function{kernsm}
.
Slots
.Data
:Object of class
"list"
, usually empty.y
:Object of class
"array"
containing the response in nonparametric regression. The design is assumed to be a 1D, 2D or 3D grid, with dimensionality determined bydim(y)
.dy
:Object of class
"numeric"
containing dim(y).x
:Object of class
"numeric"
currently not used.h
:Object of class
"numeric"
containing the bandwidth employed.kern
:Object of class
"character"
determining the kernel that was used, can be one ofc("Gaussian","Uniform","Triangle","Epanechnikov","Biweight","Triweight")
m
:Object of class
"integer"
with lengthlength(dy)
determining the order of derivatives in the corresponding coordinate directions. Ifm[i6>0]
a dirivative kernel derived fromkern
has been used for the corresponding coordinate direction.nsector
:Object of class
"integer"
. Ifnsector>1
positive weights are restricted to a segment of a circle (1D or 2D only). The segment is given bysector
.sector
:Object of class
"integer"
containing the number of the segment used in case ofnsector>1
symmetric
:Object of class
"logical"
determines if the sector is mirrored at the origin.yhat
:Object of class
"array"
with same size and dimension asy
providing the convolution ofy
with the chosen kernel.vred
:Object of class
"array"
Variance reduction achieved by convolution assuming independence.call
:Object of class
"function"
, call that created the object.
Methods
- extract
signature(x = "aws")
: ...- risk
signature(y = "aws")
: ...- plot
Method for Function ‘plot’ in Package ‘aws’.
- show
Method for Function ‘show’ in Package ‘aws’.
Method for Function ‘print’ in Package ‘aws’.
- summary
Method for Function ‘summary’ in Package ‘aws’.
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
See Also
kernsm
,
ICIsmooth
,
ICIcombined
,
ICIsmooth
Examples
showClass("kernsm")
Local polynomial smoothing by AWS
Description
The function allows for structural adaptive smoothing using a local polynomial (degree <=2) structural assumption. Response variables are assumed to be observed on a 1 or 2 dimensional regular grid.
Usage
lpaws(y, degree = 1, hmax = NULL, aws = TRUE, memory = FALSE, lkern = "Triangle",
homogen = TRUE, earlystop = TRUE, aggkern = "Uniform", sigma2 = NULL,
hw = NULL, ladjust = 1, u = NULL, graph = FALSE, demo = FALSE)
Arguments
y |
Response, either a vector (1D) or matrix (2D). The corresponding design is assumed to be a regular grid in 1D or 2D, respectively. |
degree |
Polynomial degree of the local model |
hmax |
maximal bandwidth |
aws |
logical: if TRUE structural adaptation (AWS) is used. |
memory |
logical: if TRUE stagewise aggregation is used as an additional adaptation scheme. |
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
homogen |
logical: if TRUE the function tries to determine regions where weights can be fixed to 1. This may increase speed. |
earlystop |
logical: if TRUE the function tries to determine points where the homogeneous region is unlikely to change in further steps. This may increase speed. |
aggkern |
character: kernel used in stagewise aggregation, either "Triangle" or "Uniform" |
sigma2 |
Error variance, the value is estimated if not provided. |
hw |
Regularisation bandwidth, used to prevent from unidentifiability of local estimates for small bandwidths. |
ladjust |
factor to increase the default value of lambda |
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
graph |
logical: If TRUE intermediate results are illustrated graphically. May significantly slow down the computations in 2D. Please
avoid using the default |
demo |
logical: if TRUE wait after each iteration |
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function and derivatives, |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
degree |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
0 |
family = "character" |
"Gaussian" |
shape = "numeric" |
numeric(0) |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
eralustop |
varmodel = "character" |
"Constant" |
vcoef = "numeric" |
numeric(0) |
call = "function" |
the arguments of the call to |
Note
If you specify graph=TRUE
for 2D problems
avoid using the default X11()
on systems build with cairo
, use
X11(type="Xlib")
instead (faster by a factor of 30).
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06 .
J. Polzehl, V. Spokoiny, in V. Chen, C.; Haerdle, W. and Unwin, A. (ed.) Handbook of Data Visualization Structural adaptive smoothing by propagation-separation methods. Springer-Verlag, 2008, 471-492. DOI:10.1007/978-3-540-33037-0_19.
See Also
Examples
library(aws)
# 1D local polynomial smoothing
## Not run: demo(lpaws_ex1)
# 2D local polynomial smoothing
## Not run: demo(lpaws_ex2)
NLMeans filter in 1D/2D/3D
Description
Implements the Non-Local-Means Filter of Buades et al 2005
Usage
nlmeans(x, lambda, sigma, patchhw = 1, searchhw = 7, pd = NULL)
Arguments
x |
1, 2 or 3-dimensional array of obseved response (image intensity) data. |
lambda |
scale factor for kernel in image space. |
sigma |
error standard deviation (for additive Gaussian errors). |
patchhw |
Half width of patches in each dimension (patchsize is |
searchhw |
Half width of search area (size of search area is |
pd |
If |
Details
The implementation follows the description of the Non-Local-Means Filter of Buades et al 2005 on http://www.numerical-tours.com/matlab/denoisingadv_6_nl_means/#biblio that incorporates dimension reduction for patch comparisons by PCA.
Value
A list of class "nlmeans"
with components
theta |
Denoised array |
lambda |
Scale parameter used |
sigma |
The error standard deviation |
patchhw |
Half width of patches |
pd |
Effective patchsize used |
searchhw |
Half width of search area |
Note
use setCores='number of threads'
to enable parallel execution.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06 .
A. Buades, B. Coll and J. M. Morel (2006). A review of image denoising algorithms, with a new one. Simulation, 4, 490-530. DOI:10.1137/040616024.
http://www.numerical-tours.com/matlab/denoisingadv_6_nl_means/#biblio
Adaptive weigths smoothing using patches
Description
The function implements a version the propagation separation approach that
uses patches instead of individuel voxels for comparisons in parameter space. Functionality is analog to function aws
. Using patches allows for an improved
handling of locally smooth functions and in 2D and 3D for improved smoothness of
discontinuities at the expense of increased computing time.
Usage
paws(y, hmax = NULL, mask=NULL, onestep = FALSE, aws = TRUE, family = "Gaussian",
lkern = "Triangle", aggkern = "Uniform", sigma2 = NULL, shape = NULL,
scorr = 0, spmin = 0.25, ladjust = 1, wghts = NULL, u = NULL,
graph = FALSE, demo = FALSE, patchsize = 1)
Arguments
y |
array |
mask |
logical array defining a mask. All computations are restricted to the mask. |
hmax |
|
onestep |
apply the last step only (use for test purposes only) |
aws |
logical: if TRUE structural adaptation (AWS) is used. |
family |
|
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
aggkern |
character: kernel used in stagewise aggregation, either "Triangle" or "Uniform" |
sigma2 |
|
shape |
Allows to specify an additional shape parameter for certain family models. Currently only used for family="Variance", that is |
scorr |
The vector |
spmin |
Determines the form (size of the plateau) in the adaptation kernel. Not to be changed by the user. |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
graph |
If |
demo |
If |
patchsize |
positive integer defining the size of patches. Number of grid points within the patch is |
Details
see aws. The procedure is supposed to produce superior results if the assumption of a local constant image is violated or if smooothness of discontinuities is desired.
Value
returns an object of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function, |
hseq = "numeric" |
sequence of bandwidths employed |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
psnr = "numeric" |
Peak signal-to-noise ratio for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
scorr |
family = "character" |
family |
shape = "numeric" |
shape |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
FALSE |
varmodel = "character" |
"Constant" |
vcoef = "numeric" |
numeric(0) |
call = "function" |
the arguments of the call to |
Note
use setCores='number of threads'
to enable parallel execution.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Appendix A. Doi:10.1007/978-3-030-29184-6.
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06 .
See Also
See also aws
, lpaws
, vpaws
,link{awsdata}
Examples
## Not run:
setCores(2)
y <- array(rnorm(64^3),c(64,64,64))
yhat <- paws(y,hmax=6)
## End(Not run)
Methods for Function ‘plot’ from package 'graphics' in Package ‘aws’
Description
Visualization of objects of class "aws"
, "awsswgment"
,
"kernsm"
and "ICIsmooth"
Methods
signature(x = "ANY")
-
Generic function: see
plot
. signature(x = "aws")
-
Visualization of objects of class
"aws"
signature(x = "awssegment")
-
Visualization of objects of class
"awssegment"
signature(x = "ICIsmooth")
-
Visualization of objects of class
"ICIsmooth"
signature(x = "kernsm")
-
Visualization of objects of class
"kernsm"
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
See Also
aws
,
awssegment
,
ICIsmooth
kernsm
Methods for Function ‘print’ from package 'base' in Package ‘aws’
Description
The function provides information on data dimensions, creation of the object and
existing slot-names for objects of class "aws"
, "awssegment"
,
"ICIsmooth"
and "kernsm"
Methods
signature(x = "ANY")
-
Generic function: see
print
. signature(x = "aws")
-
Provide information on data dimensions, creation of the object and existing slot-names for objects of class
"aws"
signature(x = "awssegment")
-
Provide information on data dimensions, creation of the object and existing slot-names for objects of class
"awssegment"
signature(x = "ICIsmooth")
-
Provide information on data dimensions, creation of the object and existing slot-names for objects of class
"ICIsmooth"
signature(x = "kernsm")
-
Provide information on data dimensions, creation of the object and existing slot-names for objects of class
"kernsm"
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
See Also
aws
,
awssegment
,
ICIsmooth
kernsm
Quality assessment for image reconstructions.
Description
Computes selected criteria for quality assessments of
Usage
qmeasures(img, ref,
which = c("PSNR", "MAE", "MSE", "RMSE", "SSIM", "MAGE", "RMSGE"),
mask = FALSE)
Arguments
img |
2D/3D image, object of class |
ref |
Reference image (array, matrix or vector) for comparison. |
which |
Criterion to use for Quality assessment. Please specify a subset of
|
mask |
Logical of same dimension as img/ref. Calculation can be restricted to mask. |
Details
Calculates specified quality indices.
Value
A vector with names as specified in which
.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
Compute risks characterizing the quality of smoothing results
Description
Methods function risk
in package aws. For an given array u
the following statistics are computed :
Root Mean Squared Error RMSE <- sqrt(mean((y-u)^2))
,
Signal to Noise Ratio SNR <- 10*log(mean(u^2)/MSE,10)
,
Peak Signal to Noise Ratio PSNR <- 10*log(max(u^2)/MSE,10)
,
Mean Absolute Error MAE <- mean(abs(y-u))
,
Maximal Absolute Error MaxAE <- max(abs(y-u))
,
Universal Image Quality Index (UIQI) (Wang and Bovik (2002)).
Usage
## S4 method for signature 'array'
risk(y, u=0)
## S4 method for signature 'aws'
risk(y, u=0)
## S4 method for signature 'awssegment'
risk(y, u=0)
## S4 method for signature 'ICIsmooth'
risk(y, u=0)
## S4 method for signature 'kernsm'
risk(y, u=0)
## S4 method for signature 'numeric'
risk(y, u=0)
Arguments
y |
object |
u |
array of dimension |
Methods
signature(y = "ANY")
-
The method extract and/or compute specified statistics from object of class
signature(y = "array")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
signature(y = "aws")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
signature(y = "awssegment")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
signature(y = "ICIsmooth")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
signature(y = "kernsm")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
signature(y = "numeric")
-
Returns a list with components
RMSE, SNR, PSNR, MAE, MaxAE, UIQI
Author(s)
Joerg Polzehl polzehl@wias-berlin.de
References
V. Katkovnik, K. Egiazarian and J. Astola, Local Approximation Techniques in Signal And Image Processing, SPIE Society of Photo-Optical Instrumentation Engin., 2006, PM157
Z. Wang and A. C. Bovik, A universal image quality index, IEEE Signal Processing Letters, vol. 9, N3, pp. 81-84, 2002.
Methods for Function ‘show’ in Package ‘aws’
Description
The function provides information on data dimensions, data source and
existing slot-names for objects of class "aws"
, "awssegment"
,
"ICIsmooth"
and "kernsm"
in package aws
Methods
signature(object = "ANY")
-
Generic function.
signature(object = "aws")
-
Provide information on data dimensions, data source and existing slot-names for objects of class
"dti"
and classes that extent"aws"
. signature(object = "awssegment")
-
Provide information on data dimensions, data source and existing slot-names for objects of class
"dti"
and classes that extent"awssegment"
. signature(object = "ICIsmooth")
-
Provide information on data dimensions, data source and existing slot-names for objects of class
"dti"
and classes that extent"ICIsmooth"
. signature(object = "kernsm")
-
Provide information on data dimensions, data source and existing slot-names for objects of class
"dti"
and classes that extent"kernsm"
.
Author(s)
Karsten Tabelow tabelow@wias-berlin.de
J\"org Polzehl polzehl@wias-berlin.de
See Also
aws
,
awssegment
,
ICIsmooth
kernsm
Auxiliary 3D smoothing routines
Description
smooth3D
and medianFilter3D
are auxiliary functions for non-adaptive
smoothing of 3D image data using kernel or median smoothing. Both function restrict
to sub-areas determined by a mask. The functions are used in packages dti
and
qMRI
.
Functions aws3Dmask
and aws3Dmaskfull
perform adaptive weights smoothing on
statistical parametric maps in fMRI. Variability of results is determined from smoothed
(using the same weighting schemes) residuals in order to correctly account for spatial
correlation. These functions are intended to be used internally in package fmri
.
They have been moved here because they share significant parts of the
openMP parallelized Fortran code underlying function aws
.
Usage
smooth3D(y, h, mask, lkern = "Gaussian", weighted = FALSE, sigma2 = NULL,
wghts = NULL)
medianFilter3D(y, h = 10, mask = NULL)
aws3Dmask(y, mask, lambda, hmax, res = NULL, sigma2 = NULL, lkern = "Gaussian",
skern = "Plateau", weighted = TRUE, u = NULL, wghts = NULL,
h0 = c(0, 0, 0), testprop = FALSE)
aws3Dmaskfull(y, mask, lambda, hmax, res = NULL, sigma2 = NULL, lkern = "Gaussian",
skern = "Plateau", weighted = TRUE, u = NULL, wghts = NULL,
testprop = FALSE)
Arguments
y |
3D array of data in case of functions |
lkern |
character: location kernel, either "Triangle", "Plateau", "Quadratic", "Cubic" or "Gaussian". The default "Triangle" is equivalent to using an Epanechnikov kernel, "Quadratic" and "Cubic" refer to a Bi-weight and Tri-weight kernel, see Fan and Gijbels (1996). "Gaussian" is a truncated (compact support) Gaussian kernel. This is included for comparisons only and should be avoided due to its large computational costs. |
weighted |
logical: use inverse variances as weights. |
sigma2 |
|
mask |
optional logical mask, same dimensionality as |
h |
bandwidth to use. In case of |
wghts |
voxel dimensions. Defaults to |
lambda |
kritical scale parameter in hypothesis testing (adaptive weights smoothing) |
hmax |
maximum bandwidth for adaptive weights smoothing |
res |
array of residuals with dimension |
skern |
|
u |
For test purposes in simulations: noisless 3D data. |
h0 |
Vector of 3 bandwidths corresponding to a Gaussian kernel that would produce a comparable spatial correlation by convoluting iid data. |
testprop |
logical: test the validity of a propagation condition for the specified value of |
Value
Functions smooth3D
and medianFilter3D
return a 3D array.
Functions awsmask*
return a list with smoothed values of y
in
component theta
and smoothed residuals in component res
.
Note
Functions awsmask*
are used intenally in package fmri
. They refer to the
situation, typical for fMRI, where the data are spatially correlated and this correlation
can be accessed using residuals with respect to a model.
Author(s)
Joerg Polzehl polzehl@wias-berlin.de, Karsten Tabelow tabelow@wias-berlin.de
Adaptive smoothing in orientation space SE(3)
Description
The functions perform adaptive weights smoothing for data in orientation space SE(3),
e.g. diffusion weighted MR data,
with spatial coordinates given by voxel location within a mask and spherical information given
by gradient direction. Observations can belong to different shells characterized by b-value bv
.
The data provided should only refer to voxel within mask.
Usage
smse3ms(sb, s0, bv, grad, kstar, lambda, kappa0, mask, sigma,
ns0 = 1, ws0 = 1, vext = NULL, ncoils = 1, verbose = FALSE, usemaxni = TRUE)
smse3(sb, s0, bv, grad, mask, sigma, kstar, lambda, kappa0,
ns0 = 1, vext = NULL, vred = 4, ncoils = 1, model = 0, dist = 1,
verbose = FALSE)
Arguments
sb |
2D array of diffion weighted data, first dimension refers to index ov voxel within the mask, second dimension to the number diffusion weighted images. |
s0 |
vector of length |
bv |
vector of b-values. |
grad |
matrix of gradient directions with |
kstar |
number of steps in adaptive weights smoothing. |
lambda |
Scale parameter in adaptation |
kappa0 |
determines amount of smoothing on the sphere. Larger values correspond to stronger smoothing
on the sphere. If |
mask |
3D image defining a mask (logical) |
sigma |
Error standard deviation. Assumed to be known and homogeneous in the current implementation.
A reasonable estimate may be defined
as the modal value of standard deviations obtained using method |
ns0 |
Actual number of non-diffusion-weigthed images used to obtain |
ws0 |
Weight for non-diffusion-weigthed images in statistical penalty. |
vext |
Voxel extensions. |
ncoils |
Effective number of receiver coils (in case of e.g. GRAPPA reconstructions),
should be 1 in case of SENSE reconstructions. |
verbose |
If |
usemaxni |
If |
vred |
Used if |
model |
Determines which quantities are smoothed. Possible values are
|
dist |
Distance in SE3. Reasonable values are 1 (default, see Becker et.al. 2012), 2 ( a slight modification of 1: with k6^2 instead of abs(k6)) and 3 (using a 'naive' distance on the sphere) |
Value
The functions return lists with main results in components
th
and th0
containing the smoothed data.
Note
These functions are intended to be used internally in package dti
only.
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
References
Joerg Polzehl, Karsten Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Doi:10.1007/978-3-030-29184-6.
S. Becker, K. Tabelow, H.U. Voss, A. Anwander, R. Heidemann, J. Polzehl. Position-orientation adaptive smoothing of diffusion weighted magnetic resonance data (POAS). Medical Image Analysis, 2012, 16, 1142-1155. DOI:10.1016/j.media.2012.05.007.
S. Becker, K. Tabelow, S. Mohammadi, N. Weiskopf, J. Polzehl. Adaptive smoothing of multi-shell diffusion-weighted magnetic resonance data by msPOAS. Neuroimage, 2014, 95, 90-105. DOI:10.1016/j.neuroimage.2014.03.053.
Methods for Function ‘summary’ from package 'base' in Package ‘aws’
Description
The method provides summary information for objects of class "aws"
.
Arguments
object |
Object of class |
... |
Additional arguments in |
Methods
signature(object = "ANY")
-
Generic function: see
summary
. signature(object = "aws")
-
The function provides summary information for objects of class
"aws"
signature(object = "awssegment")
-
The function provides summary information for objects of class
"awssegment"
signature(object = "ICIsmooth")
-
The function provides summary information for objects of class
"ICIsmooth"
signature(object = "kernsm")
-
The function provides summary information for objects of class
"kernsm"
Author(s)
J\"org Polzehl polzehl@wias-berlin.de
See Also
aws
,
awssegment
,
ICIsmooth
kernsm
vector valued version of function aws
The function implements the propagation separation approach to
nonparametric smoothing (formerly introduced as Adaptive weights smoothing)
for varying coefficient likelihood models with vector valued response on a 1D, 2D or 3D grid.
Description
The function implements a version the propagation separation approach that uses vector valued instead of scalar responses.
Usage
vaws(y, kstar = 16, sigma2 = 1, mask = NULL, scorr = 0, spmin = 0.25,
ladjust = 1, wghts = NULL, u = NULL, maxni = FALSE)
vawscov(y, kstar = 16, invcov = NULL, mask = NULL, scorr = 0, spmin = 0.25,
ladjust = 1, wghts = NULL, u = NULL, maxni = FALSE)
Arguments
y |
|
kstar |
maximal number of steps to employ. Determines maximal bandwidth. |
sigma2 |
specifies a homogeneous error variance. |
invcov |
array of voxelwise inverse covariance matrixes, first index corresponds to upper diagonal inverse covariance matrix. |
mask |
logical mask. All computations are restrikted to design poins within the mask. |
scorr |
The vector |
spmin |
determines the form (size of the plateau) in the adaptation kernel. Not to be changed by the user. |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
maxni |
If TRUE use |
Details
see aws
. Expets vector valued responses. Currently only implements the case of additive Gaussian errors.
Value
returns anobject of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function, |
hseq = "numeric" |
sequence of bandwidths employed |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
psnr = "numeric" |
Peak signal-to-noise ratio for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights. |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated (inverse) error variance |
scorr = "numeric" |
scorr |
family = "character" |
family |
shape = "numeric" |
shape |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
FALSE |
varmodel = "character" |
"Constant" |
vcoef = "numeric" |
numeric(0) |
call = "function" |
the arguments of the call to |
Note
use setCores='number of threads'
to enable parallel execution.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Appendix A. Doi:10.1007/978-3-030-29184-6.
J. Polzehl, V. Spokoiny, Adaptive Weights Smoothing with applications to image restoration, J. R. Stat. Soc. Ser. B Stat. Methodol. 62 , (2000) , pp. 335–354. DOI:10.1111/1467-9868.00235.
J. Polzehl, V. Spokoiny, Propagation-separation approach for local likelihood estimation, Probab. Theory Related Fields 135 (3), (2006) , pp. 335–362. DOI:10.1007/s00440-005-0464-1.
See Also
See also aws
, vpaws
,link{awsdata}
Examples
## Not run:
setCores(2)
y <- array(rnorm(4*64^3),c(4,64,64,64))
yhat <- vaws(y,kstar=20)
## End(Not run)
vector valued version of function paws
with homogeneous covariance structure
Description
The function implements a vector-valued version the propagation separation approach that
uses patches instead of individuel voxels for comparisons in parameter space. Functionality is analog to function vaws
. Using patches allows for an improved
handling of locally smooth functions and in 2D and 3D for improved smoothness of
discontinuities at the expense of increased computing time.
Usage
vpaws(y, kstar = 16, sigma2 = 1, invcov = NULL, mask = NULL, scorr = 0, spmin = 0.25,
ladjust = 1, wghts = NULL, u = NULL, patchsize = 1)
vpawscov(y, kstar = 16, invcov = NULL, mask = NULL, scorr = 0, spmin = 0.25, ladjust = 1,
wghts = NULL, maxni = FALSE, patchsize = 1)
vpawscov2(y, kstar = 16, invcov = NULL, mask = NULL, scorr = 0, spmin = 0.25,
lambda = NULL, ladjust = 1, wghts = NULL, patchsize = 1,
data = NULL, verbose = TRUE)
Arguments
y |
|
kstar |
maximal number of steps to employ. Determines maximal bandwidth. |
sigma2 |
specifies a homogeneous error variance. |
invcov |
array (or matrix) of voxelwise inverse covariance matrixes, first index corresponds to upper diagonal inverse covariance matrix. |
mask |
logical mask. All computations are restrikted to design poins within the mask. |
scorr |
The vector |
spmin |
determines the form (size of the plateau) in the adaptation kernel. Not to be changed by the user. |
ladjust |
factor to increase the default value of lambda |
wghts |
|
u |
a "true" value of the regression function, may be provided to
report risks at each iteration. This can be used to test the propagation condition with |
patchsize |
positive integer defining the size of patches. Number of grid points within the patch is |
maxni |
require growing sum of weights |
lambda |
explicit value of lambda |
data |
optional vector-valued images to be smoothed using the weighting scheme of the last step |
verbose |
logical: provide information on progress. |
Details
see vaws
.
Parameter y
The procedure is supposed to produce superior results if the assumption of a
local constant image is violated or if smooothness of discontinuities is desired.
Function vpawscov2
is intended for internal use in package qMRI
only.
Value
function vpaws
returns
returns an object of class aws
with slots
y = "numeric" |
y |
dy = "numeric" |
dim(y) |
x = "numeric" |
numeric(0) |
ni = "integer" |
integer(0) |
mask = "logical" |
logical(0) |
theta = "numeric" |
Estimates of regression function, |
hseq = "numeric" |
sequence of bandwidths employed |
mae = "numeric" |
Mean absolute error for each iteration step if u was specified, numeric(0) else |
psnr = "numeric" |
Peak signal-to-noise ratio for each iteration step if u was specified, numeric(0) else |
var = "numeric" |
approx. variance of the estimates of the regression function. Please note that this does not reflect variability due to randomness of weights.Currently also uses factor |
xmin = "numeric" |
numeric(0) |
xmax = "numeric" |
numeric(0) |
wghts = "numeric" |
numeric(0), ratio of distances |
degree = "integer" |
0 |
hmax = "numeric" |
effective hmax |
sigma2 = "numeric" |
provided or estimated error variance |
scorr = "numeric" |
scorr |
family = "character" |
family |
shape = "numeric" |
shape |
lkern = "integer" |
integer code for lkern, 1="Plateau", 2="Triangle", 3="Quadratic", 4="Cubic", 5="Gaussian" |
lambda = "numeric" |
effective value of lambda |
ladjust = "numeric" |
effective value of ladjust |
aws = "logical" |
aws |
memory = "logical" |
memory |
homogen = "logical" |
homogen |
earlystop = "logical" |
FALSE |
varmodel = "character" |
"Constant" |
vcoef = "numeric" |
numeric(0) |
call = "function" |
the arguments of the call to |
If y
contained only information (condensed data) for positions within a mask, then the returned object only contains
results for these positions.
Note
use setCores='number of threads'
to enable parallel execution.
Author(s)
Joerg Polzehl, polzehl@wias-berlin.de, https://www.wias-berlin.de/people/polzehl/
References
J. Polzehl, K. Tabelow (2019). Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R. Springer, Use R! series. Appendix A. Doi:10.1007/978-3-030-29184-6.
J. Polzehl, K. Papafitsoros, K. Tabelow (2020). Patch-Wise Adaptive Weights Smoothing in R, Journal of Statistical Software, 95(6), 1-27. doi:10.18637/jss.v095.i06 .
See Also
See also vaws
, lpaws
, vawscov
,link{awsdata}
Examples
## Not run:
setCores(2)
y <- array(rnorm(4*64^3),c(4,64,64,64))
yhat <- vpaws(y,kstar=20)
## End(Not run)