'Spatial metrics, patch Proximity Index (PROX) and patch Similarity Index (SIMI) (with Search radius e.g. FRAGSTATS) with Python or R

I have a raster containing patches eg.:

labeled Classification from background value 1 to n

I would like to calculate the Proximity (PROX) Index and the Similarity (SIMI) Index for each Patch at a given radius (Search radius) around each Patch.

schematic: patch proximity with buffer

I'm looking for something like FRAGSTATS but in R or Python

Some info to the Indexes:

PROX formula

The proximity index considers the size and proximity of all patches whose edges are within a specified search radius of the focal patch. The index is computed as the sum, over all patches of the corresponding patch type whose edges are within the search radius of the focal patch, of each patch size divided by the square of its distance from the focal patch.

enter image description here

Similarity index (SIMI) is a modification of the proximity index, the difference being that similarity considers the size and proximity of all patches, regardless of class (here FRAGSTATS need a Similarity table which contains the information about the similarity between the classes). This is done by multiplying dik (similarity between patch types i and k) to aijs . (http://www.umass.edu/landeco/research/fragstats/documents/Metrics/Isolation%20-%20Proximity%20Metrics/FRAGSTATS%20Metrics.htm)



Solution 1:[1]

The 'landscapemetrics' package in R does much the same as FRAGSTATS, using the all the same background principles. The documentation is here: https://cran.r-project.org/web/packages/landscapemetrics/landscapemetrics.pdf

Solution 2:[2]

Unfortunately, the proximity and similarity index are currently not supported by the landscapemetrics package.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elm
Solution 2 mhesselbarth