Abstract
Virtual stain transfer leverages computer-assisted technology to transform the histochemical staining patterns of tissue samples into other staining types. However, existing methods often lose detailed pathological information due to the limitations of the cycle consistency assumption. To address this challenge, we propose STNHCL, a hypergraph-based patch-wise contrastive learning method. STNHCL captures higher-order relationships among patches through hypergraph modeling, ensuring consistent higher-order topology between input and output images. Additionally, we introduce a novel negative sample weighting strategy that leverages discriminator heatmaps to apply different weights based on the Gaussian distribution for tissue and background, thereby enhancing traditional weighting methods. Experiments demonstrate that STNHCL achieves state-of-the-art performance in the two main categories of stain transfer tasks. Furthermore, our model also performs excellently in downstream tasks.
Introduction
In clinical histopathology, Hematoxylin and Eosin (H&E) staining is the standard for initial diagnosis due to its efficiency and low cost. However, complex diagnoses often require specialized histochemical stains (e.g., PAS, MAS, PASM) or immunohistochemical (IHC) markers, which are expensive and time-consuming to produce. Virtual stain transfer aims to synthesize these specialized stains from H&E images using deep learning.
Traditional approaches often rely on cycle consistency, which can inadvertently lead to the loss of fine-grained pathological details. While recent patch-wise contrastive learning methods have improved structural preservation, they typically focus on pairwise patch relationships. This paper introduces STNHCL, which utilizes hypergraph modeling to capture the complex, higher-order architectural relationships inherent in tissue morphology, coupled with a dual normal distribution weighting strategy for more effective contrastive learning.
Methodology
Hypergraph Modeling and HGNN
Unlike standard graphs where edges connect only two nodes, a hypergraph allows a single "hyperedge" to connect multiple patches. STNHCL employs soft k-means clustering to group patches into hyperedges based on semantic similarity. By processing these groups through a Hypergraph Neural Network (HGNN), the model ensures that the complex topological relationships of the input H&E image—such as the organization of tumor cells or glomerular structures—are preserved in the generated output.
Dual Normal Distribution Weighting
Contrastive learning relies on distinguishing "positive" pairs (corresponding patches in different domains) from "negative" pairs (different patches). Previous methods often used extreme "hard" weighting, focusing solely on the most similar negatives, which can introduce noise.
STNHCL introduces a more nuanced approach. It uses the discriminator's heatmap to categorize patches into "tissue" and "background." It then applies a Gaussian (Normal) distribution weighting strategy. This allows the model to focus on a "sweet spot" of informative negative samples—those that are similar enough to be challenging but not so identical as to be misleading—avoiding the vanishing gradient or exploding weight issues found in exponential weighting schemes like MoNCE.
Experimental Results
Quantitative Performance
The STNHCL framework was evaluated on the Human Kidney and Human Lung (ANHIR) datasets. It consistently outperformed state-of-the-art models such as StarGAN, GramGAN, and UMDST across multiple metrics:
- Structural Fidelity: On the Human Lung dataset, STNHCL achieved a Contrast Structure Similarity (CSS) of 0.943, indicating superior preservation of tissue architecture.
- Image Realism: The model achieved the lowest Frechet Inception Distance (FID) of 35.66, suggesting the generated images are statistically very similar to real stained samples.
Qualitative Comparison
Visual inspections confirm that STNHCL produces images with clearer boundaries and more accurate color distributions compared to competing methods. It avoids the artifacts and blurred details often seen in cycle-consistency-based models.
Downstream Task Validation
To test clinical utility, the synthesized images were used to train a glomeruli segmentation model. Notably, a segmentation model trained on STNHCL-generated PASM images achieved a mean Average Precision (mAP) of 0.446, significantly outperforming a model trained on real H&E images (0.380). This demonstrates that the virtual stain transfer adds tangible diagnostic value by highlighting features not easily segmented in the original H&E domain.
Discussion and Conclusion
STNHCL represents a significant advancement in virtual stain transfer by moving beyond pairwise patch constraints and extreme weighting strategies. By leveraging hypergraphs, the model captures the hierarchical nature of biological tissue. While the computational cost of hypergraph construction and the sensitivity of Gaussian hyperparameters are areas for future optimization, the current results demonstrate state-of-the-art performance and high clinical relevance. Future work will focus on scaling these methods to high-resolution Whole Slide Images (WSIs) and testing generalization across a wider variety of organ tissues.
Summary updated