scientific-skills/Data Analysis/histolab/SKILL.md
Lightweight Whole Slide Image (WSI) tiling and preprocessing for digital pathology; use when you need fast tissue detection and tile extraction to prepare datasets or run quick tile-based analysis.
npx skillsauth add aipoch/medical-research-skills histolabInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Note: For advanced multiplex/spatial workflows or complex deep learning pipelines, consider more specialized frameworks (e.g., PathML).
Slide: load WSI formats (SVS, TIFF, NDPI, etc.), access metadata, thumbnails, pyramid levels, and regions.TissueMask, BiggestTissueBoxMask, and custom BinaryMask implementations.RandomTiler (random sampling with reproducible seeds)GridTiler (systematic coverage with optional overlap)ScoreTiler (top-N tiles by a scoring function such as nuclei density)Compose.locate_mask) and tile locations (locate_tiles) and to review extracted tiles.Reference docs (optional, for deeper detail):
references/slide_management.mdreferences/tissue_masks.mdreferences/tile_extraction.mdreferences/filters_preprocessing.mdreferences/visualization.mdhistolab (install via pip/uv; version depends on your environment)Installation:
uv pip install histolab
A complete, runnable example that loads a slide, builds a tissue mask, previews tile locations, and extracts tiles.
from pathlib import Path
from histolab.slide import Slide
from histolab.masks import TissueMask
from histolab.tiler import RandomTiler
def main():
slide_path = "slide.svs" # replace with your WSI path
out_dir = Path("output")
out_dir.mkdir(parents=True, exist_ok=True)
# 1) Load slide
slide = Slide(slide_path, processed_path=str(out_dir))
# 2) Build/preview tissue mask
tissue_mask = TissueMask()
slide.locate_mask(tissue_mask) # writes a visualization into processed_path
# 3) Configure tiler
tiler = RandomTiler(
tile_size=(512, 512),
n_tiles=100,
level=0,
seed=42,
check_tissue=True,
tissue_percent=80.0,
)
# 4) Preview tile locations (recommended before extraction)
tiler.locate_tiles(slide, n_tiles=20)
# 5) Extract tiles (restricted to tissue mask)
tiler.extract(slide, extraction_mask=tissue_mask)
print("Done. Check the output directory for thumbnails, mask previews, and tiles.")
if __name__ == "__main__":
main()
level=0 usually means highest resolution (slowest, largest output).level=1 or level=2 can significantly improve throughput for dataset prototyping.TissueMask generally segments all tissue regions (useful when multiple fragments exist).BiggestTissueBoxMask focuses on the largest tissue region (often faster and cleaner for single-section slides).references/tissue_masks.md and references/filters_preprocessing.md).tile_size=(w, h): output tile dimensions in pixels at the chosen pyramid level.check_tissue=True: enables tissue-content filtering.tissue_percent: minimum tissue coverage required for a tile to be accepted (commonly 70–90).extraction_mask: restricts candidate tile locations to a mask-defined ROI.n_tiles: number of tiles to sample.seed: ensures reproducibility across runs.pixel_overlap: overlap between adjacent tiles (0 for non-overlapping grids).scorer: ranks tiles (e.g., NucleiScorer) and selects top tiles.report_path) for auditability.Compose to build repeatable pipelines (e.g., grayscale → threshold → morphology).For concrete filter recipes and parameter guidance, see references/filters_preprocessing.md.
tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.