bdist.pixels {spatstat} | R Documentation |
Computes the distances from each pixel in a window to the boundary of the window.
bdist.pixels(w, ..., style="image")
w |
A window (object of class |
... |
Arguments passed to |
style |
Character string determining the format of
the output: either |
This function computes, for each pixel u
in the window w
, the shortest distance
dist(u, W') from u
to the boundary of W.
If the window is not of type "mask"
then it is first
converted to that type. The arguments "\dots"
are
passed to as.mask
to determine the pixel resolution.
If style="image"
, a pixel image (object of class "im"
)
containing the distances from each pixel in the image raster
to the boundary of the window.
If style="matrix"
,
a matrix giving the distances from each pixel in the image raster
to the boundary of the window. Rows of this matrix correspond to
the y coordinate and columns to the x coordinate.
If style="coords"
, a list with three components
x,y,z
, where x,y
are vectors of length m,n
giving the x and y coordinates respectively,
and z
is an m x n matrix such that
z[i,j]
is the distance from (x[i],y[j])
to the
boundary of the window. Rows of this matrix correspond to the
x coordinate and columns to the y coordinate.
This result can be plotted with persp
, image
or contour
.
Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz
owin.object
,
erosion
,
bdist.points
,
bdist.tiles
.
u <- owin(c(0,1),c(0,1)) d <- bdist.pixels(u, eps=0.01) image(d) d <- bdist.pixels(u, eps=0.01, style="matrix") mean(d >= 0.1) # value is approx (1 - 2 * 0.1)^2 = 0.64