Lightweight WSI tile extraction and preprocessing. Use for basic slide processing, tissue detection, tile extraction, and stain normalization for H&E images. Best for simple pipelines, dataset preparation, and quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill histolab
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.
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.
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)
Six capability areas, each with worked code, are documented in
references/core_capabilities.md:
TissueMask and BiggestTissueBoxMask, and custom masks.tissue-fraction control.
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.
slide.thumbnail.save() for quick visual reviewlocate_mask() before extractionTissueMask for multiple sections, BiggestTissueBoxMask for single sectionslocate_tiles() before extractingtissue_percent threshold (70-90% typical)BiggestTissueBoxMask over TissueMask when appropriatetissue_percent to reduce invalid tile attemptsn_tiles for initial explorationpixel_overlap=0 for non-overlapping gridspixel_overlap for sliding window approachestissue_percent thresholdcheck_tissue=Truetissue_percent thresholdn_tiles for RandomTiler/ScoreTilerMacenkoStainNormalizer or ReinhardStainNormalizertissue_percent per staining qualityThis skill includes detailed reference documentation in the references/ directory:
Comprehensive guide to loading, inspecting, and working with whole slide images:
Complete documentation on tissue detection and masking:
Detailed explanation of tile extraction strategies:
Complete filter reference and preprocessing guide:
Comprehensive visualization guide:
Usage pattern: Reference files contain in-depth information to support workflows described in this main skill document. Load specific reference files as needed for detailed implementation guidance, troubleshooting, or advanced features.
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
Digital pathology image processing toolkit for whole slide images (WSI). Use this skill when working with histopathology slides, processing H&E or IHC stained tissue images, extracting tiles from gigapixel pathology images, detecting tissue regions, segmenting tissue masks, or preparing datasets for computational pathology deep learning pipelines. Applies to WSI formats (SVS, TIFF, NDPI), tile-based analysis, and histological image preprocessing workflows.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
Computational pathology toolkit for analyzing whole-slide images (WSI) and multiparametric imaging data. Use this skill when working with histopathology slides, H&E stained images, multiplex immunofluorescence (CODEX, Vectra), spatial proteomics, nucleus detection/segmentation, tissue graph construction, or training ML models on pathology data. Supports 160+ slide formats including Aperio SVS, NDPI, DICOM, OME-TIFF for digital pathology workflows.
DL cell/nucleus segmentation for fluorescence and brightfield microscopy. Pre-trained models (cyto3, nuclei, tissuenet) and a generalist flow-based algorithm segment cells without retraining. Outputs label masks for morphology and tracking. Use scikit-image watershed for rule-based; Cellpose when DL generalization across staining is needed.
Take k-dense-ai/histolab from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, uv.
Without those the skill loads but fails at the first command.