histolab
Extracts and preprocesses whole-slide histology image tiles with Histolab.
Skill by K-Dense-AI
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/k-dense-ai-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.
About
Use cases: presentations, ml
Reviews
Write a reviewNo 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/histolab
What's inside
- Skill name
histolab- Description
- Extracts and preprocesses whole-slide histology image tiles with Histolab. Use for WSI inspection, tissue masks, random/grid/score-based tile extraction, H&E stain normalization, and tile dataset preparation. For multiplexed imaging or deep learning inference pipelines, use pathml.
- License
- MIT
- Compatibility
- Requires Python 3.8–3.11 and histolab 0.7.0 on Linux or macOS, plus native OpenSlide. Python 3.10 avoids scikit-image 0.19 source builds on macOS ARM. Optional pooch downloads samples; matplotlib plots results; large-image plus a tile source enables MPP extraction.
- Metadata
- version: 1.5 · skill-author: K-Dense Inc. · last-reviewed: 2026-10-01 · upstream-version: 0.7.0
- Instructions
- 155 lines in SKILL.md · view on GitHub
Files (8)
- SKILL.md
- core_capabilities.md · references/
- filters_preprocessing.md · references/
- slide_management.md · references/
- tile_extraction.md · references/
- tissue_masks.md · references/
- typical_workflows.md · references/
- visualization.md · references/
SKILL.md (first lines)
# Histolab
## When to use
Use Histolab to inspect WSI metadata, identify tissue, extract image tiles, and
standardize H&E staining. Its masks and scores are image-processing heuristics;
they do not diagnose cancer, count individual cells, or establish image quality.
## Installation
Histolab 0.7.0 remains the latest published release as of the review date. Its
[release constraints](https://github.com/histolab/histolab/blob/v0.7.0/pyproject.toml)
require Python <3.12, NumPy <=1.24.4, scikit-image <0.19.4, SciPy <1.10.1,
Pillow <11, and openslide-python 1.3.1. Keep this stack isolated from modern
scientific environments. Windows is not supported by this Histolab release.
Install [native OpenSlide](https://openslide.org/download/) for your system,
then create a dedicated environment (Python 3.10 was tested):
```bash
uv venv --python 3.10 .venv-histolab
uv pip install --python .venv-histolab/bin/python 'histolab==0.7.0' pooch matplotlib
.venv-histolab/bin/python -c 'import openslide; print(openslide.__library_version__)'
```
On macOS with Homebrew, `brew install openslide` installs the native library.
If the older Python binding cannot find it, launch Python with the library path
set immediately before Python starts:
```bash
env DYLD_FALLBACK_LIBRARY_PATH="$(brew --prefix openslide)/lib" .venv-histolab/bin/python -c 'import openslide; print(openslide.__library_version__)'
```
`pooch` is optional for remote examples. Start with a local slide or the tiny
bundled `cmu_small_region` sample; other sample functions may download hundreds
of megabytes. Exact `mpp` extraction also needs `large-image` and a matching
source plugin; see [slide management](references/slide_management.md).
## Workflow
1. Inspect `slide.dimensions`, `slide.levels` (a list), and
`slide.level_dimensions(level)` (a method). Check both MPP axes in metadata.
2. Select physical field of view and pixel resolution; level numbers are not
interchangeable across scanners. Preserve level-0 coordinate bounds.
3. Choose `TissueMask` for all tissue sections or `BiggestTissueBoxMask` for the
largest section's bounding box. Inspect the mask at its actual resolution.
4. Configure a tiler and preview with the **same mask** passed to extraction.
Preview methods return a Pillow image; save or display that return value.
5. Extract into a distinct per-slide/per-strategy directory. Count saved files,
inspect representative tiles, and retain parameters, source IDs and QC flags.
6. Split datasets by patient before training/validation/test tile assignment.
Fit stain normalization targets on training data only and validate on held-out
scanners. A seed reproduces sampling; it does not prevent patient leakage.
## Quick start
Illustrative for a user-provided slide; the same API path is tested with small
local fixtures. `n_tiles` is an upper bound, not a promise of 100 valid tiles.
```python
from pathlib import Path
from histolab.slide import Slide
from histolab.masks import TissueMask
from histolab.tiler import RandomTiler
output = Path("output/random_tiles")
output.mkdir(parents=True, exist_ok=True)
slide = Slide("slide.svs", processed_path=output)
mask = TissueMask()
slide.locate_mask(mask).save(output / "mask_preview.png")
tiler = RandomTiler(
tile_size=(512, 512), n_tiles=100, level=0, seed=42,
check_tissue=True, tissue_percent=80.0, prefix="random_",
)
tiler.locate_tiles(slide, extraction_mask=mask).save(output / "tile_preview.png")
tiler.extract(slide, extraction_mask=mask)
print("[OK] Saved tiles:", len(list(output.glob("random_tile_*.png"))))
```
`extraction_mask` belongs to `extract()` and `locate_tiles()`, not to the tiler
constructor. `locate_tiles()` has no `n_tiles` argument. Previewing runs tile
selection again, so it may be expensive; use a separate small tiler for initial
exploration, then preview the final configuration before committing a large run.
## Choose a strategy
| Tiler | Selection | Important limitation |
| --- | --- | --- |
| `RandomTiler` | Seeded sampling, at most `n_tiles`, up to `max_iter` attempts | May overlap, repeat, or miss rare structures |
| `GridTiler` | Grid within the extraction mask | Boundary tiles and tissue checks can leave gaps |
| `ScoreTiler` | Scores all eligible grid candidates; saves top `n_tiles` | Lower output count does not avoid scoring all candidates |
For grids, stride in each axis is tile size minus `pixel_overlap`; positive
values must be smaller than both tile dimensions. Negative overlap leaves gaps.
`ScoreTiler(n_tiles=0)` saves all eligible ranked tiles.
Nuclei and cellularity scores estimate stain-derived area fractions. They are
not calibrated tumor probabilities or blur/focus scores. Score reports contain
exactly `filename,score,scaled_score`; record coordinate bounds and physical
resolution separately. Equal raw scores can make `scaled_score` undefined in
0.7.0, so inspect raw scores and finiteness before plotting or comparing them.
## Troubleshooting and scientific checks
- **No/few tiles:** inspect mask and output counts, dimensions, level, and
`max_iter`. Lowering `tissue_percent` relaxes QC; validate the added tiles.
- **Missing sections:** the default biggest-region box excludes other sections.
Pass `TissueMask()` explicitly to both preview and extraction.
- **Slow extraction:** benchmark valid coarser levels (larger level numbers).
Higher tissue thresholds can increase random rejections; ScoreTiler still
examines the full candidate grid. Avoid assuming lower output count is faster.
- **Mask/thumbnail mismatch:** 0.7.0 selects the larger of the thumbnail and
1/32-scale image for slide masks. Resize categorical masks with nearest-neighbor
interpolation when overlaying them; never reinterpret mask pixels as level 0.
- **Normalization artifacts:** inspect target/source tissue coverage and finite
output. Near-constant or blank tiles can make stain estimates degenerate.
HED channel scaling alone is not a validated RGB stain normalization method.
- **Across-scale alignment:** the same random seed at different levels doesFrom K-Dense-AI/scientific-agent-skills, MIT.
More from K-Dense-AI/scientific-agent-skills
- 0.699score
13c-metabolic-flux
K-Dense-AI
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps, mfapy isotope simulation…
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
adaptyv
K-Dense-AI
Uses the Adaptyv Bio Foundry API and Python SDK to design protein characterization experiments, estimate costs, submit sequences, monitor laboratory progress…
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
exploratory-data-analysis
K-Dense-AI
Performs bounded, local exploratory analysis of explicitly supported scientific files.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
openpiv
K-Dense-AI
Performs Particle Image Velocimetry (PIV) analysis with OpenPIV.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
citation-management
K-Dense-AI
Comprehensive citation management for academic research.
SkillAFreshness: A★ 54.4KClaude Code - 0.699score
parallel-web
K-Dense-AI
Uses Parallel CLI for web search, URL extraction, deep research, structured data enrichment, entity discovery, and recurring web monitoring.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
scientific-schematics
K-Dense-AI
Generates scientific diagram drafts using Nano Banana 2 AI with smart iterative refinement.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
glycoengineering
K-Dense-AI
Analyzes and engineers protein glycosylation by scanning canonical N-glycosylation sequons, describing S/T-rich regions, checking curated glycan evidence, and…
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
venue-templates
K-Dense-AI
Prepares journal manuscripts, conference papers, research posters, and grant documents using venue-specific formatting guidance and bundled LaTeX scaffolds.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
uncertainty-and-units
K-Dense-AI
Tracks physical units and propagates measurement uncertainty in scientific calculations using pint and uncertainties.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
ginkgo-cloud-lab
K-Dense-AI
Guides protocol selection, input preparation, pricing checks, and browser ordering on Ginkgo Bioworks Cloud Lab (cloud.ginkgo.bio).
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
alphagenome
K-Dense-AI
Looks up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and…
SkillAFreshness: A★ 54.4KClaude Code +9
Signals
- Stars
- 54,411
- Forks
- 4,797
- Open issues
- 8
- Last commit (this folder)
- Oct 1, 2026 (27 days ago)
- Last release
- Oct 1, 2026 (27 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.5
- License
- MIT
- Website
- arxiv.org/abs/2609.00065
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from K-Dense-AI
- 0.699score
exploratory-data-analysis
K-Dense-AI
Performs bounded, local exploratory analysis of explicitly supported scientific files.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
citation-management
K-Dense-AI
Comprehensive citation management for academic research.
SkillAFreshness: A★ 54.4KClaude Code - 0.699score
glycoengineering
K-Dense-AI
Analyzes and engineers protein glycosylation by scanning canonical N-glycosylation sequons, describing S/T-rich regions, checking curated glycan evidence, and…
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
openpiv
K-Dense-AI
Performs Particle Image Velocimetry (PIV) analysis with OpenPIV.
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
ginkgo-cloud-lab
K-Dense-AI
Guides protocol selection, input preparation, pricing checks, and browser ordering on Ginkgo Bioworks Cloud Lab (cloud.ginkgo.bio).
SkillAFreshness: A★ 54.4KClaude Code +9 - 0.699score
parallel-web
K-Dense-AI
Uses Parallel CLI for web search, URL extraction, deep research, structured data enrichment, entity discovery, and recurring web monitoring.
SkillAFreshness: A★ 54.4KClaude Code +9
Cite this page
histolab skill. Agent Mart. https://agentmart.dev/skills/k-dense-ai-histolab (last updated 2026-10-24)