WSI Quality Control
Automated screening of whole-slide images for artefacts before they reach annotation or modelling, so that effort and model performance are not spent on unusable slides.
What it is
Scanned slides carry predictable defects: out-of-focus regions, tissue folds, pen marks, air bubbles, coverslip edges, debris, and incomplete scans. Each degrades downstream analysis, and some do so invisibly — a model trained on blurred tiles learns blur.
The group runs three complementary tools.
HistoQC performs slide-level quality control and produces per-slide metrics and masks. Its outputs are used as QuPath-project filters, which is the operationally important part: QC is wired into the annotation workflow rather than being a separate report nobody reads.
PathProfiler profiles a whole cohort, giving a distribution view rather than a per-slide verdict — useful for spotting a bad scanning run or a drifting scanner.
GrandQC Quality Study is the group’s own measurement of a published QC model against its own technicians — 502 slides, GrandQC’s artefact percentage against a 13-item preparation-quality form. An earlier version of this page described it as a study of QC reproducibility, one QC tool against another; that was wrong, and it is a human-versus-model agreement study. Corrected 2026-07-31 after reading the repository.
A fourth kind now exists in the estate and does not belong with the other three. imagebank ships three locally-written QC implementations inside its web platform, and none of them uses a trained model: all compute Laplacian variance as a focus proxy, mean grey level, a fixed grey threshold for tissue, and standard deviation as contrast. They are useful here only as a worked example of how this class of tool fails, because reading the source produced three findings that generalise beyond that repository:
- A threshold has to be anchored to something. One of the tools compares Laplacian variance against a hard-coded constant while computing it at two different resolutions depending on whether the user selected a region — base resolution for a small ROI, a 1024-pixel thumbnail for a whole slide. Laplacian variance is strongly scale-dependent, so one constant cannot serve both, and neither reading ties back to anything the scanner reports. Any focus metric needs its magnification stated beside it or it is not a measurement.
- An unfalsifiable check looks exactly like a passing one. That tool’s staining score is bounded above by 0.25 by construction and is compared against a threshold of 0.5, so its “poor staining” warning fires on every image ever analysed — confirmed by running the function rather than by reading it. A metric that always fires and a metric that never fires are equally uninformative, and both are invisible until someone checks the arithmetic.
- Sampling has to be tissue-aware. Another draws ten random tiles from anywhere on the slide, including blank glass, then averages. Blank glass has near-zero Laplacian variance, so the blur score is substantially a measure of how much of the slide is empty rather than how well it was focused.
There is also a naming hazard worth stating on this page rather than only on the project one. Two of those files carry the GrandQC name and contain no GrandQC — their container ships no deep-learning framework at all — while one of them is presented in a menu as “GrandQC Quality Assessment” and its manifest claims it was “built with the GrandQC library”. Since this estate also contains a real GrandQC wrapper (GrandQC-QuPath) and a study measuring the real models (GrandQC Quality Study), the phrase “the GrandQC result for this slide” now has two possible meanings that differ by everything. Where a QC number came from is part of the number, and a result recorded without its implementation is not interpretable later.
Below all of these sits a cheaper primitive: a plain tissue mask. ScanTools’s mask reads the whole slide at 1.25x and combines Otsu thresholding on grey with HSV thresholds that exclude pen marker (high saturation) and dark print (low value). It is not a QC tool and does not compete with HistoQC — it answers only “where is the tissue” — but that is the input a tiling pipeline needs, and it is useful as a fast first pass over a cohort to catch slides with almost no tissue detected, which usually means a failed or mis-cropped scan.
Two parameters need care. Its -l/-o thresholds are raw pixel areas calibrated to the default 1.25x, and nothing rescales them automatically — raising the magnification without raising them by roughly the square of the ratio yields a speckled mask that still looks reasonable. And its polarity assumes brightfield: bright glass, darker tissue. On fluorescence it would invert, marking background as tissue, with no modality check in the code to stop it.
The design decision that matters is what to do with a flagged slide. Excluding it is clean but biases the cohort if failures correlate with anything clinical (larger specimens fold more, for instance). Masking the artefact region and keeping the rest is usually better. Either way the rule should be pre-specified and the exclusion count reported.
Why it matters for my work
QC sits upstream of everything image-based. It protects annotation effort in QuPath Annotation Workflow, and it protects model validity — artefacts that correlate with site or scanner are one route to the shortcut learning described in Scanner and Stain Variability.
It also connects to operations: Scanning Time in Real Life lists these same three repos as supporting QC work, since rescans driven by quality failures are a real component of scanner load and turnaround.
How it connects
Scanner and Stain Variability — QC handles artefacts, normalisation handles colour; both are preprocessing and both belong before modelling.
Stain Normalisation — a job QC could take on: no normalisation method corrects both over- and under-staining, so classifying which way a slide failed is what decides the method. QC already inspects the slide, which makes it the natural place to route.
QuPath Annotation Workflow — QC output feeds QuPath project filtering directly.
Whole Slide Imaging — the file properties that QC inspects.
Scanning Time in Real Life — quality failures cause rescans, which show up in scanner utilisation.
Model Abstention — rejecting a slide before a model sees it is abstention moved upstream and given a respectable name; accuracy measured after QC describes an easier cohort than the one in the scanner queue.
Preparation Quality Versus Image Quality — the distinction that bounds everything on this page: the tools here segment the scanned image, and roughly 70% of what the laboratory actually records as a quality problem happens before the scanner ever sees the slide. A cohort screened by these three tools has not been screened for preparation quality.
Outlier Detection via Path Foundation — the unsupervised counterpart: embed every tile and score it for distance from the rest, so the tiles that are merely unusual are caught without anyone having named the artefact first. It fails on different things than HistoQC does, which is the argument for running both rather than choosing.
imagebank — where the estate’s hand-rolled QC implementations live, and the reason this page now distinguishes model-based screening from threshold heuristics wearing the same names.
Server-Side Slide Platforms — the architecture those tools are packaged for; a QC plugin inside a professional-looking web interface is still ordinary local code and inherits no reliability from its surroundings.
Open questions
- Is there a documented threshold at which a slide is excluded versus masked? Not recorded. [unverified] This should be pre-specified per study.
What didAnswered 2026-07-31 — see GrandQC Quality Study. On 502 slides it agrees with the technicians barely above chance (Cohen’s κ = 0.10; the interval touches zero once the 502 rows are corrected for covering only 437 distinct slides, so “no reliable agreement” is the defensible reading). The reason is not that the model is poor: 70% of the quality problems the technicians record have no GrandQC class at all. Nine of their thirteen criteria are microtomy and mounting geometry — off-centre, oblique, torn, overflowing, detached — which are properties of how the section was cut and placed, not of the scanned image GrandQC segments. The practical consequence for this page is that an artefact-segmentation model is not a drop-in for a preparation-quality check; they cover different failures and a laboratory needs both. It also cannot be run as a technician substitute on the strength of these numbers.grandQC_quality_studyconclude?- Are QC exclusion counts reported in the group’s AI papers? They should be, as part of the cohort flow diagram.
- Does any QC output in the estate record which implementation produced it? Not on any evidence here. With at least two different things named GrandQC and three unlabelled threshold heuristics in circulation, a stored quality score with no provenance cannot be compared against anything later — including against itself after a tool is fixed. Recording tool and version beside the number costs nothing at write time and is unrecoverable afterwards.
[unverified] - What should a QC plugin for the platform actually measure? GrandQC Quality Study‘s answer — that 70% of recorded quality problems are preparation geometry no image model can see — suggests the useful tool is not a better focus metric but something closer to the technicians’ 13-item form. Nobody has designed that, and it is a more interesting question than which artefact model to wrap.