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,maxis the largest connected-component size of habitati,n_iits number of connected regions, andS_totalthe total non-background voxel count.- Parameters:
label_array – Integer habitat labels,
0denoting 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.0for an empty or single-region map.