YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- MedSynV2: Flexible Control of 3D CT Generation via Text and Semantically-Defined Segmentation Prompts
- π§ Overview
- β¨ Key Features
- π§© Method Overview
- π Results Summary
- π¦ Code Status
- 0. Create conda environment
- 1. Download pretrained models
- 2.1 If you prefer report, extract text features
- 2.2 Latent feature generation
- 2.3 OpenSora decoding
- 3.1 If you need masks encoded, encode the mask first
- 3.2 (Optional) If you need reports as well, follow 2.1 above
- 3.3 Latent feature generation with mask features (and reports)
- 3.4 OpenSora Decoding
- If you find any issue implementing the inference, please let us know
- License and copyright
- π Citation
- Credits
- π§ Overview
MedSynV2: Flexible Control of 3D CT Generation via Text and Semantically-Defined Segmentation Prompts
Weicheng Dai1,
Chenyu Wang1,
Shantanu Ghosh1,
Kayhan Batmanghelich1*
1Department of Electrical and Computer Engineering, Boston University
*Corresponding author
ECCV 2026
π Read the manuscript (ECCV 2026)
π§ Overview
MedSynV2 is a flexible multimodal framework for controllable 3D medical image generation, designed to overcome the limitations of existing text-only or segmentation-only conditioning methods.
Our model supports optional and partial conditioning from:
- π Radiology reports (semantic, flexible)
- π§© Segmentation prompts (precise, spatial)
Crucially, MedSynV2 does not require full-organ annotations.
Users may provide segmentation for a specific anatomy or abnormality, whose semantic meaning is specified through an accompanying text description.
This design enables scalable, fine-grained control over volumetric generation while maintaining high image fidelity. For the full technical details, method description, and experimental results, please see our manuscript.
β¨ Key Features
- π Multimodal conditioning: text-only, segmentation-only, or both
- π§© Partial segmentation support (no full-organ masks required)
- π§ Strong semantic grounding via text-described segmentation prompts
- β‘ Memory-efficient diffusion transformer for high-resolution 3D volumes
- π Gated attention for long radiology reports
- 𧬠Generates anatomically consistent, high-resolution CT volumes
π§© Method Overview
MedSynV2 extends diffusion transformers to jointly process:
- Image tokens
- Segmentation tokens
- Text tokens from radiology reports
A gated attention mechanism enables effective conditioning on long, unstructured clinical text, while preserving spatial controllability through segmentation prompts.
π Results Summary
We evaluate MedSynV2 on large-scale 3D CT datasets, using:
- Perceptual metrics (FID, SSIM, PSNR)
- Semantic consistency metrics
- Radiologist evaluation
Key findings:
- π ~24% relative improvement in mean FID
- π§ Strong semantic alignment between generated and real CT volumes
- 𧬠High-resolution, anatomically coherent synthesis
- π Improved data efficiency when used for data augmentation
- π± Generalization to concepts beyond training distribution
π¦ Code Status
The full release will include:
- Model architecture and diffusion transformer implementation
- Multimodal conditioning pipelines
- Inference scripts
0. Create conda environment
conda env create -f environment.yml
If flash-attention raises issue, please follow the original github and compile flash-attn==2.7.4.post1.
1. Download pretrained models
| pretrained model components | Checkpoints |
|---|---|
| Text model (same as MedSyn) | pretrained_lm |
| MedSynV2 Generator | final_ckpt |
| OpenSora checkpoint | vae.ckpt |
2.1 If you prefer report, extract text features
Here's an example.
cd src
python extract_text_feature.py --prompt 'There is no airspace opacity, effusion or pneumothorax. There is no evidence of suspicious pulmonary nodule or mass.' \
--text_model_path './model/pretrained_lm' \
--save_path './result/text_feature/normal.npy'
2.2 Latent feature generation
cd src
python medsynv2_DiT_reportonly.py --text_feature_folder './text_feature' \
--pretrain_model_path ./model/medsynv2_dit_x0.pth \
--save_path './tmp/medsynv2_dit_x0_results_reportonly'
2.3 OpenSora decoding
cd opensora/osp
python examples/recon_ct.py --pretrained_model_path './model/vae.ckpt' \
--folder './tmp/medsynv2_dit_x0_results_reportonly' \
--save_folder './tmp/medsynv2_dit_x0_results_reportonly_SR'
if you need to convert it to nifti
python examples/convert.py --folder './tmp/medsynv2_dit_x0_results_reportonly_SR' \
--save_folder './tmp/medsynv2_dit_x0_results_reportonly_SR_nii'
3.1 If you need masks encoded, encode the mask first
We encode the masks with batch_index from 0 to 5, as a 48GB GPU will only handle this size.
After running, concatenate them along the depth axis (trivial).
Make sure your masks are binary masks.
Note we extract contours of lobes with encode_masks_lobe.py
cd opensora/osp
python examples/encode_masks.py --batch_index 0 \ # you should use 0~5 here
--pretrained_model_path './model/vae.ckpt' \
--folder 'YOUR NIFTI MASKS' \
--save_folder 'YOUR MASKS_LATENTS FOLDER'
3.2 (Optional) If you need reports as well, follow 2.1 above
Otherwise create some dummy npy files in the text_feature folder, just as file name indicator.
3.3 Latent feature generation with mask features (and reports)
Make sure you check line 559 and put corresponding masks into each folders. The pre-conditions (indicating which masks) are already extracted and uploaded.
cd src
python medsynv2_DiT_reportonly.py --text_feature_folder './text_feature' \
--mask_folder 'YOUR MASKS_LATENTS FOLDER' \
--pretrain_model_path ./model/medsynv2_dit_x0.pth \
--save_path './tmp/medsynv2_dit_x0_results_report_mask' \
--include_report
| anatomy / abnormality | corresponding suffix index |
|---|---|
| lobes | 1 |
| airways | 2 |
| vessel | 3 |
| heart | 4 |
| consolidation | 5 |
| ground glass opacity | 6 |
| pericardial effusion | 7 |
| pleural effusion | 8 |
| nodule | 9 |
3.4 OpenSora Decoding
The same as 2.3
If you find any issue implementing the inference, please let us know
License and copyright
The source code is Licensed under Apache License 2.0. Model weights is Licensed under Custom Academic License for Model Weights.
π Citation
If you find this work useful, please cite:
@InProceedings{dai2026medsynv2,
author="Dai, Weicheng
and Wang, Chenyu
and Ghosh, Shantanu
and Batmanghelich, Kayhan",
editor="Favaro, Paolo
and Kukelova, Zuzana
and Maki, Atsuto
and Rohrbach, Anna
and Schindler, Konrad
and Tombari, Federico",
title="MedSynV2: Flexible Control of 3D CT Generation via Text and Semantically-Defined Segmentation Prompts",
booktitle="Computer Vision -- ECCV 2026",
year="2026",
publisher="Springer Nature Switzerland",
address="Cham",
pages="396--413",
isbn="978-3-032-37517-9"
}
Credits
The code is heavily based on MedSyn and OpenSoraPlan.
- Downloads last month
- 17