histolab
Extracts tiles and preprocesses H&E whole slide images with the histolab Python library (OpenSlide), covering slide inspection, tissue masks (TissueMask…
от hashgraph-online★ 1 640 звёзд на GitHub
Установить histolab в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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.
Installation
Install OpenSlide system libraries first (OpenSlide download), then install histolab:
uv pip install histolab
For built-in TCGA sample slides via histolab.data, also install pooch:
uv pip install pooch
Histolab 0.7.0 (latest stable) supports Python 3.8–3.11 on Linux and macOS. Windows is not supported as of 0.7.0.
Quick Start
Basic workflow for extracting tiles from a whole slide image:
from histolab.slide import Slide
from histolab.tiler import RandomTiler
# Load slide
slide = Slide("slide.svs", processed_path="output/")
# Configure tiler
tiler = RandomTiler(
tile_size=(512, 512),
n_tiles=100,
level=0,
seed=42
)
# Preview tile locations
tiler.locate_tiles(slide, n_tiles=20)
# Extract tiles
tiler.extract(slide)
Core Capabilities
Six capability areas, each with worked code, are documented in references/core_capabilities.md:
- Slide management — opening slides, properties, levels, thumbnails, and scaled images.
- Tissue detection and masks —
TissueMaskandBiggestTissueBoxMask, and custom masks. - Tile extraction — random, grid, and score-based tilers with size, level, and tissue-fraction control.
- Filters and preprocessing — image and morphological filters, and composing them.
- Stain normalization — Reinhard and Macenko normalization against a target image.
- Visualization — locating tiles on the slide and inspecting masks and extractions.
Five end-to-end workflows are in references/typical_workflows.md. Per-topic detail lives in references/slide_management.md, references/tissue_masks.md, references/tile_extraction.md, references/filters_preprocessing.md, and references/visualization.md.
Best Practices
Slide Loading and Inspection
- Always inspect slide properties before processing
- Save thumbnails with
slide.thumbnail.save()for quick visual review - Check pyramid levels and dimensions
- Verify tissue is present using thumbnails
Tissue Detection
- Preview masks with
locate_mask()before extraction - Use
TissueMaskfor multiple sections,BiggestTissueBoxMaskfor single sections - Customize filters for specific stains (H&E vs IHC)
- Handle pen annotations with custom masks
- Test masks on diverse slides
Tile Extraction
- Always preview with
locate_tiles()before extracting - Choose appropriate tiler:
- RandomTiler: Sampling and exploration
- GridTiler: Complete coverage
- ScoreTiler: Quality-driven selection
- Set appropriate
tissue_percentthreshold (70-90% typical) - Use seeds for reproducibility in RandomTiler
- Extract at appropriate pyramid level for analysis resolution
- Enable logging for large datasets
Performance
- Extract at lower levels (1, 2) for faster processing
- Use
BiggestTissueBoxMaskoverTissueMaskwhen appropriate - Adjust
tissue_percentto reduce invalid tile attempts - Limit
n_tilesfor initial exploration - Use
pixel_overlap=0for non-overlapping grids
Quality Control
- Validate tile quality (check for blur, artifacts, focus)
- Review score distributions for ScoreTiler
- Inspect top and bottom scoring tiles
- Monitor tissue coverage statistics
- Filter extracted tiles by additional quality metrics if needed
Common Use Cases
Training Deep Learning Models
- Extract balanced datasets using RandomTiler across multiple slides
- Use ScoreTiler with NucleiScorer to focus on cell-rich regions
- Extract at consistent resolution (level 0 or level 1)
- Generate CSV reports for tracking tile metadata
Whole Slide Analysis
- Use GridTiler for complete tissue coverage
- Extract at multiple pyramid levels for hierarchical analysis
- Maintain spatial relationships with grid positions
- Use
pixel_overlapfor sliding window approaches
Tissue Characterization
- Sample diverse regions with RandomTiler
- Quantify tissue coverage with masks
- Extract stain-specific information with HED decomposition
- Compare tissue patterns across slides
Quality Assessment
- Identify optimal focus regions with ScoreTiler
- Detect artifacts using custom masks and filters
- Assess staining quality across slide collection
- Flag problematic slides for manual review
Dataset Curation
- Use ScoreTiler to prioritize informative tiles
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/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
FAQ
Что делает скилл histolab?
Extracts tiles and preprocesses H&E whole slide images with the histolab Python library (OpenSlide), covering slide inspection, tissue masks (TissueMask, BiggestTissueBoxMask), RandomTiler, GridTiler and ScoreTiler extraction, image and morphological filters, and Macenko or Reinhard stain normalization. Use when building a tile dataset from WSI files for deep learning. Use when detecting tissue and excluding background or pen annotations. Use when previewing tile locations and exporting tile CSV reports. Use when normalizing stain variation across slides. Not for spatial proteomics, multiplexed imaging, or deep learning pipelines; use pathml for those.
Как установить скилл histolab?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл histolab запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…