View source: R/contagpixelgrid.R
contagpixelgrid | R Documentation |
Function for calculating the classic pixel-adjacency contagion landscape metric from a binary map (O'Neill, 1988).
contagpixelgrid(xi, obswin, normalise = FALSE)
adjacency(xi, obswin = NULL)
xi |
A raster binary map (as an |
obswin |
If |
normalise |
If |
The unnormalised contagion landscape metric of categorical map is defined as
\sum_i \sum_j Qij ln(Qij),
where Qij
is the probability of
randomly selected adjacent pixels being in class i
and class j
respectively, and m
is the number of classes.
Here m = 2
as xi
is a binary map and we have defined 'adjacent'
pixels using the 4-neighbourhood regime.
Contagion is calculated from an adjacency matrix created using the function adjacency
.
The adjacency matrix is a 2 by 2 table containing the number of pairs of neighbouring pixels (where order matters) such that:
Second pixel in xi | Second pixel not in xi |
|
First pixel in xi | - | - |
First pixel not in xi | - | - |
The computed pixel-adjacency contagion value. If normalise
is TRUE
then the value will be between 0 and 1. Otherwise the value will be negative.
contagpixelgrid()
: Pixel-adjacency contagion landscape metric of a binary map.
adjacency()
: Calculates the adjacency matrix used in the pixel contagion
Will fail if map is either all foreground or all background.
O'Neill, R.V., Krummel, J.R., Gardner, R.H., Sugihara, G., Jackson, B., DeAngelis, D.L., et al. (1988) Indices of landscape pattern. Landscape Ecology, 1, 153-162.
xi <- heather$coarse
obswin <- owin(xrange = c(0,7),yrange=c(0,16))
adjmat <- adjacency(xi,obswin)
pixeladjcontagion <- contagpixelgrid(xi,obswin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.