PySlyde: A Lightweight, Open-Source Toolkit for Pathology Preprocessing

GregoryVerghese, Anthony Baptista, Chima Eke, Holly Rafique, Mengyuan Li, Fathima Mohamed, Ananya Bhalla, Lucy Ryan, Michael Pitcher, Enrico Parisini, Concetta Piazzese, Liz Ing-Simmons, Anita Grigoriadis · 2025

Read PySlyde: A Lightweight, Open-Source Toolkit for Pathology Preprocessing by GregoryVerghese, Anthony Baptista, Chima Eke, Holly Rafique, Mengyuan Li, Fathima Mohamed, Ananya Bhalla, Lucy Ryan, Michael Pitcher, Enrico Parisini, Concetta Piazzese, Liz Ing-Simmons, Anita Grigoriadis (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2511-05183.txt.

Introduction

Gregory Verghese and co-authors present PySlyde, an open-source Python toolkit that standardizes the prep work for digitized pathology slides. Whole-slide images hold rich maps of tissue form, but their huge size and varied make-up block smooth AI use.

PySlyde, built on OpenSlide, covers tissue finding, tile cutting, stain balance, and label parsing in one light package. Shared steps cut the patchwork of one-off scripts that labs now use. With clean, uniform inputs, models for diagnosis and care plans can train and compare on firmer ground across sites and scanners alike.

Catalog record

CREATORGregoryVerghese, Anthony Baptista, Chima Eke, Holly Rafique, Mengyuan Li, Fathima Mohamed, Ananya Bhalla, Lucy Ryan, Michael Pitcher, Enrico Parisini, Concetta Piazzese, Liz Ing-Simmons, Anita Grigoriadis
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE8 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2511-05183

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

PySlyde: A Lightweight, Open-Source Toolkit for Pathology Preprocessing
GregoryVerghese, Anthony Baptista, Chima Eke, Holly Rafique, Mengyuan Li, Fathima Mohamed, Ananya Bhalla, Lucy Ryan, Michael Pitcher, Enrico Parisini, Concetta Piazzese, Liz Ing-Simmons, Anita Grigoriadis

Abstract
The integration of artificial intelligence (AI) into pathology is advancing precision medicine by improving diagnosis, treatment planning, and patient outcomes. Digitised whole-slide images (WSIs) capture rich spatial and morphological information vital for understanding disease biology, yet their gigapixel scale and variability pose major challenges for standardisation and analysis. Robust preprocessing, covering tissue detection, tessellation, stain normalisation, and annotation parsing is critical but often limited by fragmented and inconsistent workflows. We present PySlyde, a lightweight, open-source Python toolkit built on OpenSlide to simplify and standardise WSI preprocessing. PySlyde provides an intuitive API for slide loading, annotation management, tissue detection, tiling, and feature extraction, compatible with modern pathology foundation models. By unifying these processes, it streamlines WSI preprocessing, enhances reproducibility, and accelerates the generation of AI-ready datasets, enabling researchers to focus on model development and downstream analysis.



Summary

The integration of artificial intelligence (AI) into pathology represents a transformative opportunity for precision medicine, with the potential to radically improve diagnosis, treatment planning, and patient outcomes
Verghese et al. 2023
;
Song et al. 2023
. Advances in computational pathology are enabling the analysis of complex histopathological data at unprecedented scale and resolution. By combining modern computer vision, machine learning, and pathology, researchers can extract quantitative biomarkers, detect subtle morphological patterns, and develop predictive models that complement human expertise
van der Laak et al. 2021
.

Central to these developments is the digitisation of histopathology slides into whole slide images (WSIs). WSIs offer valuable spatial and morphological insights that can deepen our understanding of cancer biology. However, their size (gigapixel-scale), complexity, and variability introduce significant computational and standardisation challenges for downstream computational tasks
McGenity et al. 2023
. Preprocessing WSIs, such as tissue detection, tessellation (splitting into smaller tiled images), stain normalisation and annotation parsing are essential steps before any downstream AI analysis can occur
Pocock et al. 2022
. Building robust, reproducible pipelines for WSI preprocessing is fundamental to computational pathology research. However, existing workflows often rely on ad hoc proprietary scripts, fragmented tools, and inconsistent formats, making standardisation and reproducibility difficult.

PySlyde is a lightweight, open-source Python toolkit wrapped around OpenSlide
Goode et al. 2013
, designed to address this gap and provide an intuitive and efficient approach to quickly preprocess WSIs. It provides a simple API to perform steps such as WSI loading, annotation handling, tissue detection, tile generation, and feature extraction with support for the latest pathology foundation models. PySlyde aims to lower the barrier to entry for pathology researchers, standardise preprocessing workflows, and accelerate the development of AI-ready datasets for computational pathology research, enabling researchers to focus on model development and other downstream tasks.

Figure 1:
Schematic overview of the WSI processing workflow supported by PySlyde. The overview is demonstrating a sample of functionality across the main classes and modules
Slide
,
WSIParser
,
FeatureGenerator
and the
IO
. Top row, from left to right: WSI loading using compatible formats through OpenSlide; annotation mask generation with support for QuPath or ImageJ formats; and preprocessing steps such as tissue detection. Bottom row, from left to right: Tessellation of WSIs into tissue tiles using the
WSIParser
class; feature extraction from tiles with support for pretrained encoders such as Virchow2, H-optimus, Gigapath, or UNI; and structured storage of tile embeddings and metadata using RocksDB, NumPy, or LMDB.

Statement of Need

WSI preprocessing is a foundational but time-consuming step in computational pathology. Common tasks, such as annotation parsing, binary and annotation mask generation, stain normalisation, and tessellation often involve custom scripts, multiple packages and ad hoc pipelines built for a single dataset or project. This fragmentation hinders reproducibility, increases technical debt, and slows the development and translation of AI methods into clinical workflows. The lack of standardised preprocessing practices thus remains one of the key barriers preventing the seamless integration of AI into diagnostic pathology
Bilal et al. 2025
.

While powerful frameworks exist for model training and inference, few provide a simple, consistent interface for preparing WSIs at scale. PySlyde directly addresses this unmet need by providing a modular, well-documented, and extensible preprocessing toolkit that integrates seamlessly with existing ecosystems, including OpenSlide, NumPy, PyTorch, and modern foundation models enabling researchers to build reproducible, scalable pipelines with minimal code.

Features

PySlyde provides several core modules that streamline preprocessing of WSIs. The toolkit is structured around four main components: the
Slide
class, the
WSIParser
class, the
FeatureGenerator
class, and the
IO
module.

•

The
Slide
Class:
Provides core functionality for working with individual WSIs.

–

WSI Loading:
Built on OpenSlide, PySlyde supports reading and processing of any OpenSlide-compatible WSI format.

–

Tissue Detection:
Implements tissue segmentation to create binary masks for filtering and selecting relevant regions.

–

Artifact Detection:
Integrates with HistoQC for detecting common WSI artifacts such as blurring, pen marks, and background noise.

–

Annotation Parsing:
Supports annotation files from QuPath
Bankhead et al. 2017
and ImageJ, and formats including JSON and CSV.

–

Mask Generation:
Enables fast segmentation mask creation and label extraction from annotations.

•

The
WSIParser
Class:
Handles slide-level tiling and region management.

–

Region Extraction:
Supports bounding-box extraction and spatial filtering of tissue regions.

–

Efficient Tiling:
Performs configurable, memory-efficient tiling at user-defined magnifications and strides. Tiles and features can be exported as image files or to low-latency key-value stores such as LMDB or RocksDB.

–

Stain Normalisation:
Includes methods such as Macenko
Macenko et al. 2009
, Reinhard
Reinhard et al. 2001
, and Vahadane
Vahadane et al. 2016
for colour normalisation across tiles, enabling consistent downstream analysis.

•

The
FeatureGenerator
Class:
Provides functionality for feature extraction using foundation models.

–

Feature Embedding:
Supports multiple pathology foundation models, including H-optimus-0
Saillard et al. 2024
, cTransPath
Wang et al. 2022
, Virchow2
Zimmermann et al. 2024
and UNI2
Chen et al. 2024
, for computing tile-level or slide-level embeddings for machine learning and clustering.

•

The
IO
Module:
Manages data export, integration, and reproducibility.

–

Reproducibility:
Comprehensive documentation, quick-start examples, and API references support transparent and reusable workflows.

Maintenance and Availability

PySlyde is actively maintained by contributors from PharosAI and King’s College London. The project is hosted on GitHub under an Apache 2.0 license, with Python unit tests and community issue tracking. Source code, installation instructions, and documentation are freely available at
https://gregoryverghese.github.io/PySlyde/

Read the complete text