Deciding Where to Look Twice: Diagnosis-Aware Zero-Shot Deblurring of Whole Slide Images

Whole slide images, the gigapixel scans used in digital pathology, are routinely partly out of focus because tissue is uneven and the scanner's focal plane cannot follow it. The usual classifiers either read those blurred regions as they are or throw them away. Either choice can miss a small metastasis that happens to sit in a blurred fold. Diffusion models can sharpen blurred images without ever seeing paired blurry and sharp examples. A diffusion model is a generator that learns to turn random noise into realistic images by repeated denoising, and it can be steered at test time to agree with a measured image. But running one on all 15,000 or more patches of a slide costs far more than any clinical workflow can afford.

This proposal treats restoration as a step in reaching a diagnosis, not as an image-quality task. We first run a cheap pass that produces a few rough restorations of each blurred patch. A frozen slide classifier then reads these rough versions, and full restoration is spent only on the patches where the plausible restorations disagree in a way that changes the classifier's view. Because the diffusion solver gives several plausible answers instead of one, the same machinery yields a slide-level measure of how much the diagnosis depends on detail the scanner lost. That measure supports a concrete clinical action: flag this slide for rescanning. In two sentences, the idea is to spend expensive generative restoration only where the plausible restorations would change the diagnosis, and to report that sensitivity as a rescan signal. Neither uniform restoration nor discarding blurry patches can do either.

Core Claim

Each patch has its own defocus, and that defocus varies smoothly across the slide. We model each patch as a blurred and noisy copy of a sharp patch, $y_k = h_{\theta_k} * x_k + n$. Here $y_k$ is the observed patch, $x_k$ the unknown sharp patch, $h_{\theta_k}$ a defocus blur kernel with radius $\theta_k$, and $n$ Gaussian noise. The radii $\theta_k$ are constrained to lie on a smooth "focus surface" over slide coordinates.

Given $\theta_k$, the blur is linear. That means existing zero-shot solvers apply directly, with a frozen diffusion prior trained only on sharp pathology patches. These include range–null space projection, which keeps the parts of the image the blur preserved and lets the prior fill in what it destroyed (Cheng et al.), pseudoinverse guidance (ΠGDM), and preconditioned guidance (Garber et al.).

The new part is the allocation rule. For each blurred patch we draw $S$ cheap posterior samples $x_k^{(1)},\dots,x_k^{(S)}$ with a few-step solver. We then pass them through a frozen attention-based multiple-instance classifier $f$, which scores a slide by pooling patch embeddings with learned weights. Each patch is scored by how much its plausible restorations could move the slide decision:

$$u_k = \max_{s} \left| f(B_{-k} \cup \{x_k^{(s)}\}) - f(B_{-k} \cup \{y_k\}) \right|,$$

where $B_{-k}$ is the slide's other patches as currently observed and $f(\cdot)$ is the slide-level tumor logit. Full-quality sampling goes to the top-$u_k$ patches until a compute budget is exhausted. The spread of $f$ across joint posterior draws becomes the slide's rescan score.

We claim three things. First, this rule recovers most of the slide-level accuracy that uniform zero-shot restoration would achieve, at a small fraction of its compute. Second, it beats allocation by focus quality alone on slides where the blurred region and the tumor overlap. Third, the rescan score is calibrated: high when blur genuinely hides decisive evidence, low otherwise.

Relation to Prior Work

Several papers motivate the gap. Unlimited-Size Diffusion Restoration extends zero-shot projection to large images through sequential mask-shifting and a coarse-to-fine hierarchy. However, it assumes a known, spatially fixed operator and restores every pixel sequentially, which is infeasible at tens of thousands of patches. FreeAdapt makes 4K/8K patch diffusion globally consistent through Fourier-phase and feature guidance. It is parallel but uniform, and it takes tens of seconds or more per 4K image. Neither asks which patches matter. Our proposal keeps their operator-consistent sampling and replaces "restore everything coherently" with "restore what the diagnosis depends on."

Two pathology papers show that restoration helps diagnosis, and both are supervised. Cai et al. train a transformer-plus-diffusion deblurrer on paired defocused and sharp patches. They lift cell classification from 82.82% to 91.91%, against a sharp-image ceiling of 95.15%, but they operate on isolated patches. STAR-RL learns a spatial manager that sends compute to dense regions and a temporal manager that stops early. Its workers only apply ten classical filters, and its policies need paired training. STAR-RL is the closest precedent for selective restoration. We differ in three ways: the selection signal comes from the downstream classifier's sensitivity, the worker is a generative posterior sampler that can fill destroyed frequencies, and nothing is trained on degraded/sharp pairs.

Another line of work supplies the slide-level machinery, and we reuse it frozen: attention-based pooling (CLAM / Tourniaire et al.), dual-stream pooling (Bin Li et al.), and correlated transformer pooling (TransMIL). These models treat patch features as fixed inputs. We perturb those inputs along posterior directions to measure decision sensitivity.

For the cheap stage we also borrow grid-shift sampling from gigapixel WSI generation. That work removes seams by shifting the tile grid between denoising steps, in parallel. We apply it only within small connected clusters of selected patches, because the classifier consumes patch embeddings rather than a stitched canvas.

One constraint shapes the design. Xiao et al. show that diffusion priors can do blind restoration by pulling latents toward high-probability regions. The flip side is that a prior can invent plausible structure in the destroyed frequencies, including plausible tumor. We therefore never treat a restored patch as positive evidence on its own. The posterior spread is reported, and false positives on negative slides are a primary metric.

Research Program

The prior is an unconditional pixel-space diffusion model trained on sharp patches from TCGA-BRCA and Camelyon16 training slides, then frozen. Choosing pixel space over latent space avoids the autoencoder bottleneck that FreeAdapt reports for fine textures, which would erase exactly the chromatin detail we care about.

Defocus estimation is blind and zero-shot. A focus-quality map, of the kind described in Focus Quality Assessment and Whole-Slide Image Focus Quality, initializes $\theta_k$ on a coarse grid. A low-order smooth surface is fit across the slide. Each selected patch's radius is then refined by maximizing measurement consistency of its restoration, within a narrow band around the surface. Restricting blur to a disk or Gaussian with one parameter per patch keeps the operator analytic, which projection and pseudoinverse guidance require. It also keeps the blind estimation well-posed.

The cheap stage runs a 5–10-step ΠGDM-style solver with $S$ samples on every patch whose focus score falls below threshold. Typically this is a minority of tissue patches. The resulting embeddings go through the frozen classifier to compute $u_k$. The full stage runs a long, operator-consistent trajectory on the top-ranked patches, using grid-shift within clusters.

Finally, the classifier is applied to $J$ joint draws of the slide. Each draw combines one full-quality sample for the selected patches with observed or cheap versions elsewhere. The output is a slide probability together with its spread across draws.

Baselines

The naive reference point is the frozen TransMIL or CLAM classifier applied directly to the defocused slides. Alongside it we report the same classifier on the original sharp slides as a ceiling. On clean Camelyon16, TransMIL reports a test AUC of 93.09% and Tourniaire et al. report 0.895 for baseline CLAM. We found no reported result on Lacuna for any multiple-instance classifier on Camelyon16 with synthetic or real partial defocus. The degraded-slide numbers will therefore be produced here, using the same classifier weights in every condition.

The discard baseline removes patches below the focus threshold before pooling. It costs almost nothing and is what many pipelines already do.

The strongest image-restoration competitor is uniform zero-shot restoration. It runs the same frozen prior and the same full-length solver on every flagged patch, with grid-shift seam handling. It is the strongest because it uses the identical generative machinery with no selection. We treat it as the accuracy target, and our method must match its slide AUC within about one point while using a stated fraction of its GPU-hours.

The strongest supervised competitor is a feed-forward deblurrer applied to all flagged patches. This is a Restormer-type network trained on synthetic defocus pairs generated from the same training slides, given a training budget matched to the diffusion prior's. We also run STAR-RL from its public code, retrained on our pairs. On their own benchmarks these report 28.91 PSNR and 0.0735 LPIPS for the Cai et al. mixture-of-prompts system on its in-house/3DHistech data, and 31.403 PSNR on HistoSR for STAR-RL. These are context, not directly comparable targets.

The most important ablation keeps the identical full-stage budget but ranks patches by focus score alone. A second ablation ranks by the classifier's attention on the degraded patch, which tests for confirmation bias. Two further ablations set $S=1$, to test whether posterior diversity matters, and fix one blur radius per slide, to test whether the spatially varying operator matters. Every method shares the same slides, the same synthetic degradations, the same frozen classifier, and the same random seeds for degradation. All selective methods are compared at equal GPU-hour budgets.

Why not just…?

Why not just discard the blurry patches? It is cheap and safe for negative slides, but it fails exactly when it matters. If a micrometastasis lies inside the blurred region, discarding removes the only positive evidence. We will construct this case deliberately on Camelyon16, using the pixel-level tumor annotations to place defocus over tumor on a controlled fraction of positive slides. Discarding wins if it matches our sensitivity on those slides. We expect it to lose there and tie elsewhere, and we will report both strata separately.

Why not just train a fast supervised deblurrer and run it everywhere? Single-pass networks are far cheaper, and this is a serious competitor on synthetic blur that matches their training distribution. Cai et al. report that feed-forward baselines over-smooth nuclear membranes relative to their diffusion-refined pipeline. More importantly, a regression network outputs one answer, so it cannot say whether the diagnosis depends on lost detail. The experiment that settles this is a held-out scanner or defocus shape, using the real 3DHistech defocus data. If the supervised net matches our AUC there and its error is uncorrelated with our rescan score, the zero-shot posterior adds little, and we will say so.

Why not just rank patches by focus quality and restore the blurriest? This is the most direct threat to the core claim, and it is the main ablation. Focus-only ranking spends budget on blurred stroma and fat that cannot change the diagnosis. Decision-sensitivity ranking should concentrate budget where tumor plausibly hides. If focus-only ranking reaches the same AUC and sensitivity at equal budget, the classifier-in-the-loop step is unnecessary. In that case the paper becomes a zero-shot spatially varying deblurring paper, and we would retarget the contribution accordingly.

Why not just train the classifier with blur augmentation? Augmentation can make embeddings tolerant of mild blur, but it cannot recover chromatin and nuclear-contour detail that the optics removed. Cai et al.'s drop from 95.15% to 82.82% on blurred cells, and STAR-RL's gap between degraded and restored PCam accuracy (93.06% vs 96.41%), suggest there is real information to recover. We will train a blur-augmented CLAM as an extra baseline. If it closes the gap on the tumor-under-blur stratum, that is a negative result for restoration in general, not only for our method.

Proposed Experiments

The main benchmark is Camelyon16 (270 training / 129 test slides). We apply synthetic spatially varying defocus generated from smooth random focus surfaces at three severity levels. Positive slides are stratified by whether the defocus overlaps annotated tumor.

The primary metrics are slide AUC, sensitivity on the tumor-under-blur stratum, false-positive rate on negative slides with heavy blur (the hallucination check), and GPU-hours per slide. The rescan score is evaluated by its AUC for predicting which slides the degraded-input classifier gets wrong. It should also correlate with the gap between restored-slide and sharp-slide predictions.

For real defocus, we use the public 3DHistech cytopathology data to measure patch PSNR and LPIPS against Cai et al.'s reported 28.91 and 0.0735, as context only. We also report downstream patch accuracy on PCam with defocus applied.

Three checks decide the outcome. The first is the curve of AUC and tumor-under-blur sensitivity against compute budget for decision-sensitivity ranking versus focus-only ranking. Our ranking must dominate at small budgets, roughly up to 10% of uniform cost, or the central claim fails. The second is whether restored slides produce new false positives on negatives at a rate above the degraded baseline. If they do, the prior is inventing tumor and the method is unsafe as a diagnostic aid. The third is whether the rescan score identifies the misclassified slides better than the mean focus score does. If it does not, the posterior spread carries no information beyond blur severity.