MSRepaint: Multiple Sclerosis Repaint with Conditional Denoising Diffusion Implicit Model for Bidirectional Lesion Filling and Synthesis

Jinwei Zhang, Lianrui Zuo, Yihao Liu, Hang Zhang, Samuel W. Remedios, Bennett A. Landman, Peter A. Calabresi, Shiv Saidha, Scott D. Newsome, Dzung L. Pham, Jerry L. Prince, Ellen M. Mowry, Aaron CarassarXiv 2025 · DOI

Abstract

In multiple sclerosis, lesions interfere with automated magnetic resonance imaging analyses such as brain parcellation and deformable registration, while lesion segmentation models are hindered by the limited availability of annotated training data. To address both issues, we propose MSRepaint, a unified diffusion-based generative model for bidirectional lesion filling and synthesis that restores anatomical continuity for downstream analyses and augments segmentation through realistic data generation. MSRepaint conditions on spatial lesion masks for voxel-level control, incorporates contrast dropout to handle missing inputs, integrates a repainting mechanism to preserve surrounding anatomy during lesion filling and synthesis, and employs a multi-view DDIM inversion and fusion pipeline for 3D consistency with fast inference. Extensive evaluations demonstrate the effectiveness of MSRepaint across multiple tasks. For lesion filling, we evaluate both the accuracy within the filled regions and the impact on downstream tasks including brain parcellation and deformable registration. MSRepaint outperforms the traditional lesion filling methods FSL and NiftySeg, and achieves accuracy on par with FastSurfer-LIT, a recent diffusion model-based inpainting method, while offering over 20 times faster inference. For lesion synthesis, state-of-the-art MS lesion segmentation models trained on MSRepaint-synthesized data outperform those trained on CarveMix-synthesized data or real ISBI challenge training data across multiple benchmarks, including the MICCAI 2016 and UMCL datasets. Additionally, we demonstrate that MSRepaint's unified bidirectional filling and synthesis capability, with full spatial control over lesion appearance, enables high-fidelity simulation of lesion evolution in longitudinal MS progression.

Introduction

Multiple Sclerosis (MS) is characterized by the presence of white matter lesions that appear as hyperintensities on structural MRI scans. These lesions pose significant challenges for automated neuroimaging pipelines. Specifically, they interfere with brain parcellation and deformable registration by introducing non-anatomical signals that confuse standard algorithms. To mitigate this, "lesion filling" is used to replace these regions with healthy-looking tissue. Conversely, the development of robust lesion segmentation models is often limited by the scarcity of high-quality annotated data. "Lesion synthesis" addresses this by generating realistic synthetic lesions to augment training sets. Historically, these tasks have been treated as separate problems, often relying on methods that produce artifacts or are computationally prohibitive.

Methodology

MSRepaint addresses these challenges by framing both filling and synthesis as a unified conditional image inpainting task using a Denoising Diffusion Implicit Model (DDIM). The framework introduces several key innovations to ensure anatomical realism and computational efficiency.

MSRepaint Framework Overview: (a) Training data preparation; (b) Training with mask guidance; (c) Inference using the lesion repaint mechanism; (d) Bidirectional task examples.

The model utilizes a dual-mask control system during inference: a target mask ($M^{target}$) specifying the desired outcome (e.g., healthy tissue or lesion) and a repaint mask ($M^{repaint}$) defining the spatial region for update. A novel repainting mechanism iteratively blends generated pixels with the original image during the reverse diffusion process, ensuring seamless integration with the surrounding anatomy. To achieve 3D consistency without the overhead of full 3D diffusion, MSRepaint employs a multi-view fusion approach, processing 2D slices across axial, coronal, and sagittal planes. Furthermore, "contrast dropout" is utilized during training to ensure robustness against missing MRI modalities (e.g., T1w, T2w, or FLAIR).

Results and Discussion

MSRepaint demonstrates significant improvements in both speed and accuracy. In lesion filling tasks, it achieves results comparable to state-of-the-art diffusion-based methods like FastSurfer-LIT while being over 20 times faster, reducing processing time from approximately 60 minutes to just 3 minutes per volume. It effectively eliminates the spike artifacts common in traditional methods like FSL and NiftySeg, leading to improved downstream performance in brain parcellation and registration.

Visual examples of the bidirectional capabilities of MSRepaint, showing the input $x_0$, masks, and the resulting output $\hat{x}'_0$ for both filling and synthesis.

In lesion synthesis, MSRepaint-generated data proved superior for training segmentation models compared to traditional "copy-paste" augmentation methods like CarveMix. By generating lesions that are anatomically integrated, the model prevents downstream segmentors from overfitting to edge artifacts, resulting in higher Lesion-wise F1 scores on public benchmarks like MICCAI 2016 and UMCL. The unified nature of the model also allows for the high-fidelity simulation of longitudinal lesion evolution, providing a tool for modeling disease progression.

Conclusion

MSRepaint provides a robust, efficient, and unified solution for bidirectional MS lesion manipulation. By leveraging multi-view diffusion and a sophisticated repainting mechanism, it bridges the gap between high-fidelity generation and practical clinical utility. Future work will focus on integrating explicit temporal modeling to automatically predict lesion evolution and expanding the framework to other neurological pathologies such as stroke or brain tumors.

Summary updated

BibTeX
@misc{zhang2025msrepaint,
  author = {Jinwei Zhang and Lianrui Zuo and Yihao Liu and Hang Zhang and Samuel W. Remedios and Bennett A. Landman and Peter A. Calabresi and Shiv Saidha and Scott D. Newsome and Dzung L. Pham and Jerry L. Prince and Ellen M. Mowry and Aaron Carass},
  title = {{MSRepaint: Multiple Sclerosis Repaint with Conditional Denoising Diffusion Implicit Model for Bidirectional Lesion Filling and Synthesis}},
  year = {2025},
  eprint = {2510.02063},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.02063},
  howpublished = {arXiv},
}
Figure