histolab
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.
npx skills add LeonChaoX/qinyan-academic-skills --skill histolab --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Histolab is a Python library that automates tissue detection, tile extraction, and dataset preparation from whole slide images (WSI). It supports loading WSIs in various formats, generating thumbnails, and extracting tiles using RandomTiler, GridTiler, or ScoreTiler. It also provides tissue masking (TissueMask, BiggestTissueBoxMask, custom BinaryMask), a suite of image filters and preprocessing steps, and visualization utilities for masks, tile locations, and extracted tiles. The library is positioned for simple pipelines and quick tile-based analysis, with guidance for more advanced workflows via related modules.
How it works
- Load and manage WSIs using the Slide class, inspect properties and metadata, and generate thumbnails.
- Detect tissue automatically to create masks (TissueMask, BiggestTissueBoxMask, or custom BinaryMask).
- Configure tile extraction with one of three strategies:
- RandomTiler: sample a fixed number of random tiles (parameters include tile_size, n_tiles, level, seed, check_tissue, tissue_percent).
- GridTiler: systematic grid-based tiles (tile_size, level, pixel_overlap, check_tissue, tissue_percent).
- ScoreTiler: select top tiles by a scorer (e.g., NucleiScorer) (parameters include tile_size, n_tiles, level, scorer, check_tissue).
- Apply preprocessing filters (image and morphological) and compose pipelines for custom tissue detection and mask creation.
- Preview tile locations and masks with locate_tiles and locate_mask, then extract tiles and optionally produce reports.
- Visualize slides, masks, and tiles, and manage multi-slide workflows.
When to use it
- Use for lightweight WSI tile extraction and basic slide processing, tissue detection, and dataset preparation.
- Use RandomTiler for exploratory sampling, GridTiler for complete tissue coverage, or ScoreTiler for information-rich tiles.
- Use custom TissueMask pipelines when artifacts or unusual staining require specialized masking.
What it can touch
- Tiles and slides via the Slide, RandomTiler, GridTiler, ScoreTiler, and TissueMask interfaces.
- Masks and pre-processing pipelines via TissueMask, BinaryMask, Compose, RgbToGrayscale, OtsuThreshold, BinaryDilation, RemoveSmallHoles, RemoveSmallObjects, etc.
- Visualization and reports through locate_mask, locate_tiles, and optional report_path parameters.
Caveats
- License information indicates Apache-2.0, with frontmatter listing MIT in repository metadata; implementers should verify compatibility.
- Best suited for simple pipelines; for advanced spatial proteomics, multiplexed imaging, or deep learning pipelines, PathML is recommended.
# 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 ```bash uv pip install histolab ``` ## Quick Start Basic workflow for extracting tiles from a whole slide image: ```python 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 ### 1. Slide Management Load, inspect, and work with whole slide images in various formats. **Common operations:** - Loading WSI files (SVS, TIFF, NDPI, etc.) - Accessing slide metadata (dimensions, magnification, properties) - Generating thumbnails for visualization - Working with pyramidal image structures - Extractin
- Overview
- Installation
- Quick Start
- Core Capabilities
- 1. Slide Management
- 2. Tissue Detection and Masks
- 3. Tile Extraction
- 4. Filters and Preprocessing
- 5. Visualization
- Typical Workflows
- Workflow 1: Exploratory Tile Extraction
- Workflow 2: Comprehensive Grid Extraction
- Workflow 3: Quality-Driven Tile Selection
- Workflow 4: Multi-Slide Processing Pipeline
uv pip install histolab
What does the histolab skill do?
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.
How do I install it?
Run `npx skills add LeonChaoX/qinyan-academic-skills --skill histolab --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From LeonChaoX/qinyan-academic-skills, a repository with 759 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
