Skip to content

rendeirolab/stain-normalization-gpu

Repository files navigation

GPU-accelerated stain normalization for histology image processing

scverse x NVIDIA Hackathon

Team

Project Overview

Stain normalization is a critical preprocessing step in computational pathology that addresses color variations caused by differences in staining protocols, scanners, and tissue preparation techniques. These variations can significantly impact the performance of downstream analysis tasks.

Recent research has shown that many histology foundation models fail to adequately eliminate staining batch effects (see this paper), which negatively impacts multimodal integration and biomarker prediction accuracy.

This project delivers GPU-accelerated stain normalization algorithms using CuPy, providing substantial performance improvements on CUDA-enabled GPUs for large-scale histology image processing workflows.

Implementation

During the hackathon, we successfully implemented and benchmarked three widely-used stain normalization methods:

  • Reinhard normalization
  • Histogram matching
  • Macenko normalization

Results

Reinhard ✅

Our GPU-accelerated Reinhard implementation achieves 50-100x speedup compared to the NumPy-based torchstain implementation while maintaining identical visual results.

Visual Validation

Performance Benchmark

Histogram matching ✅

Our histogram matching implementation not only matches scikit-image results but also outperforms existing GPU implementations, including RAPIDS cuCIM.

Visual Validation

Performance Benchmark

Macenko ⚠️

While our Macenko implementation demonstrates the feasibility of GPU-accelerated stain separation, the results do not yet fully replicate existing implementations. This remains an area for future development.

Visual Comparison

Key Achievements

  • High-performance computing: Achieved 50-100x speedup for Reinhard normalization compared to existing CPU implementations

  • Algorithm fidelity: Successfully replicated visual results of established implementations for Reinhard and histogram matching methods

  • Competitive performance: Outperformed existing GPU implementations, including RAPIDS cuCIM, for histogram matching

Future Work

  • Optimize Macenko stain separation algorithm to match reference implementation accuracy
  • Extend support for additional stain normalization methods (e.g., Vahadane)
  • Integrate with popular computational pathology frameworks

Technical References

  • Reinhard: Reinhard, E., et al. "Color transfer between images." (2001). PDF

  • Macenko: Macenko, M., et al. "A method for normalizing histology slides for quantitative analysis." ISBI (2009). PDF

About

A GPU-accelerated stain normalization libarary for histology image processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages