# TotalSegmentator

> Open-source tool for segmenting anatomical structures in CT and MR images using nnU-Net based models.

TotalSegmentator is a tool for segmenting major anatomical structures in CT and MR images, created by the Research and Analysis department at University Hospital Basel. It takes NIfTI files or DICOM slice folders and writes segmentation masks, optionally with volume and intensity statistics. It runs on Ubuntu, Mac and Windows, on CPU or GPU, and is based heavily on nnU-Net.

## What It Is

TotalSegmentator is a command-line and Python tool for medical image segmentation. The default `total` task covers 117 classes on CT, and `total_mr` covers 50 classes on MR. The README states it was trained on CT and MR images from different scanners, institutions and protocols. It is explicitly not a medical device and is not intended for clinical usage, although the README notes it is part of several FDA-approved products as a component.

## Tasks and Outputs

Beyond the default tasks, many subtasks target specific regions or structures: vertebrae, lung vessels, head and neck structures, liver segments and lesions, teeth, muscles, heart chambers, coronary arteries and brain structures. Some subtasks are openly available under Apache-2.0, while others require a license. Output can be one file per class or a single multilabel NIfTI, and can also be DICOM-SEG or DICOM RTSTRUCT. Options include `--statistics`, `--radiomics` and a 3D `--preview` rendering.

## Additional Commands and Integrations

Companion commands predict body stats, contrast phase and image modality, combine masks, compute the Evans index, and generate spine, aorta and pulmonary artery reports. An MCP server lets AI clients use it, and `totalseg_info` lists tasks and classes. The README also lists web applications, a 3D Slicer extension, a Docker image and a Python API.

## Setup Path

Install with `pip install TotalSegmentator`, which requires Python 3.10 or newer and PyTorch 2.0 or newer. Model weights download automatically on first run and can be pre-downloaded for offline machines. For CPU use, `--fast` or `--roi_subset` reduce runtime, and `--device mps` speeds up M-series Macs.

## Features
- Segmentation of 117 classes on CT and 50 classes on MR with the default tasks
- Many specialized subtasks for vertebrae, lungs, liver, head and neck, teeth, muscles, heart and brain
- Input as NIfTI files or DICOM slice folders
- Output as NIfTI or DICOM-SEG and DICOM RTSTRUCT
- Volume, intensity and radiomics statistics
- 3D preview rendering of segmentations
- Fast low-resolution mode and ROI subset prediction
- Body stats, contrast phase and modality prediction
- Aorta, pulmonary artery and spine reports
- Python API and MCP server
- Docker image
- Offline use after weights download

## Integrations
PyTorch, nnU-Net, 3D Slicer, Docker, Claude Code, Cursor, pyradiomics, highdicom

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Links
- Website: https://github.com/wasserth/TotalSegmentator
- Repository: https://github.com/wasserth/TotalSegmentator
- EveryDev.ai: https://www.everydev.ai/tools/totalsegmentator
