Calculates the mean product of neighboring, non-missing cell values. The texture index ranges from -1 (unlike values are always adjacent) through 0 (no spatial association) to 1 (like values are always adjacent).

texture_index(x, ...)

Arguments

x

SpatRaster or matrix containing two values: -1 and 1

...

Arguments for comat::get_coma()

Value

A numeric vector

See also

Examples

data(r_start, package = "spatialising")
texture_index(r_start)
#> [1] 0.9481633
ts1 = kinetic_ising(r_start, B = -0.3, J = 0.7)
texture_index(ts1)
#> [1] 0.9428571
ts2 = kinetic_ising(r_start, B = -0.3, J = 0.7, updates = 2)
texture_index(ts2)
#> [1] 0.9408163 0.9338776

# \donttest{
  library(terra)
  r1 = rast(system.file("raster/r_start.tif", package = "spatialising"))
  texture_index(r1)
#> [1] 0.9481633
  r2 = kinetic_ising(r1, B = -0.3, J = 0.7)
  texture_index(r2)
#> [1] 0.9253061
# }