histolab/histolab

Library for Digital Pathology Image Processing

What it solves

Digital pathology involves processing Whole Slide Images (WSIs), which are massive digital scans of tissue slides. These files are often stored in proprietary formats, contain irrelevant artifacts (like pen marks or mold), and are too large to be fed directly into deep learning models. histolab provides a standardized, reproducible way to handle these images, detect actual tissue regions, and extract smaller, informative image tiles for use in AI pipelines.

How it works

The library maps WSI files into Slide objects, allowing users to retrieve metadata like magnification levels and dimensions. It then uses a tiler module to crop the images into smaller tiles based on three main strategies:

  • Random Extraction: Crops a fixed number of tiles randomly from the slide.
  • Grid Extraction: Crops tiles following a grid structure across the largest detected tissue region.
  • Score-based Extraction: Uses a scoring function (such as NucleiScorer, which prioritizes tiles with high nuclei and tissue density) to save only the most informative tiles.

Who it’s for

It is designed for clinical and scientific researchers working in computational pathology who need to prepare large-scale tissue image datasets for deep learning models.

Highlights

  • Automatic Tissue Detection: Automatically identifies the largest connected tissue area to avoid cropping empty space.
  • Multimodal Support: Handles various WSI formats and magnification levels.
  • Customizable Tiling: Supports adjustable tile size, overlap, and tissue percentage thresholds.
  • Integrated Data Access: Includes a data module to easily download example datasets (e.g., TCGA data).
  • Visualization: Includes tools to visualize selected tiles on a scaled version of the slide before extraction.

Related

  • Project
  • Project
  • Project
  • Project
  • Project