Extracts and preprocesses tiles from whole-slide images (SVS, NDPI) using histolab — tissue detection, masks, and Random/Grid/Score tile extraction with H&E filters. For lightweight WSI preprocessing and tile dataset building.
Ships in alterlab-bioinformatics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Histolab is a Python library for processing whole slide images (WSI) in digital pathology. It automates tissue detection, extracts informative tiles from gigapixel images, and prepares datasets for deep learning pipelines. The library handles multiple WSI formats, implements sophisticated tissue segmentation, and provides flexible tile extraction strategies.
Use histolab for lightweight WSI tile pipelines: tissue detection, building tile datasets for ML training, H&E stain handling, and quick tile-based analysis of histopathology slides. For advanced spatial proteomics, multiplexed imaging, or full deep-learning pathology pipelines, use alterlab-pathml instead.
| Scenario | Use Instead |
|---|---|
| End-to-end computational pathology, nucleus segmentation, multiplexed imaging (CODEX/Vectra) | alterlab-pathml |
| Training the downstream classifier on the extracted tiles | alterlab-pytorch-lightning |
| DICOM whole-slide or radiology images rather than SVS/NDPI | alterlab-pydicom, alterlab-imaging-data-commons |
| Spatial transcriptomics on tissue sections | alterlab-squidpy-spatial |
| Managing/versioning the slide collection itself | alterlab-omero, alterlab-lamindb |
Single-cell RNA-seq analysis of an .h5ad (QC, normalisation, Leiden clustering, marker genes) | alterlab-scanpy |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-pathml) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
# histolab 0.7.0 needs Python >= 3.8, < 3.12 and numpy 1.x — give it its own env
uv venv --python 3.11 .venv-histolab
uv pip install --python .venv-histolab "histolab==0.7.0" openslide-bin
Two constraints that bite in a 2026 toolchain:
numpy <= 1.24.4, scipy < 1.10.1, scikit-image < 0.19.4 and
openslide-python 1.3.1. It cannot share an environment with a numpy 2.x / Python
3.12+ project — resolve this with a separate venv rather than by loosening pins.openslide-bin wheel (prebuilt binaries); otherwise brew install openslide on macOS
or apt install libopenslide0 on Debian/Ubuntu. Without it, import histolab.slide
fails with Couldn't locate OpenSlide dylib.The examples below target histolab 0.7.0; the API differs in older releases.
Slide(path, processed_path=...) and inspect dimensions/levels.TissueMask or BiggestTissueBoxMask).tiler.locate_tiles(slide) before committing.Minimal example:
from histolab.slide import Slide
from histolab.tiler import RandomTiler
slide = Slide("slide.svs", processed_path="output/")
# n_tiles, level, seed are CONSTRUCTOR args — not args to locate_tiles/extract.
tiler = RandomTiler(tile_size=(512, 512), n_tiles=100, level=0, seed=42)
tiler.locate_tiles(slide) # preview locations on the thumbnail first
tiler.extract(slide) # writes PNGs into processed_path
API gotcha (histolab 0.7.0): locate_tiles() and extract() take only
slide, an optional extraction_mask, and logging/styling kwargs — they do
not accept n_tiles. Set n_tiles (and seed, level, tile_size,
check_tissue, tissue_percent) on the tiler constructor. The
extraction_mask is passed to extract()/locate_tiles(), never to the
constructor.
Full copy-pasteable pipelines (quick start, 5 end-to-end workflows, and per-capability examples) live in references/workflows.md.
Load, inspect, and work with WSI files (SVS, TIFF, NDPI, etc.): access metadata
(dimensions, magnification, properties), generate thumbnails, and work with
pyramidal/multi-level structures. Key class: Slide.
See references/slide_management.md for slide initialization, built-in sample
datasets (prostate_tissue, ovarian_tissue, breast_tissue, heart_tissue,
aorta_tissue, plus pen-marked and IHC samples), pyramid levels, and
multi-slide processing.
Automatically identify tissue regions and filter background/artifacts. Key
classes: TissueMask (all tissue regions), BiggestTissueBoxMask (bounding box
of largest region — the default), and BinaryMask (base class for custom masks).
Choosing a mask:
TissueMask: multiple tissue sections, comprehensive analysisBiggestTissueBoxMask: single main section, exclude artifacts (default)BinaryMask: specific ROI, exclude annotations, custom segmentationSee references/tissue_masks.md for how detection filters work, visualizing
masks with locate_mask(), and custom rectangular / annotation-exclusion masks.
Extract smaller regions from large WSI using one of three strategies:
n_tiles, seed.pixel_overlap.scorer (NucleiScorer,
CellularityScorer, custom).Common parameters: tile_size, level (0 = highest res), check_tissue,
tissue_percent (default 80%), extraction_mask. Always preview with
locate_tiles() before extracting.
See references/tile_extraction.md for scorers, reporting, and advanced
(multi-level, hierarchical) extraction patterns.
Apply image-processing filters for tissue detection, QC, and preprocessing:
RgbToGrayscale, RgbToHsv, RgbToHed, OtsuThreshold,
Invert, StretchContrast, HistogramEqualization, Lambda.BinaryDilation, BinaryErosion, BinaryOpening,
BinaryClosing, RemoveSmallObjects, RemoveSmallHoles.Compose (in histolab.filters.image_filters) chains
filters into pipelines. Pass custom filters to a mask as positional varargs:
TissueMask(RgbToGrayscale(), OtsuThreshold(), ...).See references/filters_preprocessing.md for filter chaining, common pipelines
(tissue detection, pen removal, nuclei enhancement), and QC filters.
Display slides, masks, tile locations, and extraction quality: thumbnails, mask
overlays via locate_mask(), tile-location previews via locate_tiles(), tile
mosaics, and score distributions.
See references/visualization.md for mosaics, quality-assessment plots,
multi-slide comparison, and exporting high-resolution figures / PDF reports.
references/workflows.md — quick start, per-capability examples, and 5
end-to-end worked workflows (exploratory, grid, score-driven, multi-slide,
custom tissue detection).references/slide_management.md — loading/inspecting slides, sample datasets,
pyramid levels, multi-slide processing.references/tissue_masks.md — TissueMask/BiggestTissueBoxMask/BinaryMask,
custom masks, mask visualization and integration.references/tile_extraction.md — Random/Grid/Score tiler comparison, scorers,
CSV reporting, advanced extraction patterns.references/filters_preprocessing.md — image + morphological filters, filter
composition, preprocessing pipelines, QC filters.references/visualization.md — thumbnails, mask/tile previews, mosaics,
quality plots, figure export.references/best_practices.md — best practices, common use cases, and
troubleshooting (no tiles, background tiles, slow extraction, artifacts).Load the specific reference file you need for detailed implementation guidance, troubleshooting, or advanced features.
Part of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)references/best_practices.md (opens in a new tab)references/filters_preprocessing.md (opens in a new tab)references/slide_management.md (opens in a new tab)references/tile_extraction.md (opens in a new tab)references/tissue_masks.md (opens in a new tab)references/visualization.md (opens in a new tab)references/workflows.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-bioinformatics:alterlab-histolabfrom alterlab-bioinformatics
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-bioinformatics38 skills in this plugin
/alterlab-alphafoldPredict protein 3D structures with AlphaFold2 via ColabFold — MMseqs2-accelerated MSAs, monomer and AlphaFold2-Multimer complex folding, and confidence-based validation (pLDDT, pTM/ipTM, PAE). Use when folding a protein sequence or complex from FASTA, generating a predicted structure with confidence metrics, ranking models, or checking self-consistency of a design. For co-folding a protein WITH a small-molecule ligand or predicting binding affinity prefer alterlab-boltz; for antibody–antigen or one-FASTA multi-entity complexes prefer alterlab-chai; to LOOK UP an already-computed structure prefer alterlab-alphafold-db; for ESM embeddings or inverse folding prefer alterlab-esm. Part of the AlterLab Academic Skills suite./alterlab-anndataBuild, slice, concatenate, read, and write AnnData annotated data matrices (obs, var, X, layers, obsm, uns) — the scverse data STRUCTURE, not an analysis pipeline. Use when creating or wrangling .h5ad/zarr files, managing cell and gene annotations, concatenating batches, or handling layers/obsm/backed-mode; for the QC, normalization, clustering, UMAP, and differential-expression analysis pipeline prefer alterlab-scanpy instead, and for RNA velocity from spliced/unspliced layers prefer alterlab-scvelo instead. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job