Abstract
Training robust deep learning models for tumor segmentation in histopathology requires vast amounts of high-quality, annotated data. However, pixel-level annotation of Whole Slide Images (WSIs) is labor-intensive and requires significant expertise. We present PathoPainter, a novel framework that reformulates data augmentation as a conditional tumor inpainting task. By utilizing Latent Diffusion Models (LDMs) to "paint" tumors into real tissue backgrounds, PathoPainter ensures biological authenticity and pixel-perfect mask alignment. Our method incorporates regional embedding sampling for diversity and a self-adaptive filtering strategy for quality control. Experimental results on CAMELYON16, DCIS, and CATCH datasets show that PathoPainter consistently outperforms existing synthesis methods, providing a significant performance boost in low-data regimes.
Introduction
The development of automated tumor segmentation tools is critical for pathology workflows, yet the "data bottleneck" remains a primary challenge. Traditional data augmentation techniques often fail to capture the complex morphological variations of tumors, while existing generative models frequently struggle with mask-image alignment—where the generated tumor boundaries do not strictly match the provided segmentation mask. This misalignment introduces noise that can degrade model performance. PathoPainter addresses these challenges by treating the generation process as a localized inpainting task, preserving the authentic context of the surrounding tissue while injecting diverse tumor characteristics.
Methodology
PathoPainter leverages Latent Diffusion Models (LDMs) to perform tumor-aware inpainting. Unlike standard generative approaches that synthesize entire images, PathoPainter takes a real histopathology image and a corresponding mask, then "inpaints" the masked region with a new tumor.
Regional Embedding Sampling
To maximize the diversity of the generated data, the framework decouples tumor "content" from its "style." During inference, the model can extract a regional embedding (style) from a tumor in one image and apply it to a masked region in a different background image. This allows for the creation of novel tumor-background combinations that were not present in the original training set.
Self-Adaptive Filtering
To ensure the quality of the synthetic training pairs, PathoPainter employs a self-adaptive filtering mechanism. A segmentation model pre-trained on real data evaluates the synthetic images. If the model exhibits high uncertainty (loss) in the synthetic region, that region is flagged as "noisy" and excluded from the final training set. This automated quality control prevents the segmentation model from learning from unrealistic or poorly aligned synthetic examples.
Experimental Results
We evaluated PathoPainter against state-of-the-art methods like DiffTumor and STEDM across three datasets: CAMELYON16 (breast cancer metastasis), DCIS (ductal carcinoma in situ), and CATCH (canine cutaneous cancer).
As shown in Figure 1, PathoPainter produces tumors that blend seamlessly into the biological environment, avoiding the "pasted-on" appearance seen in other methods. Quantitatively, PathoPainter achieved a significant improvement in Intersection over Union (IoU). On the CAMELYON16 dataset with 20 training slides, IoU increased from 75.69% to 77.69%. In the DCIS 8-slide scenario, performance rose from 62.33% to 63.67%.
Conclusion
PathoPainter demonstrates that conditional inpainting is a powerful paradigm for histopathology data augmentation. By maintaining the integrity of the tissue background and ensuring precise mask alignment, the framework effectively mitigates the data scarcity problem. While diffusion-based generation is computationally intensive, the resulting improvements in segmentation accuracy—especially in low-data scenarios—justify the investment. Future research will explore extending this approach to rare disease subtypes and other medical imaging modalities.
Summary updated