pixellate.psp {spatstat} | R Documentation |
Converts a line segment pattern to a pixel image by measuring the length of lines intersecting each pixel.
## S3 method for class 'psp' pixellate(x, W=NULL, ..., weights = NULL)
x |
Line segment pattern (object of class |
W |
Optional window (object of class |
... |
Optional arguments passed to |
weights |
Optional vector of weights associated with each line segment. |
This function converts a line segment pattern to a pixel image by computing, for each pixel, the total length of intersection between the pixel and the line segments.
This is a method for the generic function
pixellate
for the class of line segment patterns.
The pixel raster is determined by W
and the optional arguments ...
.
If W
is missing or NULL
, it defaults to the window
containing x
.
Then W
is converted to a
binary pixel mask using as.mask
. The arguments
...
are passed to as.mask
to
control the pixel resolution.
If weights
are given, then the length of the intersection
between line segment i
and pixel j
is multiplied by
weights[i]
before the lengths are summed for each pixel.
A pixel image (object of class "im"
) with numeric values.
Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz
pixellate
,
as.mask
,
as.mask.psp
.
Use as.mask.psp
if you only want to know
which pixels are intersected by lines.
X <- psp(runif(10),runif(10), runif(10), runif(10), window=owin()) plot(pixellate(X)) plot(X, add=TRUE) sum(lengths.psp(X)) sum(pixellate(X))