CodeBrain Fills Missing Brain MRI Scans With 29.43 dB Accuracy
CodeBrain reframes multi-modality MRI synthesis as a code prediction task, beating five prior methods on IXI and BraTS 2023 benchmarks.
ProTakeaways
- CodeBrain, a CVPR 2026 paper, unifies any-to-any brain MRI modality imputation via region-level scalar-quantised codes. arXiv
- Two-stage pipeline: reconstruct with disentangled anatomy plus full-stack codes, then predict codes from incomplete inputs using a grading loss.
- Beats five prior methods on IXI (29.43 dB PSNR, +0.89 dB over MMT) and BraTS 2023 (25.16 dB PSNR).
- Achieves 0.42% SSIM gain despite training only with PSNR-related losses, indicating strong anatomical disentanglement.
- Weakness: BraTS SSIM trails some baselines because tumor boundaries break region-consistency assumption.
- Code released at github.com/ycwu1997/CodeBrain, PyTorch 2.9 on 8x RTX 4090.
Getting a full stack of MRI scans of a patient's brain is a luxury most clinics cannot afford. Each modality (T1, T2, FLAIR, contrast enhanced) takes extra scanner time, extra money, and sometimes extra contrast dye injected into the patient. A team from Monash, Imperial College, SenseTime and NTU has released CodeBrain, a unified model that fills in whichever modalities you didn't scan, and it just landed a spot at CVPR 2026.
The paper, titled Virtual Full-stack Scanning of Brain MRI via Imputing Any Quantised Code, reframes an old problem in a way that turns out to work much better than the previous approaches.
The messy reality of multi-modal MRI
MRI provides critical insights into brain structure and pathology through multiple imaging modalities such as T1-weighted, T2-weighted, FLAIR, and contrast-enhanced sequences, but acquiring complete multi-modal datasets in clinical practice is often impractical due to time constraints, cost, potential health risks from contrast agents, and motion artifacts. That is where imputation comes in: synthesise the modalities you did not scan from the ones you did.
Prior work has taken two main routes. Existing unified methods either rely on specific prompts to guide their transformation network or require multiple modality-specific modules, and these approaches struggle to capture large modality and instance variations or become too complex to generalize effectively. In practice that meant either a fragile prompt-conditioned network or a zoo of pairwise translators (T1 to T2, T1 to FLAIR, T2 to FLAIR, and so on) that do not share knowledge well.

Treating imputation as a code prediction problem
CodeBrain's key move is conceptual. Instead of synthesising each missing modality independently, it predicts a compact representation of the entire modality set that encapsulates structural and intensity relationships across modalities, and represents these cross-modality relationships as scalar-quantised codes at the region level. This design preserves fine-grained variations and enables localised imputation that global conditioning approaches fail to achieve.
Scalar quantisation here means each region of the brain gets mapped to a small integer code drawn from a finite codebook, similar in spirit to how VQ-VAE tokenises images, but per-region and per-modality rather than one code stream per image. The full-stack code is essentially a compressed description of what every modality should look like for that specific patient's brain, region by region.
How the two-stage pipeline works
In the first stage, a reconstruction model learns to disentangle a complete brain MRI modality set into two components: shared, modality-agnostic features capturing the anatomical structure, and region-level scalar-quantised codes, named full-stack codes, that compactly represent modality-specific information. The anatomy is separated from the modality-specific appearance so it can be reused across sequences.
In the second stage, another encoder is trained with a customized grading loss to predict the full-modality codes from randomly masked MRI samples, supervised by the corresponding quantized codes generated from the first stage. In this way, the inter-modality transformation is achieved by mapping the instance-specific codes in a finite scalar space. The grading design lets a single network handle any combination of available and missing modalities without retraining for each scenario.

A few implementation details worth noting:
- The backbone is NAFNet, trained with AdamW at an initial learning rate of 1e-4.
- The total codebook size is 64,000 with d set to 6.
- Training ran for 250 epochs per stage on 8 NVIDIA GeForce 4090 GPUs; the IXI model comes in at 157.82 GMACs and 134.56 M parameters, taking around 84 hours to train end to end.
- Voxel intensities were min-max normalised to the 0-1 range across subjects and modalities before training.
The numbers
The team compared CodeBrain against five state-of-the-art imputation baselines on two public datasets. On the IXI dataset (healthy subjects with T1, T2, PD modalities), CodeBrain achieves an average PSNR of 29.43 dB, surpassing the previous best method (MMT) by 0.89 dB. On the BraTS 2023 dataset (brain tumor patients with T1, T2, FLAIR, T1Gd modalities), it maintains superior performance with 25.16 dB average PSNR. The method also achieves the highest SSIM values and lowest MAE across both datasets.
Interestingly, although training CodeBrain only uses PSNR-related losses without any structural loss for supervision, it still achieves an average 0.42% SSIM gain over the previous best method, suggesting CodeBrain learns an invariant anatomical representation shared among modalities. That points to the disentanglement in stage one doing real work rather than just shuffling pixels around.

Where it struggles
The tumor benchmark exposes an honest weakness. On BraTS 2023, SSIM performance is inferior to two baselines because CodeBrain does not involve any structure-related supervision for training, and BraTS samples contain inconsistent region information such as tumors with or without clear boundaries. Region-level codes assume the region layout is more or less stable across a modality set, and a large enhancing lesion visible only in T1Gd violates that assumption.
Why this matters and when to use it
For anyone working on downstream tasks like brain tumor segmentation, CodeBrain also improves performance in that setting, which suggests the imputed volumes are usable as inputs to other models rather than merely looking pretty. Practical use cases include:
- Filling in dropped modalities in retrospective clinical studies so that models trained on full four-modality BraTS-style inputs can still run.
- Data harmonisation across sites that use different acquisition protocols.
- Reducing scan time for patients who cannot tolerate a full protocol, particularly those where contrast injection carries risk.
The official code is on GitHub. All experiments were run on eight NVIDIA GeForce 4090 GPUs, with the repository built on PyTorch 2.9.1+cu128 and Python 3.12.12. If your work touches multi-modal medical image synthesis, unified any-to-any translation, or discrete-code representation learning for imaging, this one is worth a look.