executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
image-preprocessingUse TIAToolbox for tissue masking, stain normalization/extraction/augmentation, patch extraction, tile pyramids, and preprocessing validation before inference.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when a task needs to prepare pathology images or WSIs before analysis: build tissue masks, normalize stain appearance, augment stain variation, extract fixed or point-centered patches, generate tile pyramids, or validate preprocessing choices before model inference.
OtsuTissueMasker, MorphologicalMasker, or the tissue-mask command.get_normalizer(...), custom stain matrices, target images, or the stain-norm command.RuifrokExtractor, MacenkoExtractor, VahadaneExtractor, CustomExtractor, and StainAugmentor.TilePyramidGenerator, ZoomifyGenerator, and AnnotationTileGenerator.wsi-io for WSI opening, metadata, slide dimensions, thumbnails, read_rect, read_bounds, and coordinate-space questions.model-inference for patch prediction, semantic segmentation, nucleus detection, feature extraction, and inference engine batching.cli-and-configuration for complete CLI syntax, shared Click options, file discovery behavior, logging flags, and command orchestration.references/api-reference.md summarizes APIs, required arguments, defaults, and decision points.references/workflows.md gives copyable recipes for masks, stain workflows, patches, pyramids, and preprocessing validation.references/troubleshooting.md maps common preprocessing failures to concrete checks and fixes.scripts/preprocessing_smoke.py provides tiny in-memory checks for importability, maskers, patch coordinates/filtering, stain normalizer construction, and stain augmentor construction.import numpy as np
from tiatoolbox.tools.tissuemask import MorphologicalMasker
from tiatoolbox.tools.stainnorm import get_normalizer
from tiatoolbox.tools.patchextraction import get_patch_extractor
thumbnail = np.zeros((1, 128, 128, 3), dtype=np.uint8)
thumbnail[:, 24:96, 24:96] = [120, 45, 90]
mask = MorphologicalMasker(kernel_size=3).fit_transform(thumbnail)[0]
normalizer = get_normalizer("reinhard")
normalizer.fit(thumbnail[0])
normalized = normalizer.transform(thumbnail[0])
extractor = get_patch_extractor(
"slidingwindow",
input_img=normalized,
patch_size=(32, 32),
stride=(32, 32),
input_mask=mask,
min_mask_ratio=0.1,
)
patches = list(extractor)
Before running a model, confirm that image and mask resolutions align, patch_size and stride are intentional, stain normalization has a fitted target, and patch counts are plausible for the tissue area.