A specialized library for analyzing Whole Slide Imaging (WSI) data, including tissue graph construction and pathology-focused ML workflows.

Install

mkdir -p .claude/skills/pathml && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6546" && unzip -o skill.zip -d .claude/skills/pathml && rm skill.zip

Installs to .claude/skills/pathml

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

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.
322 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Load 160+ slide formats
  • Build preprocessing pipelines
  • Perform nucleus segmentation
  • Construct tissue graphs
  • Train deep learning models
  • Analyze multiplexed imaging

How it works

PathML provides modular transforms and slide classes to load, preprocess, and analyze pathology images through a pipeline architecture.

Inputs & outputs

You give it
Whole-slide image file
You get back
Processed tiles or spatial graph data

When to use pathml

  • Perform nucleus segmentation on WSI
  • Construct tissue graphs from pathology images
  • Train ML models on immunofluorescence data

About this skill

PathML

Scope and safety boundary

Use PathML for local computational pathology research. It is beta research software, not a validated medical device, diagnostic system, clinical decision support tool, or substitute for a pathologist. Do not use outputs to diagnose, grade, stage, or treat a patient.

Pathology files may contain faces, labels, accession numbers, patient identifiers, DICOM tags, filenames, or linked clinical data. Before processing:

  1. Confirm authorization, consent/waiver, data-use terms, and institutional policy.
  2. De-identify pixels and metadata; keep the re-identification key outside the analysis workspace.
  3. Use pseudonymous patient_id, slide_id, and specimen_id values. Do not put direct identifiers in filenames, logs, .h5path labels, model cards, or reports.
  4. Keep inputs, intermediates, and outputs on approved local encrypted storage.
  5. Split by patient (then slide) before tiling or fitting any preprocessing step.

Version baseline, verified 2026-07-23

  • Installable stable release: PyPI pathml==3.0.5, published 2026-03-24.
  • The v3.0.5 release notes state Python 3.10-3.12 and sunset 3.9. PyPI does not declare Requires-Python and still has a stale 3.8 classifier, so use the release statement and test the exact environment.
  • GitHub releases v3.0.6 (2026-04-14) and v3.0.7 (2026-07-09) exist, but PyPI has no artifacts for them as of this review. v3.0.7 updates Torch/TorchVision/ torch-geometric and ONNX export code. Do not mix those source dependencies with the 3.0.5 wheel.
  • ReadTheDocs /latest identifies itself as 3.0.5. Examples here were checked against the v3.0.5 tag and PyPI wheel metadata, not unversioned snippets.
  • This skill is MIT-licensed. PathML itself is GPL-2.0 with upstream commercial licensing options; review upstream terms before redistribution.

Reproducible installation

Use Python 3.11 unless the project has tested another supported interpreter:

uv venv --python 3.11
source .venv/bin/activate
uv pip install "pathml==3.0.5"
python -c "import importlib.metadata as m; print(m.version('pathml'))"

PathML 3.0.5 declares no package extras: do not use pathml[all]. Its base distribution pins a large scientific/ML stack, including Torch 2.8.0, ONNX 1.17.0, ONNX Runtime 1.17.x, OpenSlide Python 1.3.1, python-bioformats 4.1.0, and python-javabridge 4.0.4.

Install native prerequisites before the uv command:

# Debian/Ubuntu
sudo apt-get install openslide-tools gcc g++ libblas-dev liblapack-dev openjdk-17-jdk

# macOS
brew install openslide openjdk@17

# Windows OpenSlide option documented upstream
vcpkg install openslide

Java/Bio-Formats is needed for the broad multidimensional format backend. OpenSlide handles common brightfield WSI formats more efficiently. CUDA is optional and must match the pinned PyTorch build; follow PyTorch's platform selector rather than guessing a CUDA wheel. See references/image_loading.md.

Stable minimal workflow

PathML 3.0.5 uses slide convenience classes and SlideData.run(). It does not provide SlideData.from_slide(), and Pipeline does not have run():

from pathml.core import HESlide
from pathml.preprocessing import BoxBlur, Pipeline, TissueDetectionHE

slide = HESlide("data/pseudonymous_slide.svs", backend="openslide")
pipeline = Pipeline(
    [
        BoxBlur(kernel_size=5),
        TissueDetectionHE(mask_name="tissue", min_region_size=5000),
    ]
)
slide.run(
    pipeline,
    distributed=False,
    tile_size=512,
    tile_stride=512,
    level=0,
    tile_pad=False,
)
slide.write("derived/pseudonymous_slide.h5path")

Start with a bounded manual sample before a full run:

from itertools import islice

for tile in islice(slide.generate_tiles(shape=512, stride=512, level=0), 8):
    pipeline.apply(tile)
    assert tile.masks["tissue"].shape[:2] == tile.image.shape[:2]

Tiles use (i, j) = (row, column) coordinates at the selected pyramid level. For OpenSlide, PathML maps them to level-0 coordinates internally. Record the level and downsample; convert to (x, y) or micrometres explicitly downstream.

Research workflow

  1. Inventory locally. Validate the manifest, reject URLs/symlinks, inspect only allowlisted technical metadata, and remove identifiers.
  2. Freeze splits. Assign every patient and all their slides to one split before generating overlapping tiles, graphs, normalization references, or features.
  3. Plan bounds. Estimate tile count, RAM, output size, and pipeline stages.
  4. Pilot preprocessing. Inspect tissue masks, whitespace/artifact labels, stain behavior, edge padding, and empty-mask cases on representative training slides. Do not tune from test slides.
  5. Run and preserve coordinates. Keep tile level, (i, j), downsample, MPP, mask names, QC decisions, and failed/skipped tiles.
  6. Build spatial data deliberately. Validate channel order, physical units, instance labels, node-feature alignment, graph edges, and cell-to-tissue assignments.
  7. Infer in bounded batches. Verify model provenance and checksum without loading unknown pickle checkpoints. Keep predictions linked to slide/tile coordinates and stitch overlaps with a documented rule.
  8. Report provenance and limits. Include package lock, source hashes, scanner, stain, parameters, seeds, split manifest, model card, exclusions, and QC.

No-network default and explicit consent gate

Do not instantiate download-capable classes or set dataset download=True unless the user explicitly opts in after receiving the endpoint and disclosure:

  • SegmentMIFRemote downloads an ONNX file from https://huggingface.co/pathml/test/resolve/main/mesmer.onnx at construction, then runs inference locally. Stable source does not upload image pixels. The request still discloses network metadata such as IP address and headers and creates temp.onnx; there is no built-in checksum or offline flag.
  • Deprecated SegmentMIF imports local DeepCell Mesmer, but DeepCell model initialization may need separately provisioned weights. It is not a PathML extra and is not the preferred stable API.
  • RemoteTestHoverNet downloads a model from Hugging Face.
  • PanNukeDataModule(download=True) contacts Warwick; DeepFocusDataModule contacts Zenodo. Both default to download=False.

Before any future hosted prediction call, state the exact destination, pixel channels/regions, metadata, identifiers, retention, legal basis, and safeguards; obtain explicit consent; and never send PHI by default. Prefer reviewed, checksummed local model artifacts and local inference.

Model-code security

  • PyTorch model.eval() means evaluation mode for modules; it is not Python's dangerous built-in evaluator. Never use Python dynamic evaluation or execution.
  • Do not name local files pathml.py, torch.py, onnx.py, or after standard libraries; shadow modules can silently change imports.
  • PathML's EntityDataset loads .pt objects with weights_only=False. Never open an untrusted graph/checkpoint. Treat pickle-based pipelines and .pt files as executable code.
  • ONNX is safer than pickle but not inherently trusted. Verify source, SHA-256, expected input/output schema, file size, and runtime limits; use isolation for third-party models.

Bundled local CLIs

All helpers reject URLs and symlinks, cap inputs/work, use strict JSON, avoid network access, and require no PathML import for --help:

python scripts/slide_manifest.py validate --manifest manifest.csv --root .
python scripts/slide_manifest.py inspect --slide data/example.svs --root .
python scripts/plan_pipeline.py --width 100000 --height 80000 --tile-size 512 --stride 512
python scripts/image_qc.py synthetic --width 256 --height 256
python scripts/validate_spatial_schema.py graph --input graph.json --root .
python scripts/validate_spatial_schema.py multiplex --input cells.csv --root .
python scripts/plan_inference.py --tile-count 4000 --batch-size 16 --height 256 --width 256

The inference planner reads numbers or a bounded JSON model card only; it never imports a model framework or opens a checkpoint.

Detailed references

  • references/image_loading.md — slide classes, backends, formats, levels, coordinates, technical metadata, and privacy.
  • references/preprocessing.md — stable transforms, masks/QC, stain processing, pipeline execution, and leakage prevention.
  • references/data_management.md.h5path, manifests, datasets, provenance, splits, and safe downloads.
  • references/multiparametric.md — multidimensional layout, CODEX/Vectra, quantification, AnnData, DeepCell/Mesmer, and network disclosure.
  • references/graphs.md — instance maps, feature alignment, KNN/RAG/HACT graphs, spatial units, schemas, and validation.
  • references/machine_learning.md — HoVer-Net/HACTNet, local ONNX inference, batching, checkpoint trust, evaluation, and model provenance.

Primary sources

All checked 2026-07-23:

When not to use it

  • Simple tile extraction from H&E slides

Prerequisites

Python

Limitations

  • Requires specific slide formats
  • High memory usage for large WSI

How it compares

It offers a unified, full-featured toolkit for complex spatial analysis compared to basic tile extraction tools.

Compared to similar skills

pathml side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
pathml (this skill)12moReviewAdvanced
llava78moReviewAdvanced
cocoindex69moReviewIntermediate
ai-multimodal96moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by K-Dense-AI

View all by K-Dense-AI

literature-review

K-Dense-AI

Conduct comprehensive, systematic literature reviews using multiple academic databases (PubMed, arXiv, bioRxiv, Semantic Scholar, etc.). This skill should be used when conducting systematic literature reviews, meta-analyses, research synthesis, or comprehensive literature searches across biomedical, scientific, and technical domains. Creates professionally formatted markdown documents and PDFs with verified citations in multiple citation styles (APA, Nature, Vancouver, etc.).

5591,298

markitdown

K-Dense-AI

Convert various file formats (PDF, Office documents, images, audio, web content, structured data) to Markdown optimized for LLM processing. Use when converting documents to markdown, extracting text from PDFs/Office files, transcribing audio, performing OCR on images, extracting YouTube transcripts, or processing batches of files. Supports 20+ formats including DOCX, XLSX, PPTX, PDF, HTML, EPUB, CSV, JSON, images with OCR, and audio with transcription.

177310

scientific-writing

K-Dense-AI

Write scientific manuscripts. IMRAD structure, citations (APA/AMA/Vancouver), figures/tables, reporting guidelines (CONSORT/STROBE/PRISMA), abstracts, for research papers and journal submissions.

94309

exploratory-data-analysis

K-Dense-AI

Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats. This skill should be used when analyzing any scientific data file to understand its structure, content, quality, and characteristics. Automatically detects file type and generates detailed markdown reports with format-specific analysis, quality metrics, and downstream analysis recommendations. Covers chemistry, bioinformatics, microscopy, spectroscopy, proteomics, metabolomics, and general scientific data formats.

15114

infographics

K-Dense-AI

Create professional infographics using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Integrates research-lookup and web search for accurate data. Supports 10 infographic types, 8 industry styles, and colorblind-safe palettes.

1141

pptx-posters

K-Dense-AI

Create research posters using HTML/CSS that can be exported to PDF or PPTX. Use this skill ONLY when the user explicitly requests PowerPoint/PPTX poster format. For standard research posters, use latex-posters instead. This skill provides modern web-based poster design with responsive layouts and easy visual integration.

911

You might also like

llava

zechenzhangAGI

Large Language and Vision Assistant. Enables visual instruction tuning and image-based conversations. Combines CLIP vision encoder with Vicuna/LLaMA language models. Supports multi-turn image chat, visual question answering, and instruction following. Use for vision-language chatbots or image understanding tasks. Best for conversational image analysis.

7117

cocoindex

cocoindex-io

Comprehensive toolkit for developing with the CocoIndex library. Use when users need to create data transformation pipelines (flows), write custom functions, or operate flows via CLI or API. Covers building ETL workflows for AI data processing, including embedding documents into vector databases, building knowledge graphs, creating search indexes, or processing data streams with incremental updates.

6116

ai-multimodal

mrgoonie

Process and generate multimedia content using Google Gemini API. Capabilities include analyze audio files (transcription with timestamps, summarization, speech understanding, music/sound analysis up to 9.5 hours), understand images (captioning, object detection, OCR, visual Q&A, segmentation), process videos (scene detection, Q&A, temporal analysis, YouTube URLs, up to 6 hours), extract from documents (PDF tables, forms, charts, diagrams, multi-page), generate images (text-to-image, editing, composition, refinement). Use when working with audio/video files, analyzing images or screenshots, processing PDF documents, extracting structured data from media, creating images from text prompts, or implementing multimodal AI features. Supports multiple models (Gemini 2.5/2.0) with context windows up to 2M tokens.

9108

rag-implementation

wshobson

Build Retrieval-Augmented Generation (RAG) systems for LLM applications with vector databases and semantic search. Use when implementing knowledge-grounded AI, building document Q&A systems, or integrating LLMs with external knowledge bases.

10101

rdkit

K-Dense-AI

Cheminformatics toolkit for fine-grained molecular control. SMILES/SDF parsing, descriptors (MW, LogP, TPSA), fingerprints, substructure search, 2D/3D generation, similarity, reactions. For standard workflows with simpler interface, use datamol (wrapper around RDKit). Use rdkit for advanced control, custom sanitization, specialized algorithms.

856

pyhealth

davila7

Comprehensive healthcare AI toolkit for developing, testing, and deploying machine learning models with clinical data. This skill should be used when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, drug recommendation), medical coding systems (ICD, NDC, ATC), physiological signals (EEG, ECG), healthcare datasets (MIMIC-III/IV, eICU, OMOP), or implementing deep learning models for healthcare applications (RETAIN, SafeDrug, Transformer, GNN).

351

Search skills

Search the agent skills registry