tumourkit.preprocessing.hovernet2centroids.parse_centroids

tumourkit.preprocessing.hovernet2centroids.parse_centroids(nuc: Dict[str, Any]) List[Tuple[int, int, int]]

Extracts centroids from a HoverNet JSON dictionary and returns them as a list of (X,Y,class) tuples.

Parameters:

nuc (Dict[str, Any]) – The HoverNet JSON dictionary containing nuclei information.

Returns:

A list of (X,Y,class) tuples representing centroids.

Return type:

List[Tuple[int,int,int]]

The class value is extracted from the ‘type’ attribute of the instance in the dictionary. If the class value is 0, the function removes the instance and issues a warning.