rthinclumps | R Documentation |
Finds the topologically-connected clumps of a spatial region and randomly deletes some of the clumps.
rthinclumps(W, p, ...)
W |
Window (object of class |
p |
Probability of retaining each clump. A single number between 0 and 1. |
... |
Additional arguments passed to |
The argument W
specifies a region of space, typically
consisting of several clumps that are not connected to each other.
The algorithm randomly deletes or retains each clump. The fate of
each clump is independent of other clumps.
If W
is a spatial window (class "owin"
) then
it will be divided into clumps using
connected.owin
. Each clump will either be
retained (with probability p
) or deleted in its entirety
(with probability 1-p
).
If W
is a pixel image (class "im"
) then its domain
will be divided into clumps using connected.im
. The default
behaviour depends on the type of pixel values. If the pixel values are
logical, then the spatial region will be taken to consist of all
pixels whose value is TRUE
. Otherwise, the spatial region is
taken to consist of all pixels whose value is defined (i.e. not equal
to NA
). This behaviour can be changed using the argument
background
passed to connected.im
.
The result is a window comprising all the clumps that were retained.
Window (object of class "owin"
).
.
rthin
for thinning other kinds of objects.
A <- (distmap(cells) < 0.06)
opa <- par(mfrow=c(1,2))
plot(A)
plot(rthinclumps(A, 0.5))
par(opa)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.