Learn R Programming

lacunaritycovariance (version 1.1-7)

contagpixelgrid: Pixel Adjacency Contagion

Description

Function for calculating the classic pixel-adjacency contagion landscape metric from a binary map (O'Neill, 1988).

Usage

contagpixelgrid(xi, obswin, normalise = FALSE)

adjacency(xi, obswin = NULL)

Value

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.

Arguments

xi

A raster binary map (as an im object) or as a foreground set (as an owin object). In the latter case the observation window, obswin, must be supplied. See lacunaritycovariance-package for details. If xi is an owin object it must be of mask type.

obswin

If xi is an owin object then obswin is an owin object that specifies the observation window.

normalise

If TRUE will divide result by \(2 ln(2)\) and add 1 to make contagion between 0 and 1 for all binary maps.

Functions

  • contagpixelgrid(): Pixel-adjacency contagion landscape metric of a binary map.

  • adjacency(): Calculates the adjacency matrix used in the pixel contagion

Warning

Will fail if map is either all foreground or all background.

Details

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 xiSecond pixel not in xi
First pixel in xi--
First pixel not in xi--

References

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.

Examples

Run this code
xi <- heather$coarse
obswin <- owin(xrange = c(0,7),yrange=c(0,16))
adjmat <- adjacency(xi,obswin)
pixeladjcontagion <- contagpixelgrid(xi,obswin)

Run the code above in your browser using DataLab