tumourkit.preprocessing.hovernet2geojson.parse_contours

tumourkit.preprocessing.hovernet2geojson.parse_contours(nuc: Dict[str, Any], num_classes: int | None = 2) List[List[Tuple[float, float]]]

Parses contours of cells from the given HoverNet JSON dictionary.

Parameters:
  • nuc (Dict[str, Any]) – A dictionary containing HoverNet nuclei information.

  • num_classes (Optional[int]) – The number of classes (default 2).

Returns:

A list of contours of cells as list of points. Each contour has the same point at position 0 and -1.

Return type:

List[Contour]

Each contour has the same point at position 0 and -1. If a cell has no class information, it is assumed to belong to the “segmented” class (class 3).