Skip to main content

Fast and lightweight MRSegmentator CLI powered by the KonfAI framework.

Project description

License PyPI version Python CI Paper

MRSegmentator-KonfAI

Fast and lightweight CLI for whole-body MRI segmentation using MRSegmentator models within the KonfAI framework.


🧩 Overview

MRSegmentator-KonfAI is a lightweight command-line interface (CLI) for running MRSegmentator models through the KonfAI deep learning framework.

It provides fast and efficient inference for whole-body MRI segmentation, including on low-resource hardware.

Pretrained models are automatically downloaded from Hugging Face Hub.

⭐ Key Advantages

📦 Lightweight model distribution

  • ~128 MB per model, with up to 5 folds available
  • Download only the folds you need
  • Total size with 5 folds: ~640 MB
  • 🔁 Compared to ~1.07 GB for the original full MRSegmentator model distribution

➡️ Faster setup, smaller disk footprint


⚡ Efficient inference

🔬 Performance comparison (single CT volume)

Experimental setup

  • Input volume size: 512 × 512 × 366
  • GPU: NVIDIA RTX 6000
  • CPU: Intel® Xeon® w5-3425

Original MRSegmentator

Configuration Time Peak RAM Peak VRAM
1 fold 160.3 s 82.3 GB ~3.5 GB
5 folds 166.4 s 82.8 GB ~5.1 GB

MRSegmentator-KonfAI

Configuration Time Peak RAM Peak VRAM
1 fold 42.6 s 29.7 GB ~2.2 GB
5 folds (ensemble) 49.0 s 29.7 GB ~3.7 GB

📈 Key observations

  • ~3–4× faster inference compared to the original MRSegmentator
  • ~2.8× lower RAM usage (≈ 30 GB vs ≈ 83 GB)

🧠 Features

  • Fast inference powered by KonfAI
  • 🤗 Automatic model download from Hugging Face
  • 🧩 Multi-model ensembling
  • 🧠 Supports evaluation workflows with reference data, and uncertainty estimation without reference
  • 🧾 Multi-format compatibility: supports all major medical image formats handled by ITK

🚀 Installation

From PyPI:

python -m pip install mrsegmentator-konfai

From source:

git clone https://github.com/vboussot/KonfAI.git
python -m pip install -e apps/mrsegmentator

⚙️ Usage

Run inference on an MRI scan:

mrsegmentator-konfai -i path/to/input.nii.gz -o ./Output/

Optional arguments

Flag Description Default
-i, --input Path to the input MRI volume required
-o, --output Path to save the segmentation ./Output/
--gt Path to reference segmentation (ground truth), if available (enables evaluation workflows) unset
--mask Path to region-of-interest mask used for evaluation and uncertainty analysis unset
-f, --folds Number of model folds to ensemble (1–5) 2
-uncertainty Save uncertainty maps False
--gpu GPU list (e.g. 0 or 0,1) CPU if unset
--cpu Number of CPU cores (if no GPU) 1
-q, --quiet Suppress console output False

Example

mrsegmentator-konfai -i path/to/input.nii.gz -o ./Output/ --gt path/to/reference.nii.gz --mask path/to/mask.nii.gz --gpu 0 -f 3 -uncertainty

📖 Reference

If you use MRSegmentator-KonfAI in your work, please cite the original MRSegmentator work in addition to this CLI tool.

  • Häntze, H. et al. (2025).
    Segmenting Whole-Body MRI and CT for Multiorgan Anatomic Structure Delineation.
    Radiology: Artificial Intelligence, 7(6). https://doi.org/10.1148/ryai.240777

  • Boussot, V., & Dillenseger, J.-L. (2025).
    KonfAI: A Modular and Fully Configurable Framework for Deep Learning in Medical Imaging.
    arXiv preprint arXiv:2508.09823


🔗 Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrsegmentator_konfai-1.5.8.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mrsegmentator_konfai-1.5.8-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file mrsegmentator_konfai-1.5.8.tar.gz.

File metadata

  • Download URL: mrsegmentator_konfai-1.5.8.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mrsegmentator_konfai-1.5.8.tar.gz
Algorithm Hash digest
SHA256 3da952cd45d63ba782eb034de67a28c84f667c7c622adb41a5c2c4f4014c0153
MD5 164ca1c67ce7c8db3e528ebe92421efd
BLAKE2b-256 bd57a650c0f97bd3473d9ade39871b7cab47022dea0fa92f39c2ca5d6bd2b3e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mrsegmentator_konfai-1.5.8.tar.gz:

Publisher: publish.yml on vboussot/KonfAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mrsegmentator_konfai-1.5.8-py3-none-any.whl.

File metadata

File hashes

Hashes for mrsegmentator_konfai-1.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b24c49e0e19db60756292b674df23969e6a48272aab85bb41cceac1e0b8b0e0f
MD5 7235bf9b3c054d9ac8a3e45ccc680d5f
BLAKE2b-256 24b1dbd454f23575ce4f5bfa1f3ed86a3ff40fd18177681cc2ba77f871c3c112

See more details on using hashes here.

Provenance

The following attestation bundles were made for mrsegmentator_konfai-1.5.8-py3-none-any.whl:

Publisher: publish.yml on vboussot/KonfAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page