File size: 2,502 Bytes
d79006c
 
4cde096
13c4c73
d79006c
f2817f4
d79006c
 
 
 
67f6d14
d79006c
 
 
 
 
8fec453
d79006c
8fec453
d79006c
8fec453
d79006c
fe0fbb4
d79006c
8fec453
 
 
 
ef680b6
8fec453
 
67f6d14
 
643bf83
4cde096
8fec453
fe0fbb4
643bf83
8fec453
1d72c67
67f6d14
 
8fec453
d79006c
 
 
 
643bf83
 
 
8fec453
643bf83
 
 
 
 
 
 
 
 
 
d79006c
 
8fec453
67f6d14
8fec453
67f6d14
8fec453
67f6d14
13c4c73
d00bbb8
 
 
 
7855d45
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
library_name: mlx
inference: false
license: mit
tags:
- mlx
- medical-imaging
- apple-silicon
- research
- inference
- safetensors
language:
- en
pipeline_tag: image-to-image
---

<img src="https://huggingface.co/MedMLX/lesiondiffusion-mlx/resolve/main/banner.png" alt="MedMLX — Generate. CT / LESION SYNTHESIS" width="100%">

# LesionDiffusion

Synthesize lesions in CT with native MLX using the released LMNet, LINet and VQ components.

[GitHub](https://github.com/MedMLX/lesiondiffusion-mlx) · [Files](https://huggingface.co/MedMLX/lesiondiffusion-mlx/tree/main) · [Docs](https://github.com/MedMLX/lesiondiffusion-mlx/blob/main/README.md#run) · [Paper](https://doi.org/10.64898/2026.10.28.26366762)

| Input | Output |
| :--- | :--- |
| CT + aligned binary organ mask | Synthetic CT and lesion mask |

**Apple Silicon · Metal · Python 3.13**

## Quick start

```bash
uv venv --python 3.13
source .venv/bin/activate

uv pip install "lesiondiffusion-mlx>=0.2.6"
uv tool install huggingface-hub

hf download MedMLX/lesiondiffusion-mlx model.safetensors tokenizer.json conversion.json --revision d00bbb8ad1c7170062f60b4386a38c3a4178f7ce --local-dir models
```

Replace the example input paths with your own files.

```python
from lesiondiffusion_mlx.medmlx import run

result = run(
    image_path="ct_1mm_ras.nii.gz",
    organ_mask_path="liver_mask.nii.gz",
    weights_path="models",
    output_dir="out",
    organ="liver",
    lesion_type="tumor",
    bbox_size_mm=[30, 30, 20],
    placement="inside_parenchyma",
    inference_mode="conditioned",
    diffusion_steps=200,
    seed=23,
)
print(result["outputs"]["synthetic_image"])
```

Use an aligned CT and binary organ mask on a RAS 1 mm grid. Synthetic output is not ground truth.

## Use & license

For research and education. Not validated for clinical use.

Weights: [MIT](SOURCE_LICENSE), as published by the LesionDiffusion authors. [Notices](https://huggingface.co/MedMLX/lesiondiffusion-mlx/blob/main/NOTICE).

## Paper references

- [Original model: LesionDiffusion: Towards Text-controlled General Lesion Synthesis](https://arxiv.org/abs/2503.00741).

## Citation

If you use MedMLX, please cite the [MedMLX paper](https://doi.org/10.64898/2026.10.28.26366762):

```bibtex
@article{sandoval2026medmlx,
  title   = {MedMLX: On-Device Medical Imaging AI for Apple Silicon},
  author  = {Sandoval, A. and Sandoval, J. and Saleem, A.},
  journal = {medRxiv},
  year    = {2026},
  doi     = {10.64898/2026.10.28.26366762}
}
```