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.
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
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.Other plugins' skills for the same job