Sign inSign up

openjdata/siamize

By openjdata

Updated 4 months ago

siamize - native C++/ONNX port of SIAM v0.3 brain segmentation (CUDA, OpenCL, TensorRT, CoreML)

Image
0

119

openjdata/siamize repository overview

siamize — native C++ port of SIAM v0.3 brain/head MRI segmentation

Native C++ port of SIAM v0.3 (Segment It All Model) for head/brain tissue segmentation — runs with no PyTorch / nnU-Net at inference time. One image, two GPU backends:

Binary (entrypoint)BackendHardware
siamize (default)ONNX Runtime + CUDA EPNVIDIA GPU, or CPU
siamize-openclMNN + OpenCLNVIDIA / AMD / Intel GPU, or CPU

Input: NIfTI (.nii/.nii.gz) or JNIfTI (.jnii/.bnii). Output: a uint8 labelmap (18 SIAM classes) or a 4D tissue-probability map. Fold weights auto-download from NeuroJSON on first run — mount a volume at /cache to keep them.

Quick start

--gpus all exposes the GPU (and the NVIDIA OpenCL driver). Mount your data at /data and a named cache volume at /cache.

# NVIDIA GPU, ONNX Runtime / CUDA — 5-fold ensemble (default entrypoint)
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/labels.nii.gz -M 0,1,2,3,4 -c cuda

# Single fold (faster, lighter)
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/labels.nii.gz -M 0 -c cuda

# Vendor-neutral GPU via MNN / OpenCL (NVIDIA / AMD / Intel) — override entrypoint
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    --entrypoint siamize-opencl openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/labels.nii.gz -M 0 -c opencl

# CPU only (no GPU needed — drop --gpus)
docker run --rm -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/labels.nii.gz -M 0 -c cpu

# List the OpenCL devices the container sees (then pick one with -G N)
docker run --rm --gpus all --entrypoint siamize-opencl \
    openjdata/siamize:v2026.6 --list-gpu

# 4D tissue-probability map (float32 softmax) instead of a labelmap
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/tpm.nii.gz -M 0,1,2,3,4 -c cuda --tpm

# SPM12-style 6-class output (GM, WM, CSF, Bone, Soft, Air)
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/spm.nii.gz -M 0 -c cuda -C spm

# JNIfTI output (JSON / binary, for the NeuroJSON ecosystem)
docker run --rm --gpus all -v "$PWD":/data -v siamize-cache:/cache \
    openjdata/siamize:v2026.6 \
    -i /data/in.nii.gz -o /data/labels.jnii -M 0 -c cuda -F jnii

Common options

FlagMeaning
-i FILEinput volume (.nii[.gz] / .jnii / .bnii)
-o FILEoutput file (extension picks the format, or use -F)
-M 0,1,2,3,4fold weights (digits 0–4 = the 5-fold ensemble; auto-downloaded)
-c {auto|cuda|cpu} (ORT) / {auto|opencl|cpu} (siamize-opencl)backend; auto picks GPU then falls back to CPU
-G NGPU device. ORT: CUDA index. siamize-opencl: 1-based device from --list-gpu
--list-gpu(siamize-opencl) list OpenCL devices and exit
-t NCPU threads (default auto)
-P ZxYxXsliding-window patch (default 256x256x192; smaller = less memory)
-u Starget isotropic spacing in mm (default 0.75)
-C N|spmoutput classes: 18 (default) or spm (6 TPM channels)
--tpmwrite a 4D float32 tissue-probability map instead of a labelmap
-F nii|jnii|bniioutput container
--lowmemforce the low-memory preset (smaller patch + tighter knobs)

Run --help (default entrypoint) for the full list:

docker run --rm openjdata/siamize:v2026.6 --help

Volumes & environment

Mount / varPurpose
-v "$PWD":/datayour input/output files
-v siamize-cache:/cachepersists auto-downloaded fold weights (+ OpenCL tuning cache) across runs
--gpus allrequired for any GPU run — exposes the GPU and the NVIDIA OpenCL driver

To confirm an OpenCL run is on the GPU (not a silent CPU fallback): the log shows device=opencl with no OpenCL init error, and nvidia-smi shows GPU activity. CPU-only hosts work with -c cpu and no --gpus.

Tags

Calendar-versioned vYYYY.M (e.g. v2026.6). The image is CUDA 12 + cuDNN 9 based; the MNN/OpenCL binary is static and vendor-neutral.

Acknowledgement: uses resources and data formats from the NeuroJSON project, supported by US NIH grant U24-NS124027.

Tag summary

Content type

Image

Digest

sha256:6b044b2dc

Size

2.2 GB

Last updated

4 months ago

docker pull openjdata/siamize:v2026.6