[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73GVMAKMR9B66AT8VR5C21N":3,"skill-same:01M73GVMAKMR9B66AT8VR5C21N":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73GVMAKMR9B66AT8VR5C21N","histolab-wsi-processing",null,"WSI processing for digital pathology. Tissue detection, tile extraction (random, grid, score-based), filter pipelines for H&E\u002FIHC. For dataset prep, tile-based DL, slide QC. Use pathml for multiplexed imaging.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fhistolab-wsi-processing\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"histolab-wsi-processing\"\ndescription: \"WSI processing for digital pathology. Tissue detection, tile extraction (random, grid, score-based), filter pipelines for H&E\u002FIHC. For dataset prep, tile-based DL, slide QC. Use pathml for multiplexed imaging.\"\nlicense: Apache-2.0\n---\n\n# Histolab WSI Processing\n\n## Overview\n\nHistolab is a Python library for processing whole slide images (WSI) in digital pathology. It automates tissue detection, extracts informative tiles from gigapixel images using multiple strategies, and provides composable filter pipelines for preprocessing. The library handles SVS, TIFF, NDPI, and other WSI formats via OpenSlide.\n\n## When to Use\n\n- Extracting tiles from whole slide images for deep learning model training\n- Detecting tissue regions and filtering background\u002Fartifacts in histopathology slides\n- Building preprocessing pipelines for H&E or IHC stained tissue sections\n- Creating quality-driven tile datasets ranked by nuclei density or cellularity\n- Performing batch tile extraction across slide collections with consistent parameters\n- Assessing slide quality and tissue coverage before computational pathology workflows\n- For raw slide access without tile extraction, use `openslide-python` directly\n- For complex multiplexed imaging or spatial proteomics pipelines, use `pathml` instead\n\n## Prerequisites\n\n- **Python packages**: `histolab` (includes OpenSlide Python bindings)\n- **System dependency**: OpenSlide C library must be installed separately\n- **Supported formats**: SVS, TIFF, NDPI, VMS, SCN, MRXS (via OpenSlide)\n\n```bash\n# macOS\nbrew install openslide\npip install histolab\n\n# Ubuntu\u002FDebian\nsudo apt-get install openslide-tools\npip install histolab\n```\n\n## Quick Start\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.tiler import RandomTiler\n\n# Load slide\nslide = Slide(\"slide.svs\", processed_path=\"output\u002F\")\nprint(f\"Dimensions: {slide.dimensions}, Levels: {slide.levels}\")\n\n# Configure tiler\ntiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=100, level=0, seed=42,\n    check_tissue=True, tissue_percent=80.0\n)\n\n# Preview and extract\ntiler.locate_tiles(slide, n_tiles=20)\ntiler.extract(slide)\n```\n\n## Core API\n\n### Module 1: Slide Management\n\nThe `Slide` class is the primary interface for loading and inspecting WSI files.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.data import prostate_tissue\n\n# Load from built-in sample data (prostate, ovarian, breast, heart, kidney)\nprostate_svs, prostate_path = prostate_tissue()\nslide = Slide(prostate_path, processed_path=\"output\u002F\")\n\n# Inspect properties\nprint(f\"Dimensions: {slide.dimensions}\")       # (width, height) at level 0\nprint(f\"Levels: {slide.levels}\")               # Number of pyramid levels\nprint(f\"Level dims: {slide.level_dimensions}\") # Dimensions per level\nprint(f\"Magnification: {slide.properties.get('openslide.objective-power', 'N\u002FA')}\")\nprint(f\"MPP-X: {slide.properties.get('openslide.mpp-x', 'N\u002FA')}\")\n\n# Thumbnail and scaled image\nslide.save_thumbnail()  # Saves to processed_path\nscaled = slide.scaled_image(scale_factor=32)\n\n# Extract region at specific coordinates\nregion = slide.extract_region(location=(1000, 2000), size=(512, 512), level=0)\n```\n\n### Module 2: Tissue Detection\n\nMask classes identify tissue regions and filter background for tile extraction.\n\n```python\nfrom histolab.masks import TissueMask, BiggestTissueBoxMask, BinaryMask\nimport numpy as np\n\n# TissueMask: segments ALL tissue regions (multiple sections)\ntissue_mask = TissueMask()\nmask_array = tissue_mask(slide)  # Binary NumPy array: True=tissue, False=background\nprint(f\"Tissue coverage: {mask_array.sum() \u002F mask_array.size * 100:.1f}%\")\n\n# BiggestTissueBoxMask: bounding box of largest tissue region (default)\nbiggest_mask = BiggestTissueBoxMask()\n\n# Visualize mask on slide thumbnail\nslide.locate_mask(tissue_mask)\n\n# Custom mask via BinaryMask subclass\nclass RectangularROI(BinaryMask):\n    def __init__(self, x, y, w, h):\n        self.x, self.y, self.w, self.h = x, y, w, h\n\n    def _mask(self, slide):\n        thumb = slide.thumbnail\n        mask = np.zeros(thumb.shape[:2], dtype=bool)\n        mask[self.y:self.y+self.h, self.x:self.x+self.w] = True\n        return mask\n```\n\n### Module 3: Tile Extraction\n\nThree strategies for extracting tiles: random sampling, grid coverage, and score-based selection.\n\n```python\nfrom histolab.tiler import RandomTiler, GridTiler, ScoreTiler\nfrom histolab.scorer import NucleiScorer\nfrom histolab.masks import TissueMask\n\n# RandomTiler: fixed number of randomly positioned tiles\nrandom_tiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=100, level=0,\n    seed=42, check_tissue=True, tissue_percent=80.0\n)\nrandom_tiler.locate_tiles(slide, n_tiles=20)  # Preview first\nrandom_tiler.extract(slide)\n\n# GridTiler: systematic grid coverage\ngrid_tiler = GridTiler(\n    tile_size=(512, 512), level=0,\n    pixel_overlap=0, check_tissue=True, tissue_percent=70.0\n)\ngrid_tiler.extract(slide, extraction_mask=TissueMask())\n\n# ScoreTiler: top-ranked tiles by scoring function\nscore_tiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=50, level=0,\n    scorer=NucleiScorer(), check_tissue=True\n)\nscore_tiler.extract(slide, report_path=\"tiles_report.csv\")\n# Report CSV: tile_name, x_coord, y_coord, level, score, tissue_percent\n```\n\n### Module 4: Filters and Preprocessing\n\nComposable image and morphological filters for tissue detection and preprocessing.\n\n```python\nfrom histolab.filters.image_filters import (\n    RgbToGrayscale, RgbToHsv, RgbToHed,\n    OtsuThreshold, AdaptiveThreshold,\n    StretchContrast, HistogramEqualization, Invert\n)\nfrom histolab.filters.morphological_filters import (\n    BinaryDilation, BinaryErosion, BinaryOpening, BinaryClosing,\n    RemoveSmallObjects, RemoveSmallHoles\n)\nfrom histolab.filters.compositions import Compose\n\n# Standard tissue detection pipeline\ntissue_pipeline = Compose([\n    RgbToGrayscale(),\n    OtsuThreshold(),\n    BinaryDilation(disk_size=5),\n    RemoveSmallHoles(area_threshold=1000),\n    RemoveSmallObjects(area_threshold=500)\n])\n\n# Use custom pipeline with TissueMask\nfrom histolab.masks import TissueMask\ncustom_mask = TissueMask(filters=tissue_pipeline)\n\n# Stain deconvolution (H&E)\nhed_filter = RgbToHed()  # Hematoxylin-Eosin-DAB separation\n```\n\n```python\n# Apply filters to individual tiles\nfrom histolab.tile import Tile\n\nfilter_chain = Compose([RgbToGrayscale(), StretchContrast()])\nfiltered_tile = tile.apply_filters(filter_chain)\n\n# Lambda for custom inline filters\nfrom histolab.filters.image_filters import Lambda\nimport numpy as np\n\nbrightness = Lambda(lambda img: np.clip(img * 1.2, 0, 255).astype(np.uint8))\nred_channel = Lambda(lambda img: img[:, :, 0])\n```\n\n### Module 5: Scoring\n\nScorers rank tiles by tissue content quality for use with ScoreTiler.\n\n```python\nfrom histolab.scorer import NucleiScorer, CellularityScorer, Scorer\nimport numpy as np\n\n# Built-in scorers\nnuclei = NucleiScorer()       # Scores by nuclei density (grayscale threshold + count)\ncellularity = CellularityScorer()  # Scores by overall cellular content\n\n# Custom scorer\nclass ColorVarianceScorer(Scorer):\n    def __call__(self, tile):\n        \"\"\"Score tiles by color variance (higher = more informative).\"\"\"\n        tile_array = np.array(tile.image)\n        return np.var(tile_array, axis=(0, 1)).sum()\n\nscore_tiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=30,\n    scorer=ColorVarianceScorer()\n)\n```\n\n### Module 6: Visualization\n\nBuilt-in methods and matplotlib patterns for inspecting slides, masks, and tiles.\n\n```python\nimport matplotlib.pyplot as plt\nfrom histolab.masks import TissueMask\n\n# Built-in: mask overlay on slide thumbnail\nslide.locate_mask(TissueMask())\n\n# Built-in: tile location preview\ntiler.locate_tiles(slide, n_tiles=20)\n\n# Manual side-by-side: slide vs mask\nmask = TissueMask()\nmask_array = mask(slide)\nfig, axes = plt.subplots(1, 2, figsize=(15, 7))\naxes[0].imshow(slide.thumbnail); axes[0].set_title(\"Slide\"); axes[0].axis('off')\naxes[1].imshow(mask_array, cmap='gray'); axes[1].set_title(\"Mask\"); axes[1].axis('off')\nplt.tight_layout()\nplt.show()\n\n# Display extracted tiles in grid\nfrom pathlib import Path\nfrom PIL import Image\ntile_paths = list(Path(\"output\u002Ftiles\u002F\").glob(\"*.png\"))[:16]\nfig, axes = plt.subplots(4, 4, figsize=(12, 12))\nfor idx, tp in enumerate(axes.ravel()):\n    if idx \u003C len(tile_paths):\n        tp.imshow(Image.open(tile_paths[idx]))\n        tp.set_title(tile_paths[idx].stem, fontsize=8)\n    tp.axis('off')\nplt.tight_layout()\nplt.show()\n```\n\n## Key Concepts\n\n### WSI Pyramid Levels\n\nWhole slide images use a pyramidal structure with multiple resolution levels. Level 0 is the highest resolution (native scan). Higher levels provide progressively lower resolutions for faster access.\n\n```python\nfor level in range(slide.levels):\n    dims = slide.level_dimensions[level]\n    downsample = slide.level_downsamples[level]\n    print(f\"Level {level}: {dims}, downsample: {downsample:.0f}x\")\n# Level 0: (98304, 221184), downsample: 1x\n# Level 1: (24576, 55296), downsample: 4x\n```\n\n### Filter Composition Pattern\n\nFilters are designed to be chained via `Compose`. The output of one filter becomes the input of the next. Image filters operate on RGB\u002Fgrayscale arrays; morphological filters operate on binary arrays. Order matters: always convert to the expected input type before applying downstream filters.\n\n### Mask-Tiler Integration\n\nAll tilers accept an `extraction_mask` parameter. The default is `BiggestTissueBoxMask()`. Override with `TissueMask()` for multi-section slides or a custom `BinaryMask` subclass for ROI-specific extraction.\n\n## Common Workflows\n\n### Workflow 1: Exploratory Slide Analysis\n\n**Goal**: Quickly inspect a slide, detect tissue, and sample diverse regions for review.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.tiler import RandomTiler\nfrom histolab.masks import TissueMask\nimport matplotlib.pyplot as plt\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nslide = Slide(\"slide.svs\", processed_path=\"output\u002Fexploratory\u002F\")\nprint(f\"Dimensions: {slide.dimensions}, Levels: {slide.levels}\")\nslide.save_thumbnail()\n\n# Visualize tissue detection\ntissue_mask = TissueMask()\nslide.locate_mask(tissue_mask)\nmask_arr = tissue_mask(slide)\nprint(f\"Tissue coverage: {mask_arr.sum() \u002F mask_arr.size * 100:.1f}%\")\n\n# Sample tiles\ntiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=50, level=0,\n    seed=42, check_tissue=True, tissue_percent=80.0\n)\ntiler.locate_tiles(slide, n_tiles=20)\ntiler.extract(slide)\n```\n\n### Workflow 2: Deep Learning Dataset Preparation\n\n**Goal**: Build a quality-controlled tile dataset from multiple slides for model training.\n\n```python\nfrom pathlib import Path\nfrom histolab.slide import Slide\nfrom histolab.tiler import ScoreTiler\nfrom histolab.scorer import NucleiScorer\nimport pandas as pd\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nslide_dir = Path(\"slides\u002F\")\noutput_base = Path(\"output\u002Fdataset\u002F\")\nall_reports = []\n\ntiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=100, level=0,\n    scorer=NucleiScorer(), check_tissue=True, tissue_percent=80.0\n)\n\nfor slide_path in sorted(slide_dir.glob(\"*.svs\")):\n    out_dir = output_base \u002F slide_path.stem\n    out_dir.mkdir(parents=True, exist_ok=True)\n    slide = Slide(str(slide_path), processed_path=str(out_dir))\n    slide.save_thumbnail()\n    report_path = str(out_dir \u002F \"report.csv\")\n    tiler.extract(slide, report_path=report_path)\n    df = pd.read_csv(report_path)\n    df[\"slide\"] = slide_path.stem\n    all_reports.append(df)\n    print(f\"{slide_path.stem}: {len(df)} tiles, mean score {df['score'].mean():.3f}\")\n\ncombined = pd.concat(all_reports, ignore_index=True)\ncombined.to_csv(output_base \u002F \"dataset_manifest.csv\", index=False)\nprint(f\"Total: {len(combined)} tiles from {len(all_reports)} slides\")\n```\n\n### Workflow 3: Custom Tissue Detection with Artifact Removal\n\n**Goal**: Handle slides with pen annotations or unusual staining using custom filter pipelines.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.masks import TissueMask\nfrom histolab.tiler import GridTiler\nfrom histolab.filters.compositions import Compose\nfrom histolab.filters.image_filters import RgbToGrayscale, OtsuThreshold\nfrom histolab.filters.morphological_filters import (\n    BinaryDilation, RemoveSmallObjects, RemoveSmallHoles\n)\n\n# Aggressive artifact removal pipeline\naggressive_filters = Compose([\n    RgbToGrayscale(),\n    OtsuThreshold(),\n    BinaryDilation(disk_size=10),\n    RemoveSmallHoles(area_threshold=5000),\n    RemoveSmallObjects(area_threshold=3000)\n])\n\ncustom_mask = TissueMask(filters=aggressive_filters)\nslide = Slide(\"artifact_slide.svs\", processed_path=\"output\u002Fclean\u002F\")\n\n# Compare default vs custom mask\nslide.locate_mask(TissueMask())     # Default\nslide.locate_mask(custom_mask)      # Custom (tighter)\n\n# Extract with custom mask\ngrid_tiler = GridTiler(\n    tile_size=(512, 512), level=1,\n    check_tissue=True, tissue_percent=70.0\n)\ngrid_tiler.extract(slide, extraction_mask=custom_mask)\n```\n\n## Key Parameters\n\n| Parameter | Module | Default | Range \u002F Options | Effect |\n|-----------|--------|---------|-----------------|--------|\n| `tile_size` | All Tilers | `(512, 512)` | Any `(w, h)` tuple | Tile dimensions in pixels |\n| `level` | All Tilers | `0` | `0` to `slide.levels-1` | Pyramid level (0=highest resolution) |\n| `check_tissue` | All Tilers | `True` | `True`\u002F`False` | Filter tiles by tissue content |\n| `tissue_percent` | All Tilers | `80.0` | `0.0`-`100.0` | Minimum tissue coverage threshold |\n| `n_tiles` | Random\u002FScoreTiler | varies | Any positive int | Number of tiles to extract |\n| `seed` | RandomTiler | `None` | Any int | Random seed for reproducibility |\n| `pixel_overlap` | GridTiler | `0` | `0`+ | Overlap between adjacent tiles in pixels |\n| `scorer` | ScoreTiler | required | `NucleiScorer()`, `CellularityScorer()`, custom | Scoring function for tile ranking |\n| `extraction_mask` | All Tilers | `BiggestTissueBoxMask()` | Any `BinaryMask` | Mask defining valid extraction region |\n| `disk_size` | Morphological filters | `5` | `1`-`20` | Structuring element size |\n| `area_threshold` | RemoveSmall* | `500`\u002F`1000` | `0`+ | Minimum area for objects\u002Fholes in pixels |\n\n## Best Practices\n\n1. **Always preview before extracting**: Call `locate_tiles()` and `locate_mask()` to validate settings before committing to full extraction. This saves hours on large slide collections.\n\n2. **Match level to analysis resolution**: Level 0 provides maximum detail but is slow; level 1-2 is typically sufficient for initial analysis. Use level 0 only for tasks requiring cellular detail.\n\n3. **Choose the right tiler strategy**:\n   - `RandomTiler` for exploratory analysis and diverse sampling\n   - `GridTiler` for complete coverage and spatial analysis\n   - `ScoreTiler` for quality-driven dataset curation\n\n4. **Use seeds for reproducibility**: Always set `seed` in `RandomTiler` to ensure consistent tile selection across runs.\n\n5. **Customize masks for specific stains**: H&E and IHC stains have different color profiles. Adjust filter parameters or build custom `Compose` pipelines for non-standard stains.\n\n6. **Anti-pattern -- Don't use TissueMask when BiggestTissueBoxMask suffices**: `TissueMask` is more computationally expensive. Use it only when the slide has multiple tissue sections.\n\n7. **Enable logging for batch processing**: `logging.basicConfig(level=logging.INFO)` provides progress tracking during extraction.\n\n8. **Generate CSV reports with ScoreTiler**: Use `report_path` in `extract()` to create metadata manifests for downstream ML pipelines.\n\n9. **Anti-pattern -- Don't extract at level 0 for initial exploration**: Use level 1 or 2 for fast iteration, then switch to level 0 for final dataset generation.\n\n## Common Recipes\n\n### Recipe: Nuclei Enhancement Pipeline\n\nWhen to use: Isolate and enhance nuclei signal from H&E stained sections for analysis.\n\n```python\nfrom histolab.filters.image_filters import RgbToHed, HistogramEqualization, Lambda\nfrom histolab.filters.compositions import Compose\n\nnuclei_pipeline = Compose([\n    RgbToHed(),\n    Lambda(lambda hed: hed[:, :, 0]),  # Extract hematoxylin channel\n    HistogramEqualization()\n])\n\n# Apply to slide thumbnail for visualization\nenhanced = nuclei_pipeline(slide.thumbnail)\n```\n\n### Recipe: Score Distribution Analysis\n\nWhen to use: Assess tile quality distribution and identify optimal score thresholds.\n\n```python\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nreport = pd.read_csv(\"tiles_report.csv\")\nfig, axes = plt.subplots(1, 2, figsize=(14, 5))\n\naxes[0].hist(report['score'], bins=30, edgecolor='black', alpha=0.7)\naxes[0].set_xlabel('Tile Score'); axes[0].set_ylabel('Frequency')\naxes[0].set_title('Score Distribution')\n\naxes[1].scatter(report['tissue_percent'], report['score'], alpha=0.5)\naxes[1].set_xlabel('Tissue %'); axes[1].set_ylabel('Score')\naxes[1].set_title('Score vs Tissue Coverage')\n\nplt.tight_layout()\nplt.savefig(\"quality_analysis.png\", dpi=150, bbox_inches='tight')\nplt.show()\n```\n\n### Recipe: Multi-Level Hierarchical Extraction\n\nWhen to use: Extract tiles at multiple magnification levels from the same locations for multi-scale analysis.\n\n```python\nfrom histolab.tiler import RandomTiler\n\nfor level in [0, 1, 2]:\n    tiler = RandomTiler(\n        tile_size=(512, 512), n_tiles=50,\n        level=level, seed=42,  # Same seed = same locations\n        prefix=f\"level{level}_\"\n    )\n    tiler.extract(slide)\n    print(f\"Extracted level {level} tiles\")\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `OpenSlideError: Unsupported format` | OpenSlide C library not installed or slide format unsupported | Install OpenSlide system library; verify format with `openslide-show-properties` |\n| No tiles extracted | `tissue_percent` too high or mask misses tissue | Lower `tissue_percent` (try 60-70%); preview mask with `locate_mask()` |\n| Many background tiles | `check_tissue=False` or poor mask | Enable `check_tissue=True`; increase `tissue_percent`; use `TissueMask()` |\n| Extraction very slow | Level 0 on large slide or `TissueMask` on many sections | Extract at level 1-2; use `BiggestTissueBoxMask`; reduce `n_tiles` |\n| Tiles have pen artifacts | Default mask includes pen marks | Build custom filter with HSV-based pen detection; increase `RemoveSmallObjects` threshold |\n| `MemoryError` during extraction | Level 0 tile access on very large WSI | Extract at lower level; process fewer tiles per batch |\n| Inconsistent results across runs | Missing `seed` in `RandomTiler` | Always set `seed` parameter |\n| Tiles too small\u002Flarge for model | `tile_size` mismatch with model input | Adjust `tile_size` to match model requirements (commonly 224, 256, 512) |\n\n## Bundled Resources\n\n### references\u002Ffilters_preprocessing.md\n\nComprehensive filter reference covering all image filters (RgbToGrayscale, RgbToHsv, RgbToHed, OtsuThreshold, AdaptiveThreshold, Invert, StretchContrast, HistogramEqualization, Lambda) and morphological filters (BinaryDilation, BinaryErosion, BinaryOpening, BinaryClosing, RemoveSmallObjects, RemoveSmallHoles) with individual code examples, use-case descriptions, and common preprocessing pipelines (tissue detection, pen removal, nuclei enhancement, stain normalization).\n\n- **Covers**: All filter types with individual code blocks, `Compose` chaining, quality control filters, custom mask integration\n- **Relocated inline**: Standard tissue detection pipeline and Lambda filter basics moved to Core API Module 4\n- **Omitted**: Filter effect visualization step-by-step (covered in references\u002Fvisualization_slides.md); best practices list partially consolidated into main Best Practices section\n\n### references\u002Ftile_extraction.md\n\nDetailed tile extraction reference covering all three tiler strategies (RandomTiler, GridTiler, ScoreTiler) with full parameter documentation, all built-in scorers (NucleiScorer, CellularityScorer), custom scorer creation, extraction workflows with logging and CSV reporting, and advanced patterns (multi-level, hierarchical, post-extraction blur filtering).\n\n- **Covers**: Per-tiler parameters and use cases, scorer API, tile preview, extraction with reports, advanced patterns, performance optimization\n- **Relocated inline**: Basic tiler usage and scorer creation moved to Core API Modules 3 and 5; common parameters table moved to Key Parameters\n- **Omitted**: ASCII grid pattern diagrams (trivial visual aid)\n\n### references\u002Fvisualization_slides.md\n\nConsolidated visualization, slide management, and tissue mask reference. Covers slide inspection workflows, mask comparison visualization, tile grid display, quality assessment (score distributions, top\u002Fbottom tile comparison), multi-slide collection thumbnails, tissue coverage bar charts, filter effect visualization pipeline, PDF report generation, and interactive Jupyter widgets.\n\n- **Source**: Consolidates visualization.md (547 lines) + slide_management.md (172 lines) + tissue_masks.md (251 lines)\n- **Covers**: All visualization patterns from original, slide inspection workflow, sample datasets, pyramid level enumeration, mask classes and customization, annotation exclusion pattern\n- **Relocated inline**: Core slide properties and mask basics moved to Core API Modules 1-2; thumbnail display and basic locate_mask\u002Flocate_tiles moved to Module 6\n- **Omitted**: Slide name\u002Fpath trivial properties (2 lines); custom tile location visualization with manual coordinate calculation (conceptual only, not practical)\n\n### Original reference file disposition (5 files):\n\n1. **slide_management.md** (172 lines) -- (b) Consolidated: core content into Core API Module 1 (Slide class, properties, sample data, thumbnails, regions, pyramid levels); advanced slide inspection and multi-slide workflow into references\u002Fvisualization_slides.md\n2. **tissue_masks.md** (251 lines) -- (b) Consolidated: core mask classes and usage into Core API Module 2; custom masks (RectangularMask, AnnotationExclusionMask) and mask comparison into references\u002Fvisualization_slides.md\n3. **tile_extraction.md** (421 lines) -- (a) Migrated to references\u002Ftile_extraction.md with condensation\n4. **filters_preprocessing.md** (514 lines) -- (a) Migrated to references\u002Ffilters_preprocessing.md with condensation\n5. **visualization.md** (547 lines) -- (a) Migrated to references\u002Fvisualization_slides.md (consolidated with slide_management.md and tissue_masks.md content)\n\n## Related Skills\n\n- **pathml-spatial-omics (planned)** -- advanced multiplexed imaging and spatial proteomics\n- **matplotlib-scientific-plotting** -- publication-quality figure generation from histolab outputs\n\n## References\n\n- [Histolab documentation](https:\u002F\u002Fhistolab.readthedocs.io\u002F) -- official API reference and tutorials\n- [Histolab GitHub repository](https:\u002F\u002Fgithub.com\u002Fhistolab\u002Fhistolab) -- source code and examples\n- [OpenSlide](https:\u002F\u002Fopenslide.org\u002F) -- underlying C library for WSI format support\n- [TCGA sample data](https:\u002F\u002Fportal.gdc.cancer.gov\u002F) -- source of built-in sample datasets\n","# Histolab WSI Processing\n\n## Overview\n\nHistolab is a Python library for processing whole slide images (WSI) in digital pathology. It automates tissue detection, extracts informative tiles from gigapixel images using multiple strategies, and provides composable filter pipelines for preprocessing. The library handles SVS, TIFF, NDPI, and other WSI formats via OpenSlide.\n\n## When to Use\n\n- Extracting tiles from whole slide images for deep learning model training\n- Detecting tissue regions and filtering background\u002Fartifacts in histopathology slides\n- Building preprocessing pipelines for H&E or IHC stained tissue sections\n- Creating quality-driven tile datasets ranked by nuclei density or cellularity\n- Performing batch tile extraction across slide collections with consistent parameters\n- Assessing slide quality and tissue coverage before computational pathology workflows\n- For raw slide access without tile extraction, use `openslide-python` directly\n- For complex multiplexed imaging or spatial proteomics pipelines, use `pathml` instead\n\n## Prerequisites\n\n- **Python packages**: `histolab` (includes OpenSlide Python bindings)\n- **System dependency**: OpenSlide C library must be installed separately\n- **Supported formats**: SVS, TIFF, NDPI, VMS, SCN, MRXS (via OpenSlide)\n\n```bash\n# macOS\nbrew install openslide\npip install histolab\n\n# Ubuntu\u002FDebian\nsudo apt-get install openslide-tools\npip install histolab\n```\n\n## Quick Start\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.tiler import RandomTiler\n\n# Load slide\nslide = Slide(\"slide.svs\", processed_path=\"output\u002F\")\nprint(f\"Dimensions: {slide.dimensions}, Levels: {slide.levels}\")\n\n# Configure tiler\ntiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=100, level=0, seed=42,\n    check_tissue=True, tissue_percent=80.0\n)\n\n# Preview and extract\ntiler.locate_tiles(slide, n_tiles=20)\ntiler.extract(slide)\n```\n\n## Core API\n\n### Module 1: Slide Management\n\nThe `Slide` class is the primary interface for loading and inspecting WSI files.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.data import prostate_tissue\n\n# Load from built-in sample data (prostate, ovarian, breast, heart, kidney)\nprostate_svs, prostate_path = prostate_tissue()\nslide = Slide(prostate_path, processed_path=\"output\u002F\")\n\n# Inspect properties\nprint(f\"Dimensions: {slide.dimensions}\")       # (width, height) at level 0\nprint(f\"Levels: {slide.levels}\")               # Number of pyramid levels\nprint(f\"Level dims: {slide.level_dimensions}\") # Dimensions per level\nprint(f\"Magnification: {slide.properties.get('openslide.objective-power', 'N\u002FA')}\")\nprint(f\"MPP-X: {slide.properties.get('openslide.mpp-x', 'N\u002FA')}\")\n\n# Thumbnail and scaled image\nslide.save_thumbnail()  # Saves to processed_path\nscaled = slide.scaled_image(scale_factor=32)\n\n# Extract region at specific coordinates\nregion = slide.extract_region(location=(1000, 2000), size=(512, 512), level=0)\n```\n\n### Module 2: Tissue Detection\n\nMask classes identify tissue regions and filter background for tile extraction.\n\n```python\nfrom histolab.masks import TissueMask, BiggestTissueBoxMask, BinaryMask\nimport numpy as np\n\n# TissueMask: segments ALL tissue regions (multiple sections)\ntissue_mask = TissueMask()\nmask_array = tissue_mask(slide)  # Binary NumPy array: True=tissue, False=background\nprint(f\"Tissue coverage: {mask_array.sum() \u002F mask_array.size * 100:.1f}%\")\n\n# BiggestTissueBoxMask: bounding box of largest tissue region (default)\nbiggest_mask = BiggestTissueBoxMask()\n\n# Visualize mask on slide thumbnail\nslide.locate_mask(tissue_mask)\n\n# Custom mask via BinaryMask subclass\nclass RectangularROI(BinaryMask):\n    def __init__(self, x, y, w, h):\n        self.x, self.y, self.w, self.h = x, y, w, h\n\n    def _mask(self, slide):\n        thumb = slide.thumbnail\n        mask = np.zeros(thumb.shape[:2], dtype=bool)\n        mask[self.y:self.y+self.h, self.x:self.x+self.w] = True\n        return mask\n```\n\n### Module 3: Tile Extraction\n\nThree strategies for extracting tiles: random sampling, grid coverage, and score-based selection.\n\n```python\nfrom histolab.tiler import RandomTiler, GridTiler, ScoreTiler\nfrom histolab.scorer import NucleiScorer\nfrom histolab.masks import TissueMask\n\n# RandomTiler: fixed number of randomly positioned tiles\nrandom_tiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=100, level=0,\n    seed=42, check_tissue=True, tissue_percent=80.0\n)\nrandom_tiler.locate_tiles(slide, n_tiles=20)  # Preview first\nrandom_tiler.extract(slide)\n\n# GridTiler: systematic grid coverage\ngrid_tiler = GridTiler(\n    tile_size=(512, 512), level=0,\n    pixel_overlap=0, check_tissue=True, tissue_percent=70.0\n)\ngrid_tiler.extract(slide, extraction_mask=TissueMask())\n\n# ScoreTiler: top-ranked tiles by scoring function\nscore_tiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=50, level=0,\n    scorer=NucleiScorer(), check_tissue=True\n)\nscore_tiler.extract(slide, report_path=\"tiles_report.csv\")\n# Report CSV: tile_name, x_coord, y_coord, level, score, tissue_percent\n```\n\n### Module 4: Filters and Preprocessing\n\nComposable image and morphological filters for tissue detection and preprocessing.\n\n```python\nfrom histolab.filters.image_filters import (\n    RgbToGrayscale, RgbToHsv, RgbToHed,\n    OtsuThreshold, AdaptiveThreshold,\n    StretchContrast, HistogramEqualization, Invert\n)\nfrom histolab.filters.morphological_filters import (\n    BinaryDilation, BinaryErosion, BinaryOpening, BinaryClosing,\n    RemoveSmallObjects, RemoveSmallHoles\n)\nfrom histolab.filters.compositions import Compose\n\n# Standard tissue detection pipeline\ntissue_pipeline = Compose([\n    RgbToGrayscale(),\n    OtsuThreshold(),\n    BinaryDilation(disk_size=5),\n    RemoveSmallHoles(area_threshold=1000),\n    RemoveSmallObjects(area_threshold=500)\n])\n\n# Use custom pipeline with TissueMask\nfrom histolab.masks import TissueMask\ncustom_mask = TissueMask(filters=tissue_pipeline)\n\n# Stain deconvolution (H&E)\nhed_filter = RgbToHed()  # Hematoxylin-Eosin-DAB separation\n```\n\n```python\n# Apply filters to individual tiles\nfrom histolab.tile import Tile\n\nfilter_chain = Compose([RgbToGrayscale(), StretchContrast()])\nfiltered_tile = tile.apply_filters(filter_chain)\n\n# Lambda for custom inline filters\nfrom histolab.filters.image_filters import Lambda\nimport numpy as np\n\nbrightness = Lambda(lambda img: np.clip(img * 1.2, 0, 255).astype(np.uint8))\nred_channel = Lambda(lambda img: img[:, :, 0])\n```\n\n### Module 5: Scoring\n\nScorers rank tiles by tissue content quality for use with ScoreTiler.\n\n```python\nfrom histolab.scorer import NucleiScorer, CellularityScorer, Scorer\nimport numpy as np\n\n# Built-in scorers\nnuclei = NucleiScorer()       # Scores by nuclei density (grayscale threshold + count)\ncellularity = CellularityScorer()  # Scores by overall cellular content\n\n# Custom scorer\nclass ColorVarianceScorer(Scorer):\n    def __call__(self, tile):\n        \"\"\"Score tiles by color variance (higher = more informative).\"\"\"\n        tile_array = np.array(tile.image)\n        return np.var(tile_array, axis=(0, 1)).sum()\n\nscore_tiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=30,\n    scorer=ColorVarianceScorer()\n)\n```\n\n### Module 6: Visualization\n\nBuilt-in methods and matplotlib patterns for inspecting slides, masks, and tiles.\n\n```python\nimport matplotlib.pyplot as plt\nfrom histolab.masks import TissueMask\n\n# Built-in: mask overlay on slide thumbnail\nslide.locate_mask(TissueMask())\n\n# Built-in: tile location preview\ntiler.locate_tiles(slide, n_tiles=20)\n\n# Manual side-by-side: slide vs mask\nmask = TissueMask()\nmask_array = mask(slide)\nfig, axes = plt.subplots(1, 2, figsize=(15, 7))\naxes[0].imshow(slide.thumbnail); axes[0].set_title(\"Slide\"); axes[0].axis('off')\naxes[1].imshow(mask_array, cmap='gray'); axes[1].set_title(\"Mask\"); axes[1].axis('off')\nplt.tight_layout()\nplt.show()\n\n# Display extracted tiles in grid\nfrom pathlib import Path\nfrom PIL import Image\ntile_paths = list(Path(\"output\u002Ftiles\u002F\").glob(\"*.png\"))[:16]\nfig, axes = plt.subplots(4, 4, figsize=(12, 12))\nfor idx, tp in enumerate(axes.ravel()):\n    if idx \u003C len(tile_paths):\n        tp.imshow(Image.open(tile_paths[idx]))\n        tp.set_title(tile_paths[idx].stem, fontsize=8)\n    tp.axis('off')\nplt.tight_layout()\nplt.show()\n```\n\n## Key Concepts\n\n### WSI Pyramid Levels\n\nWhole slide images use a pyramidal structure with multiple resolution levels. Level 0 is the highest resolution (native scan). Higher levels provide progressively lower resolutions for faster access.\n\n```python\nfor level in range(slide.levels):\n    dims = slide.level_dimensions[level]\n    downsample = slide.level_downsamples[level]\n    print(f\"Level {level}: {dims}, downsample: {downsample:.0f}x\")\n# Level 0: (98304, 221184), downsample: 1x\n# Level 1: (24576, 55296), downsample: 4x\n```\n\n### Filter Composition Pattern\n\nFilters are designed to be chained via `Compose`. The output of one filter becomes the input of the next. Image filters operate on RGB\u002Fgrayscale arrays; morphological filters operate on binary arrays. Order matters: always convert to the expected input type before applying downstream filters.\n\n### Mask-Tiler Integration\n\nAll tilers accept an `extraction_mask` parameter. The default is `BiggestTissueBoxMask()`. Override with `TissueMask()` for multi-section slides or a custom `BinaryMask` subclass for ROI-specific extraction.\n\n## Common Workflows\n\n### Workflow 1: Exploratory Slide Analysis\n\n**Goal**: Quickly inspect a slide, detect tissue, and sample diverse regions for review.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.tiler import RandomTiler\nfrom histolab.masks import TissueMask\nimport matplotlib.pyplot as plt\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nslide = Slide(\"slide.svs\", processed_path=\"output\u002Fexploratory\u002F\")\nprint(f\"Dimensions: {slide.dimensions}, Levels: {slide.levels}\")\nslide.save_thumbnail()\n\n# Visualize tissue detection\ntissue_mask = TissueMask()\nslide.locate_mask(tissue_mask)\nmask_arr = tissue_mask(slide)\nprint(f\"Tissue coverage: {mask_arr.sum() \u002F mask_arr.size * 100:.1f}%\")\n\n# Sample tiles\ntiler = RandomTiler(\n    tile_size=(512, 512), n_tiles=50, level=0,\n    seed=42, check_tissue=True, tissue_percent=80.0\n)\ntiler.locate_tiles(slide, n_tiles=20)\ntiler.extract(slide)\n```\n\n### Workflow 2: Deep Learning Dataset Preparation\n\n**Goal**: Build a quality-controlled tile dataset from multiple slides for model training.\n\n```python\nfrom pathlib import Path\nfrom histolab.slide import Slide\nfrom histolab.tiler import ScoreTiler\nfrom histolab.scorer import NucleiScorer\nimport pandas as pd\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nslide_dir = Path(\"slides\u002F\")\noutput_base = Path(\"output\u002Fdataset\u002F\")\nall_reports = []\n\ntiler = ScoreTiler(\n    tile_size=(512, 512), n_tiles=100, level=0,\n    scorer=NucleiScorer(), check_tissue=True, tissue_percent=80.0\n)\n\nfor slide_path in sorted(slide_dir.glob(\"*.svs\")):\n    out_dir = output_base \u002F slide_path.stem\n    out_dir.mkdir(parents=True, exist_ok=True)\n    slide = Slide(str(slide_path), processed_path=str(out_dir))\n    slide.save_thumbnail()\n    report_path = str(out_dir \u002F \"report.csv\")\n    tiler.extract(slide, report_path=report_path)\n    df = pd.read_csv(report_path)\n    df[\"slide\"] = slide_path.stem\n    all_reports.append(df)\n    print(f\"{slide_path.stem}: {len(df)} tiles, mean score {df['score'].mean():.3f}\")\n\ncombined = pd.concat(all_reports, ignore_index=True)\ncombined.to_csv(output_base \u002F \"dataset_manifest.csv\", index=False)\nprint(f\"Total: {len(combined)} tiles from {len(all_reports)} slides\")\n```\n\n### Workflow 3: Custom Tissue Detection with Artifact Removal\n\n**Goal**: Handle slides with pen annotations or unusual staining using custom filter pipelines.\n\n```python\nfrom histolab.slide import Slide\nfrom histolab.masks import TissueMask\nfrom histolab.tiler import GridTiler\nfrom histolab.filters.compositions import Compose\nfrom histolab.filters.image_filters import RgbToGrayscale, OtsuThreshold\nfrom histolab.filters.morphological_filters import (\n    BinaryDilation, RemoveSmallObjects, RemoveSmallHoles\n)\n\n# Aggressive artifact removal pipeline\naggressive_filters = Compose([\n    RgbToGrayscale(),\n    OtsuThreshold(),\n    BinaryDilation(disk_size=10),\n    RemoveSmallHoles(area_threshold=5000),\n    RemoveSmallObjects(area_threshold=3000)\n])\n\ncustom_mask = TissueMask(filters=aggressive_filters)\nslide = Slide(\"artifact_slide.svs\", processed_path=\"output\u002Fclean\u002F\")\n\n# Compare default vs custom mask\nslide.locate_mask(TissueMask())     # Default\nslide.locate_mask(custom_mask)      # Custom (tighter)\n\n# Extract with custom mask\ngrid_tiler = GridTiler(\n    tile_size=(512, 512), level=1,\n    check_tissue=True, tissue_percent=70.0\n)\ngrid_tiler.extract(slide, extraction_mask=custom_mask)\n```\n\n## Key Parameters\n\n| Parameter | Module | Default | Range \u002F Options | Effect |\n|-----------|--------|---------|-----------------|--------|\n| `tile_size` | All Tilers | `(512, 512)` | Any `(w, h)` tuple | Tile dimensions in pixels |\n| `level` | All Tilers | `0` | `0` to `slide.levels-1` | Pyramid level (0=highest resolution) |\n| `check_tissue` | All Tilers | `True` | `True`\u002F`False` | Filter tiles by tissue content |\n| `tissue_percent` | All Tilers | `80.0` | `0.0`-`100.0` | Minimum tissue coverage threshold |\n| `n_tiles` | Random\u002FScoreTiler | varies | Any positive int | Number of tiles to extract |\n| `seed` | RandomTiler | `None` | Any int | Random seed for reproducibility |\n| `pixel_overlap` | GridTiler | `0` | `0`+ | Overlap between adjacent tiles in pixels |\n| `scorer` | ScoreTiler | required | `NucleiScorer()`, `CellularityScorer()`, custom | Scoring function for tile ranking |\n| `extraction_mask` | All Tilers | `BiggestTissueBoxMask()` | Any `BinaryMask` | Mask defining valid extraction region |\n| `disk_size` | Morphological filters | `5` | `1`-`20` | Structuring element size |\n| `area_threshold` | RemoveSmall* | `500`\u002F`1000` | `0`+ | Minimum area for objects\u002Fholes in pixels |\n\n## Best Practices\n\n1. **Always preview before extracting**: Call `locate_tiles()` and `locate_mask()` to validate settings before committing to full extraction. This saves hours on large slide collections.\n\n2. **Match level to analysis resolution**: Level 0 provides maximum detail but is slow; level 1-2 is typically sufficient for initial analysis. Use level 0 only for tasks requiring cellular detail.\n\n3. **Choose the right tiler strategy**:\n   - `RandomTiler` for exploratory analysis and diverse sampling\n   - `GridTiler` for complete coverage and spatial analysis\n   - `ScoreTiler` for quality-driven dataset curation\n\n4. **Use seeds for reproducibility**: Always set `seed` in `RandomTiler` to ensure consistent tile selection across runs.\n\n5. **Customize masks for specific stains**: H&E and IHC stains have different color profiles. Adjust filter parameters or build custom `Compose` pipelines for non-standard stains.\n\n6. **Anti-pattern -- Don't use TissueMask when BiggestTissueBoxMask suffices**: `TissueMask` is more computationally expensive. Use it only when the slide has multiple tissue sections.\n\n7. **Enable logging for batch processing**: `logging.basicConfig(level=logging.INFO)` provides progress tracking during extraction.\n\n8. **Generate CSV reports with ScoreTiler**: Use `report_path` in `extract()` to create metadata manifests for downstream ML pipelines.\n\n9. **Anti-pattern -- Don't extract at level 0 for initial exploration**: Use level 1 or 2 for fast iteration, then switch to level 0 for final dataset generation.\n\n## Common Recipes\n\n### Recipe: Nuclei Enhancement Pipeline\n\nWhen to use: Isolate and enhance nuclei signal from H&E stained sections for analysis.\n\n```python\nfrom histolab.filters.image_filters import RgbToHed, HistogramEqualization, Lambda\nfrom histolab.filters.compositions import Compose\n\nnuclei_pipeline = Compose([\n    RgbToHed(),\n    Lambda(lambda hed: hed[:, :, 0]),  # Extract hematoxylin channel\n    HistogramEqualization()\n])\n\n# Apply to slide thumbnail for visualization\nenhanced = nuclei_pipeline(slide.thumbnail)\n```\n\n### Recipe: Score Distribution Analysis\n\nWhen to use: Assess tile quality distribution and identify optimal score thresholds.\n\n```python\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nreport = pd.read_csv(\"tiles_report.csv\")\nfig, axes = plt.subplots(1, 2, figsize=(14, 5))\n\naxes[0].hist(report['score'], bins=30, edgecolor='black', alpha=0.7)\naxes[0].set_xlabel('Tile Score'); axes[0].set_ylabel('Frequency')\naxes[0].set_title('Score Distribution')\n\naxes[1].scatter(report['tissue_percent'], report['score'], alpha=0.5)\naxes[1].set_xlabel('Tissue %'); axes[1].set_ylabel('Score')\naxes[1].set_title('Score vs Tissue Coverage')\n\nplt.tight_layout()\nplt.savefig(\"quality_analysis.png\", dpi=150, bbox_inches='tight')\nplt.show()\n```\n\n### Recipe: Multi-Level Hierarchical Extraction\n\nWhen to use: Extract tiles at multiple magnification levels from the same locations for multi-scale analysis.\n\n```python\nfrom histolab.tiler import RandomTiler\n\nfor level in [0, 1, 2]:\n    tiler = RandomTiler(\n        tile_size=(512, 512), n_tiles=50,\n        level=level, seed=42,  # Same seed = same locations\n        prefix=f\"level{level}_\"\n    )\n    tiler.extract(slide)\n    print(f\"Extracted level {level} tiles\")\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `OpenSlideError: Unsupported format` | OpenSlide C library not installed or slide format unsupported | Install OpenSlide system library; verify format with `openslide-show-properties` |\n| No tiles extracted | `tissue_percent` too high or mask misses tissue | Lower `tissue_percent` (try 60-70%); preview mask with `locate_mask()` |\n| Many background tiles | `check_tissue=False` or poor mask | Enable `check_tissue=True`; increase `tissue_percent`; use `TissueMask()` |\n| Extraction very slow | Level 0 on large slide or `TissueMask` on many sections | Extract at level 1-2; use `BiggestTissueBoxMask`; reduce `n_tiles` |\n| Tiles have pen artifacts | Default mask includes pen marks | Build custom filter with HSV-based pen detection; increase `RemoveSmallObjects` threshold |\n| `MemoryError` during extraction | Level 0 tile access on very large WSI | Extract at lower level; process fewer tiles per batch |\n| Inconsistent results across runs | Missing `seed` in `RandomTiler` | Always set `seed` parameter |\n| Tiles too small\u002Flarge for model | `tile_size` mismatch with model input | Adjust `tile_size` to match model requirements (commonly 224, 256, 512) |\n\n## Bundled Resources\n\n### references\u002Ffilters_preprocessing.md\n\nComprehensive filter reference covering all image filters (RgbToGrayscale, RgbToHsv, RgbToHed, OtsuThreshold, AdaptiveThreshold, Invert, StretchContrast, HistogramEqualization, Lambda) and morphological filters (BinaryDilation, BinaryErosion, BinaryOpening, BinaryClosing, RemoveSmallObjects, RemoveSmallHoles) with individual code examples, use-case descriptions, and common preprocessing pipelines (tissue detection, pen removal, nuclei enhancement, stain normalization).\n\n- **Covers**: All filter types with individual code blocks, `Compose` chaining, quality control filters, custom mask integration\n- **Relocated inline**: Standard tissue detection pipeline and Lambda filter basics moved to Core API Module 4\n- **Omitted**: Filter effect visualization step-by-step (covered in references\u002Fvisualization_slides.md); best practices list partially consolidated into main Best Practices section\n\n### references\u002Ftile_extraction.md\n\nDetailed tile extraction reference covering all three tiler strategies (RandomTiler, GridTiler, ScoreTiler) with full parameter documentation, all built-in scorers (NucleiScorer, CellularityScorer), custom scorer creation, extraction workflows with logging and CSV reporting, and advanced patterns (multi-level, hierarchical, post-extraction blur filtering).\n\n- **Covers**: Per-tiler parameters and use cases, scorer API, tile preview, extraction with reports, advanced patterns, performance optimization\n- **Relocated inline**: Basic tiler usage and scorer creation moved to Core API Modules 3 and 5; common parameters table moved to Key Parameters\n- **Omitted**: ASCII grid pattern diagrams (trivial visual aid)\n\n### references\u002Fvisualization_slides.md\n\nConsolidated visualization, slide management, and tissue mask reference. Covers slide inspection workflows, mask comparison visualization, tile grid display, quality assessment (score distributions, top\u002Fbottom tile comparison), multi-slide collection thumbnails, tissue coverage bar charts, filter effect visualization pipeline, PDF report generation, and interactive Jupyter widgets.\n\n- **Source**: Consolidates visualization.md (547 lines) + slide_management.md (172 lines) + tissue_masks.md (251 lines)\n- **Covers**: All visualization patterns from original, slide inspection workflow, sample datasets, pyramid level enumeration, mask classes and customization, annotation exclusion pattern\n- **Relocated inline**: Core slide properties and mask basics moved to Core API Modules 1-2; thumbnail display and basic locate_mask\u002Flocate_tiles moved to Module 6\n- **Omitted**: Slide name\u002Fpath trivial properties (2 lines); custom tile location visualization with manual coordinate calculation (conceptual only, not practical)\n\n### Original reference file disposition (5 files):\n\n1. **slide_management.md** (172 lines) -- (b) Consolidated: core content into Core API Module 1 (Slide class, properties, sample data, thumbnails, regions, pyramid levels); advanced slide inspection and multi-slide workflow into references\u002Fvisualization_slides.md\n2. **tissue_masks.md** (251 lines) -- (b) Consolidated: core mask classes and usage into Core API Module 2; custom masks (RectangularMask, AnnotationExclusionMask) and mask comparison into references\u002Fvisualization_slides.md\n3. **tile_extraction.md** (421 lines) -- (a) Migrated to references\u002Ftile_extraction.md with condensation\n4. **filters_preprocessing.md** (514 lines) -- (a) Migrated to references\u002Ffilters_preprocessing.md with condensation\n5. **visualization.md** (547 lines) -- (a) Migrated to references\u002Fvisualization_slides.md (consolidated with slide_management.md and tissue_masks.md content)\n\n## Related Skills\n\n- **pathml-spatial-omics (planned)** -- advanced multiplexed imaging and spatial proteomics\n- **matplotlib-scientific-plotting** -- publication-quality figure generation from histolab outputs\n\n## References\n\n- [Histolab documentation](https:\u002F\u002Fhistolab.readthedocs.io\u002F) -- official API reference and tutorials\n- [Histolab GitHub repository](https:\u002F\u002Fgithub.com\u002Fhistolab\u002Fhistolab) -- source code and examples\n- [OpenSlide](https:\u002F\u002Fopenslide.org\u002F) -- underlying C library for WSI format support\n- [TCGA sample data](https:\u002F\u002Fportal.gdc.cancer.gov\u002F) -- source of built-in sample datasets\n",{"name":5,"license":15,"description":7},"master","63f17866001c5ca854bf2fa0b678ce277133de5b","skills\u002Fawesome-skills\u002Fhistolab-wsi-processing",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill histolab-wsi-processing",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill histolab-wsi-processing",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill histolab-wsi-processing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fhistolab-wsi-processing\u002FSKILL.md",true,[],[49,58,65,72,79,86],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":57},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":57},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":57},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":57},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":57},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":57},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]