siam / README.md
josand's picture
Fix author order in citation
76f42b1 verified
|
Raw History Blame Contribute Delete
6 kB
metadata
license: cc-by-4.0
library_name: mlx
tags:
  - mlx
  - native-mlx
  - apple-silicon
  - medical-imaging
  - mri
  - ct
  - brain
  - head
  - segmentation
  - nnunet
  - research
language:
  - en
inference: false
pipeline_tag: image-segmentation

SIAM 路 Head tissue segmentation

Segment brain and head tissues from any 3D head MRI or CT with SIAM v0.3, locally on Apple Silicon.

SIAM is the work of Romain Valabregue and co-authors. The model, its training method and the weights are theirs: see the original repository, github.com/romainVala/SIAM, and the paper, arXiv:2605.02737. This repository only repackages their released weights (Zenodo 17733431) for MLX on Apple Silicon. Please cite their paper and star their repository if SIAM is useful to you.

Original SIAM repository 路 SIAM paper 路 Original weights 路 nnunet-mlx runtime 路 Files

SIAM segmentations of a full-head T1 MRI and of a glioma case in T1, contrast-enhanced T1, T2 and FLAIR

SIAM v0.3 segmentations produced by this MLX port (five-fold ensemble); the 3D view is a cutaway of the predicted label surfaces. Left: full-head T1 from OpenNeuro ds000001, sub-01 (CC0, defaced). Right: glioma case 100 from Bartnik et al., Zenodo 22205631 (CC-BY-4.0, skull-stripped), the same model applied to each contrast.

Input Output
One 3D head volume (T1, T2, FLAIR, CT, ...) 路 NIfTI 17 tissue labels and an anomaly label

Apple Silicon 路 Metal 路 Python 3.13

SIAM (Segment It All Model) by Valabregue et al. is an nnU-Net residual-encoder network trained on synthetic images generated from a few high-quality head templates, so it does not depend on the input contrast. Version 0.3 adds an Anomalies label for pathology. It predicts at 0.75 mm isotropic and returns labels on the input grid.

Quick start

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

uv pip install "nnunet-mlx>=0.7.1"
from nnunet_mlx.named_models import siam

result = siam(image_path="head.nii.gz", output_dir="outputs")
print(result["outputs"]["mask"])

Without weights_path, the runner downloads this repository into the shared MedMLX cache on first use. voxel_size= reproduces SIAM's -voxelsize option for small heads, such as newborns; fold= selects one fold instead of the ensemble.

The runner follows the inference of the original siam-pred -m 0: the volume is reoriented to RAS voxel order without interpolation, all folds are ensembled with Gaussian sliding windows at a 0.5 step and no mirroring, and the label map is reoriented back exactly onto the input grid.

Labels

Value Label Value Label
1 GM (cortical grey matter) 10 Accu (accumbens)
2 WM 11 Amyg (amygdala)
3 CSF 12 Hippo (hippocampus)
4 CSFv (ventricles) 13 Dura
5 cerGM (cerebellar grey matter) 14 vascular
6 Thal (thalamus) 15 Skull
7 Pal (pallidum) 16 Head (extracranial soft tissue)
8 Put (putamen) 17 Anomalies
9 Caud (caudate)

Conversion

Converted from the five-fold release on Zenodo 17733431 (pred_DS108_LcsfP_Ano, trainer nnUNetTrainerNoDA, 3d_fullres, epoch 4000). Network weights are stored as float32 safetensors; no retraining, pruning or quantization. Optimizer state and the duplicate decoder aliases of encoder weights are not carried over. To reproduce from the original release:

uv pip install "nnunet-mlx[convert]"
nnunet-mlx convert pred_DS108_LcsfP_Ano siam

Checked against PyTorch nnU-Net 2.8.1 (CPU, float32) running the same inference as siam-pred: all five folds, 0.5-step Gaussian sliding windows, no mirroring. On a full-head T1 MRI, 99.995% of voxels receive the same label, every label has a Dice of at least 0.9996 except Anomalies (0.998, under 0.5 mL in that healthy head), and class probabilities differ by at most 0.004. On fold 0, a skull-stripped glioma T1 in LPS orientation, which exercises the reorientation path, gives 99.990% voxel agreement with a minimum Dice of 0.9995.

A typical head MRI needs about 16 GB of unified memory; memory grows with the field of view.

Use & license

For research and education. Not validated for clinical use.

Weights: CC-BY-4.0, as released by the SIAM authors. Credit Valabregue et al. and cite the SIAM paper when you use these weights. Upstream code: Apache-2.0.

Paper references

Citation

Please cite SIAM:

Valabregue, R., Khemir, I., Bardinet, E., Rousseau, F., Auzias, G. & Dorent, R. (2026). SIAM: Head and Brain MRI Segmentation from Few High-Quality Templates via Synthetic Training. arXiv:2605.02737.

If you use MedMLX, please cite the MedMLX paper:

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