Skip to content

API Reference

Welcome to the Histolytics API Reference. Here you'll find an overview of all public objects, functions and methods implemented in Histolytics.

Modules

Data

Sample datasets

  • cervix_nuclei: A GeoDataframe of segmented nuclei of a cervical biopsy.
  • cervix_tissue: A GeoDataframe of segmented tissue regions of a cervical biopsy.
  • cervix_nuclei_crop: A GeoDataframe of segmented nuclei of a cervical biopsy (cropped).
  • cervix_tissue_crop: A GeoDataframe of segmented tissue regions of a cervical biopsy (cropped).
  • hgsc_nuclei_wsi: A GeoDataframe of segmented nuclei of a HGSC whole slide image.
  • hgsc_tissue_wsi: A GeoDataframe of segmented tissue regions of a HGSC whole slide image.
  • hgsc_cancer_nuclei: A GeoDataframe of segmented nuclei of a HGSC tumor nest.
  • hgsc_cancer_he: A 1500x1500 H&E image of HGSC containing a tumor nest.
  • hgsc_stroma_nuclei: A GeoDataframe of segmented nuclei of a HGSC stroma.
  • hgsc_stroma_he: A 1500x1500 H&E image of HGSC containing stroma.

Losses

Loss functions for panoptic segmentation

  • BCELoss: Binary Cross Entropy Loss.
  • CELoss: Cross Entropy Loss.
  • DiceLoss: Dice Loss.
  • FocalLoss: Focal Loss.
  • JointLoss: Joint Loss. Combines arbitrary number of losses into one.
  • MSE: Mean Squared Error Loss.
  • MAE: Mean Absolute Error Loss.
  • MultiTaskLoss: Multi-task loss for panoptic segmentation. Combines multiple losses for multi prediction tasks like panoptic segmentation.
  • SSIM: Structural Similarity Index Loss.
  • TverskyLoss: Tversky Loss.

Metrics

Metrics for panoptic segmentation

Models

Panoptic segmentation models

Nuclei Features

Extracting features from nuclei

Spatial Aggregation

Neighborhood statistics and grid aggregation

Spatial Clustering

Clustering and cluster metrics

Spatial Geometry

Morphometrics and shapes

  • shape_metric: Calculate shape moprhometrics for polygon geometries.
  • line_metric: Calculate shape moprhometrics for line geometries.
  • medial_lines: Create medial lines of input polygons.
  • hull: Create various hull types around point sets.

Spatial Graph

Graph fitting

Spatial Operations

Spatial querying and partitioning

  • get_objs: Query segmented objects from specified regions.
  • get_interfaces: Get interfaces of two segmented tissues.
  • rect_grid: Partition a GeoDataFrame into a rectangular grid.
  • h3_grid: Partition a GeoDataFrame into an H3 hexagonal spatial index (grid).
  • quadbin_grid: Partition a GeoDataFrame into a Quadbin spatial index (grid).

Stroma Features

Extracting features from stroma

Transforms

Image and instance label transforms for model training

Utils

Utility functions and classes

gdf

  • gdf_apply: Apply a function to a GeoDataFrame in parallel.
  • gdf_to_polars: Convert a GeoDataFrame to a Polars DataFrame.
  • get_centroid_numpy: Get the centroids of a GeoDataFrame as a NumPy array.
  • set_uid: Set a unique identifier (UID) for each object in a GeoDataFrame.
  • set_geom_precision: Set the precision of geometries in a GeoDataFrame.

raster

  • inst2gdf: Convert an instance segmentation mask to a GeoDataFrame.
  • sem2gdf: Convert a semantic tissue segmentation mask to a GeoDataFrame.
  • gdf2inst: Convert a GeoDataFrame to an instance segmentation mask.
  • gdf2sem: Convert a GeoDataFrame to a semantic tissue segmentation mask.

plot

  • draw_thing_contours: Draw contours of segmented nuclei and overlay them on an image.
  • legendgram: Create a histogram legend for a specified column in a GeoDataFrame.

WSI (Whole Slide Images)

WSI handling and WSI-level segmentation