pathml
Full-featured computational pathology toolkit. Use for advanced WSI analysis including multiplexed immunofluorescence (CODEX, Vectra), nucleus segmentation, tissue graph construction, and ML model training on pathology data. Supports 160+ slide formats. For simple tile extraction from H&E slides, histolab may be simpler.
Author
Category
Image ProcessingInstall
Hot:3
Download and extract to your skills directory
Copy command and send to AI Agent for auto-install:
Download and install this skill https://openskills.cc/api/download?slug=k-dense-ai-skills-pathml&locale=en&source=copy
PathML - a full-featured Python toolkit for computational pathology
Skill Overview
PathML is a computational pathology Python toolkit designed specifically for whole slide image (WSI) analysis. It provides a complete workflow from image loading and preprocessing to machine learning model training.
Use Cases
1. Batch Processing of Whole Slide Images (WSI)
When you need to handle pathology slides in 160+ proprietary formats from vendors such as Aperio, Hamamatsu, and Leica, PathML offers a unified interface to load image pyramids, metadata, and regions of interest. It supports automated preprocessing pipelines for large-scale datasets, including tissue detection, stain normalization, and quality control filtering.
2. Analysis of Multiparameter Imaging Data
Suitable for analyses of spatial proteomics and gene expression data from platforms such as CODEX, Vectra, and MERFISH. It provides dedicated slide classes and conversion tools, supports cell segmentation (e.g., the Mesmer model), enables quantitative marker expression analysis, and can export to AnnData for single-cell analysis.
3. Development of Pathology Deep Learning Models
When you need to train or deploy pathology-specific models (e.g., HoVer-Net, HACTNet), PathML integrates the PyTorch framework. It provides custom DataLoaders, model evaluation, and ONNX inference support. It is suitable for nucleus detection, segmentation, and classification tasks, as well as spatial analysis based on graph neural networks.
Core Features
1. Modular Preprocessing Pipelines
Offers composable converters to build standardized preprocessing workflows, including Macenko/Vahadane stain normalization, tissue and nuclear segmentation, noise filtering, and artifact labeling. The Pipeline architecture ensures reproducibility and scalability for large-scale datasets, and supports efficient HDF5 storage and management of tiles, masks, and metadata.
2. Spatial Graph Construction and Feature Extraction
Extracts features from segmented objects to build cell- and tissue-level spatial graph representations. It fits graph neural network and spatial analysis workflows, supporting modeling of complex tissue structure relationships and downstream analysis.
3. End-to-End Machine Learning Integration
Includes pretrained models such as HoVer-Net (synchronized nucleus segmentation and classification) and HACTNet (hierarchical cell type classification). Supports custom model training, evaluation, and inference. Also provides integration with public pathology datasets to simplify the model development workflow.
FAQ
Which slide formats does PathML support?
PathML supports 160+ proprietary formats, including Aperio SVS, Hamamatsu NDPI, Leica SCN, Zeiss ZVI, DICOM, and OME-TIFF. The tools automatically handle vendor-specific formats and provide a unified interface to access image pyramids, metadata, and regions of interest.
Should I choose PathML or histolab?
The choice depends on the complexity of your task. For extracting simple H&E slides, histolab is more straightforward and easier to use. PathML is better suited for scenarios requiring advanced functionality, such as multiparametric immunofluorescence analysis, nucleus segmentation, tissue graph construction, ML model training, and large-scale data management.
How do I use PathML to process CODEX data?
Use the
CODEXSlide class to load CODEX slides. Then, use specialized conversion tools to merge data from multiple runs/channels, apply the Mesmer model for cell segmentation, quantify marker expression, and finally export to AnnData for single-cell analysis. For detailed CODEX/Vectra workflows, refer to references/multiparametric.md.