Skip to content
Agentmart
Submit a tool

alterlab-histolab

Extract and preprocess tiles from whole-slide images (WSI) with histolab — OpenSlide-backed slide loading, tissue detection and masks, Random/Grid/Score tile…

Skill by AlterLab-IEU

IndexedApache-2.0★ 78
Write a review

Chalk Labs

Need help deploying alterlab-histolab?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/alterlab-ieu-alterlab-histolab

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Extract and preprocess tiles from whole-slide images (WSI) with histolab — OpenSlide-backed slide loading, tissue detection and masks, Random/Grid/Score tile extraction, and image/morphological filters for H&E preprocessing. Use when the user needs lightweight WSI slide preprocessing — building tile datasets for ML training, tissue segmentation, or quick tile-based inspection of histopathology slides. For end-to-end computational-pathology, deep-learning model training, nucleus segmentation, or multiplexed/spatial-proteomics (CODEX, Vectra) pipelines prefer alterlab-pathml instead. Part of the AlterLab Academic Skills suite.

Use cases: presentations, ml, research, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/alterlab-histolab

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read
  • Write
  • Edit
  • Bash(python:*)
  • Bash(uv:*)

What's inside

Skill name
alterlab-histolab
Description
Extract and preprocess tiles from whole-slide images (WSI) with histolab — OpenSlide-backed slide loading, tissue detection and masks, Random/Grid/Score tile extraction, and image/morphological filters for H&E preprocessing. Use when the user needs lightweight WSI slide preprocessing — building tile datasets for ML training, tissue segmentation, or quick tile-based inspection of histopathology slides. For end-to-end computational-pathology, deep-learning model training, nucleus segmentation, or multiplexed/spatial-proteomics (CODEX, Vectra) pipelines prefer alterlab-pathml instead. Part of the AlterLab Academic Skills suite.
License
Apache-2.0
Compatibility
Runs under `uv run python` with histolab 0.7.0 (still the latest release, Feb 2024) in a **dedicated environment**: it requires Python >= 3.8, < 3.12 and pins numpy <= 1.24.4, scipy < 1.10.1, scikit-image < 0.19.4 and openslide-python 1.3.1 — it will not co-install with a modern numpy 2.x / Python 3.12+ stack. The OpenSlide C library must also be present (`uv pip install openslide-bin`, or `brew install openslide` / `apt install libopenslide0`). No API key or account required.
Allowed tools
Read, Write, Edit, Bash(python:*), Bash(uv:*)
Metadata
version: 1.1.0 · last_updated: 2026-09-23 · skill-author: AlterLab
Instructions
163 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (9)

  • SKILL.md
  • evals.json · evals/
  • best_practices.md · references/
  • filters_preprocessing.md · references/
  • slide_management.md · references/
  • tile_extraction.md · references/
  • tissue_masks.md · references/
  • visualization.md · references/
  • workflows.md · references/

SKILL.md (first lines)

# Histolab

## Overview

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.

## When to Use This Skill

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.

### Does NOT Trigger

| 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.

## Installation

```bash
# 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:

1. **Pinned scientific stack.** 0.7.0 (Feb 2024, still the latest release) requires
   `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.
2. **OpenSlide is a C library**, not bundled with the wheel. The simplest fix is the
   `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.

## Core Workflow

1. **Load** the slide with `Slide(path, processed_path=...)` and inspect dimensions/levels.
2. **Detect tissue** with a mask (`TissueMask` or `BiggestTissueBoxMask`).
3. **Preview** tile locations with `tiler.locate_tiles(slide)` before committing.
4. **Extract** tiles with one of three tilers (Random/Grid/Score).

Minimal example:

```python
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`.

## Core Capabilities

### 1. Slide Management

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.

### 2. Tissue Detection and Masks

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 analysis
- `BiggestTissueBoxMask`: single main section, exclude artifacts (default)
- Custom `BinaryMask`: specific ROI, exclude annotations, custom segmentation

See `references/tissue_masks.md` for how detection filters work, visualizing
masks with `locate_mask()`, and custom rectangular / annotation-exclusion masks.

### 3. Tile Extraction

Extract smaller regions from large WSI using one of three strategies:

- **RandomTiler** — fixed number of randomly positioned tiles. Best for sampling
  diverse regions, exploration, training data. Key params: `n_tiles`, `seed`.
- **GridTiler** — systematic grid across tissue. Best for complete coverage,
  spatial analysis, reconstruction. Key param: `pixel_overlap`.
- **ScoreTiler** — top-ranked tiles by scoring function. Best for informative
  regions, quality-driven selection. Key param: `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.

From AlterLab-IEU/AlterLab-Academic-Skills, Apache-2.0.

More from AlterLab-IEU/AlterLab-Academic-Skills

Signals

Stars
78
Forks
16
Open issues
1
Last commit (this folder)
Sep 23, 2026 (1 month ago)
Last release
Sep 23, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from AlterLab-IEU

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get alterlab-histolab running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying alterlab-histolab?

CallGet help
Cite this page

alterlab-histolab skill. Agent Mart. https://agentmart.dev/skills/alterlab-ieu-alterlab-histolab (last updated 2026-10-24)