rthinclumps: Random Thinning of Clumps

View source: R/randomsets.R

rthinclumpsR Documentation

Random Thinning of Clumps

Description

Finds the topologically-connected clumps of a spatial region and randomly deletes some of the clumps.

Usage

rthinclumps(W, p, ...)

Arguments

W

Window (object of class "owin" or pixel image (object of class "im").

p

Probability of retaining each clump. A single number between 0 and 1.

...

Additional arguments passed to connected.im or connected.owin to determine the connected clumps.

Details

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.

Value

Window (object of class "owin").

Author(s)

\adrian

.

See Also

rthin for thinning other kinds of objects.

Examples

  A <- (distmap(cells) < 0.06)
  opa <- par(mfrow=c(1,2))
  plot(A)
  plot(rthinclumps(A, 0.5))
  par(opa)

spatstat.random documentation built on Sept. 30, 2024, 9:46 a.m.