pathml
Analyze pathology slides with machine learning
Also available from: davila7
PathML streamlines computational pathology workflows by providing unified tools for loading diverse slide formats, preprocessing images, and training ML models. Researchers can analyze whole-slide images, build tissue graphs, and quantify multiplex immunofluorescence data in a single framework.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "pathml". Load slide.svs and apply stain normalization
Expected outcome:
- ✓ Loaded slide.svs (40x magnification, 89600×76800 pixels)
- ✓ Applied Macenko stain normalization to target image
- ✓ Detected 12 tissue regions across 4 levels
- ✓ Generated 2,847 tiles (256×256) from tissue areas
- ✓ Normalization complete - stains now consistent across batch
Using "pathml". Segment nuclei with HoVer-Net
Expected outcome:
- ✓ Loaded HoVer-Net model with 5 nuclear categories
- ✓ Processed 2,847 tiles in 4.2 minutes (GPU)
- ✓ Detected 124,856 nuclei across sample
- ✓ Generated segmentation masks and classification maps
- ✓ Nuclear counts by type: epithelial (45K), fibroblast (32K), immune (28K), other (20K)
Using "pathml". Analyze CODEX multiplex data
Expected outcome:
- ✓ Loaded CODEX dataset (30 markers, 4 runs)
- ✓ Collapsed multi-run data into single multichannel image
- ✓ Segmented 45,231 cells using Mesmer
- ✓ Extracted marker expression per cell (median intensity)
- ✓ Exported to AnnData for downstream analysis
Security Audit
SafePathML is a legitimate open-source computational pathology toolkit. All 554 static findings are false positives - the scanner detected patterns in markdown documentation (code examples) rather than actual executable code. The 'eval()' detections are PyTorch's model.eval() method, not dynamic code execution. Shell command patterns are documentation examples for batch processing workflows. No malicious intent, data exfiltration, or security vulnerabilities confirmed.
Risk Factors
⚡ Contains scripts (2)
⚙️ External commands (2)
🌐 Network access (1)
📁 Filesystem access (1)
Quality Score
What You Can Build
Segment nuclei in H&E stained tissues
Load whole-slide images, apply preprocessing pipelines, and use HoVer-Net to detect and classify cell nuclei for quantitative analysis.
Analyze CODEX multiplex imaging data
Process multi-run CODEX experiments, segment cells with Mesmer, and quantify protein marker expression for spatial proteomics.
Train custom pathology models
Use PathML's PyTorch integration to train deep learning models on public datasets like PanNuke with optimized data loading.
Try These Prompts
Load the SVS file at data/slide.svs using PathML and display the image pyramid structure. Show me what levels are available and their dimensions.
Create a PathML pipeline that detects tissue regions, normalizes H&E stains using Macenko method, and removes artifacts from slide.svs
Use PathML's HoVer-Net model to segment nuclei in the preprocessed slide. Extract segmentation masks and classify nucleus types.
From the segmented nuclei, construct a spatial graph where nodes are cells and edges connect neighboring cells. Extract graph features for downstream analysis.
Best Practices
- Always use appropriate slide class for your image format (SVSSlide, CODEXSlide, etc.)
- Generate tiles at appropriate resolution for your analysis - use level parameter to balance detail vs performance
- Apply stain normalization before training ML models to reduce batch effects
Avoid
- Don't load entire WSI into memory - use tiling and memory mapping for large slides
- Avoid training models on unnormalized images from different scanners or labs
- Don't use generic image loading libraries - PathML handles metadata and pyramid levels correctly
Frequently Asked Questions
What slide formats does PathML support?
How do I handle memory issues with large slides?
Can PathML train custom deep learning models?
What is the difference between HoVer-Net and HACT-Net?
How do I analyze CODEX multiplex data?
Can I use PathML for commercial projects?
Developer Details
Author
K-Dense-AILicense
GPL-2.0 license
Repository
https://github.com/K-Dense-AI/claude-scientific-skills/tree/main/scientific-skills/pathmlRef
main
File structure