Fast and lightweight TotalSegmentator CLI powered by the KonfAI framework.
Project description
TotalSegmentator-KonfAI
Fast and lightweight CLI for whole-body CT or MRI segmentation using TotalSegmentator models within the KonfAI framework.
🧩 Overview
TotalSegmentator-KonfAI is a lightweight command-line interface (CLI) for running TotalSegmentator models for multi-organ medical image segmentation, through the KonfAI deep learning framework.
It provides fast and efficient inference for segmentation tasks, including on low-resource hardware. Pretrained models are automatically downloaded from Hugging Face Hub.
⭐ Key Advantages
📦 Lightweight model distribution
- ~125 MB per model 1.5 mm model
- 🔁 Compared to ~234 MB per model for the original TotalSegmentator
- ~66.2 MB 3 mm models
- 🔁 Compared to ~135 MB (original)
➡️ 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 TotalSegmentator
| Configuration | Time | Peak RAM | Peak VRAM |
|---|---|---|---|
| Total – 5 models | 82.37 s | 33.1 GB | ~4.7 GB |
| Total 3 mm – 1 model | 30.07 s | 30.6 GB | ~3.4 GB |
TotalSegmentator-KonfAI
| Configuration | Time | Peak RAM | Peak VRAM |
|---|---|---|---|
| Total – 5 models | 61.55 s | 32.5 GB | ~4.3 GB |
| Total 3 mm – 1 model | 22.85 s | 10.5 GB | ~3.4 GB |
📈 Key observations
- Faster inference times compared to the original TotalSegmentator
- Significantly lower RAM usage for 3 mm models (≈ 10.5 GB vs ≈ 30.6 GB)
🧠 Features
- ⚡ Fast inference powered by KonfAI
- 🤗 Automatic model download from Hugging Face
- 🧠 Supports evaluation workflows with reference data
- 🧾 Multi-format compatibility: supports all major medical image formats handled by ITK
🚀 Installation
From PyPI:
python -m pip install totalsegmentator-konfai
From source:
git clone https://github.com/vboussot/KonfAI.git
python -m pip install -e apps/totalsegmentator
⚙️ Usage
Perform segmentation on an input volume:
totalsegmentator-konfai total -i path/to/image.nii.gz -o ./Output/
Optional arguments
| Flag | Description | Default |
|---|---|---|
TASK |
Input modality / model name on Hugging Face | total, total_mr, total_3mm, total_mr_3mm |
-i, --input |
Path to the input medical image | 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 |
--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
totalsegmentator-konfai total -i path/to/input.nii.gz -o ./Output/ --gt path/to/reference.nii.gz --mask path/to/mask.nii.gz --gpu 0 -uncertainty
📖 Reference
If you use TotalSegmentator-KonfAI in your work, please cite the original TotalSegmentator work in addition to this CLI tool.
-
Wasserthal, J. et al. (2023).
TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images.
Radiology: Artificial Intelligence, 5(5). https://doi.org/10.1148/ryai.230024 -
Akinci D’Antonoli, T. et al. (2025).
TotalSegmentator MRI: Robust Sequence-independent Segmentation of Multiple Anatomic Structures in MRI.
Radiology, 314(2). https://doi.org/10.1148/radiol.241613 -
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
- 🧠 Original TotalSegmentator: github.com/wasserth/TotalSegmentator
- 🤗 Model Hub: huggingface.co/VBoussot/TotalSegmentator-KonfAI
- 📦 PyPI Package: pypi.org/project/totalsegmentator-konfai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file totalsegmentator_konfai-1.5.3.tar.gz.
File metadata
- Download URL: totalsegmentator_konfai-1.5.3.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c1eab9600229ada0144c46dcf255a2552189ffbed99077d86ad89d9285b4241
|
|
| MD5 |
ce7e313dfaf12a47243314d6e5c13728
|
|
| BLAKE2b-256 |
fdb9dc861a3dd1d2bdb9dfaf8282947baf89e28af9feab0ee3ee5fc747e26e60
|
Provenance
The following attestation bundles were made for totalsegmentator_konfai-1.5.3.tar.gz:
Publisher:
publish.yml on vboussot/KonfAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
totalsegmentator_konfai-1.5.3.tar.gz -
Subject digest:
1c1eab9600229ada0144c46dcf255a2552189ffbed99077d86ad89d9285b4241 - Sigstore transparency entry: 902325029
- Sigstore integration time:
-
Permalink:
vboussot/KonfAI@651e9f0e73122b7225d540e8096c382fa5ece734 -
Branch / Tag:
refs/tags/v1.5.3 - Owner: https://github.com/vboussot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@651e9f0e73122b7225d540e8096c382fa5ece734 -
Trigger Event:
push
-
Statement type:
File details
Details for the file totalsegmentator_konfai-1.5.3-py3-none-any.whl.
File metadata
- Download URL: totalsegmentator_konfai-1.5.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cddcc85b787b96ac4288dfb2e572fdb647d4ae14c6b57a2587e8ee5c847f020
|
|
| MD5 |
50c6d4ba19160fb90455497603282c49
|
|
| BLAKE2b-256 |
36410ec04aeefea7842386e0f656732a04d7831304936f8871abc8e03fbe18ad
|
Provenance
The following attestation bundles were made for totalsegmentator_konfai-1.5.3-py3-none-any.whl:
Publisher:
publish.yml on vboussot/KonfAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
totalsegmentator_konfai-1.5.3-py3-none-any.whl -
Subject digest:
6cddcc85b787b96ac4288dfb2e572fdb647d4ae14c6b57a2587e8ee5c847f020 - Sigstore transparency entry: 902325154
- Sigstore integration time:
-
Permalink:
vboussot/KonfAI@651e9f0e73122b7225d540e8096c382fa5ece734 -
Branch / Tag:
refs/tags/v1.5.3 - Owner: https://github.com/vboussot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@651e9f0e73122b7225d540e8096c382fa5ece734 -
Trigger Event:
push
-
Statement type: