Harmonizing flows: Leveraging normalizing flows for unsupervised and source-free MRI harmonization

Farzad Beizaee, Gregory A. Lodygensky, Christopher L. Adamson, Deanne K. Thompson, Jeanie L. Y. Cheong, Alicia J. Spittle, Peter J. Anderson, Christian Desrosiers, Jose Dolz

Medical imaging is currently grappling with a "reproducibility crisis" rooted in hardware variability. A brain scan performed on a Siemens scanner in New York often yields different image characteristics than one performed on a Philips scanner in London. These subtle variations in contrast, noise, and intensity—collectively known as domain shift—can significantly degrade the performance of even the most sophisticated deep learning models.

In a recent study published in Medical Image Analysis, Beizaee et al. introduce Harmonizing Flows, a novel framework designed to standardize MRI data across disparate sites. Crucially, this method operates without requiring the sharing of sensitive patient data or the use of "traveling subjects" (scanning the same individual at multiple locations).

The Challenge of Domain Shift in MRI

Deep learning models are highly sensitive to changes in data distribution. In the context of MRI, this distribution is shaped by scanner hardware, specific acquisition protocols, and the demographics of the patient population. Traditional harmonization techniques typically rely on supervised methods or access to the original "source" training data. However, strict privacy regulations like GDPR and HIPAA often make data sharing impossible, necessitating source-free, unsupervised harmonization solutions.

The goal of Harmonizing Flows is to take an image from an unknown "target" scanner and transform its appearance to match a "source" scanner's style, ensuring consistency for downstream tasks like segmentation or classification.

Proposed Methodology: Harmonizing Flows

The framework utilizes generative modeling, specifically Normalizing Flows (NF), to align MRI data from diverse scanners to a common reference distribution. The pipeline consists of three primary stages:

  1. Source Distribution Modeling: An NF network is trained to capture the exact probability distribution of a reference source domain. Normalizing flows are uniquely suited for this as they provide a precise evaluation of data likelihood, effectively learning a mathematical "fingerprint" of the source domain's image characteristics.
  2. Harmonizer Pre-training: A shallow "harmonizer" network (based on a UNet architecture) is trained to reconstruct original source images from heavily augmented versions. This stage teaches the network to "clean up" and restyle images while preserving structural integrity.
  3. Test-time Adaptation: During inference, when an image from a new target scanner is encountered, the harmonizer is updated. The frozen NF model acts as a "teacher," guiding the harmonizer to adjust the input image until its output achieves a high likelihood under the learned source distribution.
The three-step pipeline for Harmonizing Flows: NF training, harmonizer pre-training, and test-time adaptation.

Experimental Setup and Datasets

The authors evaluated the framework across a wide range of populations and tasks, including adult brain MRI segmentation (using ABIDE, HBN, and OASIS datasets) and neonatal brain MRI (using dHCP and V2LP datasets). The study included both T1-weighted and T2-weighted MRIs, focusing on 15-label adult segmentation, 35-label neonatal segmentation, and neonatal gestational age estimation.

Results and Discussion

Harmonizing Flows consistently outperformed state-of-the-art methods such as CycleGAN, ComBat, and Histogram Matching. In adult brain segmentation tasks, the method improved the Dice Similarity Coefficient (DSC) by over 45% compared to a non-harmonized baseline.

A key strength of the method is its consistency across different site combinations. As shown in the cross-site performance matrix, Harmonizing Flows effectively bridges the performance gaps seen in unharmonized data, providing a stable output regardless of the source or target domain.

Cross-site brain MRI segmentation performance matrix. Harmonizing Flows (bottom right) demonstrates superior consistency across all site combinations compared to baseline and alternative methods.

Beyond performance, the framework offers several conceptual advantages:

  • Source-Free & Task-Agnostic: It does not require original training data for adaptation and works across various downstream tasks.
  • Anatomical Preservation: By combining Structural Similarity Index (SSIM) and L1 losses, the harmonizer modifies image style while strictly maintaining the underlying anatomy.
  • Stopping Criterion: The authors utilize Bits Per Dimension (BPD) to determine when to stop adaptation, ensuring the target image aligns correctly with the source distribution.

Conclusion

Harmonizing Flows represents a significant step toward solving the domain shift problem in medical imaging. While test-time adaptation introduces additional computational overhead compared to simple feed-forward models, its ability to provide unsupervised, source-free harmonization makes it a powerful tool for large-scale multi-site clinical studies.

Summary updated

BibTeX
@article{beizaee2025harmonizing,
  author = {Farzad Beizaee and Gregory A. Lodygensky and Christopher L. Adamson and Deanne K. Thompson and Jeanie L. Y. Cheong and Alicia J. Spittle and Peter J. Anderson and Christian Desrosiers and Jose Dolz},
  title = {{Harmonizing flows: Leveraging normalizing flows for unsupervised and source-free MRI harmonization}},
  journal = {Medical Image Analysis},
  year = {2025},
  doi = {10.1016/j.media.2025.103483},
}
Figure