ith_score

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

ith_score(label_array: ndarray, region_stats: Dict[int, Tuple[int, int]] | None = None) → float[source]

Compute the ITH score (topological fragmentation) of a habitat map.

Definition (unchanged from v0.1):

ith = 1 - (1 / S_total) * sum_i( S_i,max / n_i )

where S_i,max is the largest connected-component size of habitat i, n_i its number of connected regions, and S_total the total non-background voxel count.

Parameters:
  • label_array – Integer habitat labels, 0 denoting background.

  • region_stats – Optional precomputed habitat_region_stats() result. Pass this when the caller already labelled components so the volume is not walked twice.

Returns:

Score in [0, 1); 0.0 for an empty or single-region map.

Examples using habit.kernels.ith_score

Quickstart: Python API

Quickstart: Python API