Skip to content

totalsegmentator-mlx 0.3.0

Latest

Choose a tag to compare

@sandovaljoseph sandovaljoseph released this 15 Nov 02:02

Breaking changes

Requires nnunet-mlx 0.9 and medmlx-core 0.3. run returns {"outputs", "artifacts", "details"}; the mask artifact is a label map on the input grid that lists the structures the run can write.

run and load_model are the whole Python API. segment(), configure_predictor_cache(), clear_predictor_cache() and predictor_cache_info() are removed, and prompt is now classes.

-from totalsegmentator_mlx import segment
-labels = segment("ct.nii.gz", model_dir="models", prompt=["liver"])
+from totalsegmentator_mlx import run
+result = run(image_path="ct.nii.gz", output_dir="out", classes=["liver"])

predict writes into a folder. It takes -o/--output-dir and --weights (downloads by default) instead of -o/--output and --model-dir, --organ is --classes, and --probabilities replaces --probabilities-path.

New

load_model() keeps the networks loaded across several CTs. with load_model() as model: model.run(...) takes run's arguments except weights_path.

run accepts model_part, force_split and probabilities. With probabilities=True it also writes probabilities.npz and probabilities.pkl for one uncropped model.

Fixes

The mask and its sidecar files are published together. An interrupted run no longer leaves a mask without its sidecars, or the reverse.