segment {adimpro}R Documentation

Segmentation by AWS

Description

The function allows to segment an image into two or three level sets.

Usage

segment(object, level=0.5, delta = 0, thresh = 3, ext = 1, fov = NULL, channel = 0, hmax = 4, aws = TRUE, varmodel = NULL, ladjust = 1.25, xind = NULL, yind = NULL, wghts = c(0.299, 0.587, 0.114, 0), scorr = TRUE, lkern = "Triangle", plateau = NULL, homogen = TRUE, earlystop = TRUE, demo = FALSE, select = FALSE, sext = 1.4, connected = FALSE, graph = FALSE, max.pixel = 400, compress = TRUE)

Arguments

object Image object, class "adimpro", as from read.image, read.raw, or make.image.
level center of gray/color-values of the second segment, will not be used if select=TRUE. May be specified such that either level-delta and level+delta are within the interval (0,1) or such that they are within the interval (0,65535) (2 Byte integers).
delta half width of gray/color-values of the second segment, nay be increased if select=TRUE. May be specified such that either level-delta and level+delta are within the interval (0,1) or such that they are within the interval (0,65535) (2 Byte integers).
thresh Critical value for final assignment to segment 1 or 3 , should be specified as a quantile of the standard Gaussian distribution.
ext factor for critical value for temporal assignment to segment 1 or 3, should be specified as a quantile of the standard Gaussian distribution.
fov size of field of view in pixel
channel specifies which information to use for segmentation. 0: use grey valued image obtained from color images, 1-3: use the specified color channel.
hmax Maximum bandwidth to use in the iteration procedure.
aws (logical). If TRUE the propagation - separation (PS) approach from Polzehl and Spokoiny (2006) is used. aws=FALSE turns off the statistical penalty resulting in a nonadaptive kernel estimate using a kernel with bandwidth hmax.
varmodel varmodel specifies how variances are to be estimated. This can be a homogeneous variance estimate (varmodel="None") assuming uncorrelated errors (both spatial and between channels). Alternatives are an adaptive homogeneous or linear (function of the mean) variance estimate that depends on estimated correlations and on residuals from the last iteration step. The default varmodel=NULL corresponds to varmodel == "Linear" if img$gamma==FALSE and varmodel == "Constant" otherwise.
ladjust adjustment factor for lambda (>=1). Default values for lambda are selected for Gaussian distributions. Skewed or heavy tailed distributions may require slightly larger values for lambda to meet the propagation condition. ladjust allows to increase lambda in such situations.
xind, yind Restrict smoothing to rectangular area defined by pixel indices xind,yind in x- and y-direction. Full range if NULL (default).
wghts allows to weight the information from different (up to 4) color channels. The weights are used in the statistical penalty of the PS-procedure.
scorr (logical). Specifies whether spatial correlation is to be estimated. Defaults to TRUE. Is set to FALSE if mask is not NULL.
lkern Specifies the location kernel. Defaults to "Triangle", other choices are "Quadratic", "Cubic" and "Uniform". The use of "Triangle" corresponds to the Epanechnicov kernel nonparametric kernel regression.
plateau Extension of the plateau in the statistical kernel. Can take values from (0,1), defaults to 0.25.
homogen If TRUE the algorithm determines, in each design point i, a circle of maximum radius, such that the statistical penalty s_{ij} for all points j within the circle is less than the value specified in plateau. In subsequent iteration steps the statistical penalty for such points is set to zero. This is only used if plateau>0. This results in more stable intermediate estimates and in a smoother reconstruction. homogen=TRUE leads to increased memory requirements.
earlystop If TRUE the algorithm determines, in each design point i, a circle of minimal radius, such that the circle includes all point j with positive weights w_{ij}. if this radius is considerably smaller than the actual bandwidth then the estimate in point i is fixed. This should considarably reduce computing time in case of large hmax.earlystop=TRUE slightly increases memory requirements.
demo (logical). If demo=TRUE the function pauses after each iteration. Defaults to FALSE.
select if TRUE a homogeneous rectangular region can be specified interactively. A value of level is the generated as the median of values within the selected region.
sext if select==TRUE the value of delta is increased by sext times the standard deviation (estimated by IQR) of the values in the selected region.
connected if TRUE the set of pixel within the same segment connected to the specified pixel is extracted.
graph (logical). If graph=TRUE intermediate results are illustrated after each iteration step. Defaults to FALSE.
max.pixel Maximum dimension of images for display if graph=TRUE. If the true dimension is larger, the images are downscaled for display. See also show.image.
compress logical, determines if image data are stored in raw-format.

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.

If connected==TRUE pixel in segment 2 0 are reassigned to a value 2 if they belong to a maximal connected subset of segment2 that contains the center of the specified homogeneous set.

Value

Object of class "adimpro" with

img containing a greyvalued image with 3 or 4 levels corresponding to the identified segments.
hsegm containing the maximal bandwidth used
level the value of parameter level used
delta the value of parameter delta used
ext the value of parameter ext used
thresh the value of parameter thresh used

Note

This function is still experimental and may be changes considerably in future.

Author(s)

Karsten Tabelow tabelow@wias-berlin.de and Joerg Polzehl polzehl@wias-berlin.de

References

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.

See Also

read.image, read.raw, make.image, show.image, clip.image

Examples

## Not run: demo(segment)

[Package adimpro version 0.7.1 Index]