Tool for segmentation of most major anatomical structures in any CT or MR image. It was trained on a wide range of different CT and MR images (different scanners, institutions, protocols,...) and therefore works well on most images. A large part of the training dataset can be downloaded here: CT dataset (1228 subjects) and MR dataset (616 subjects). You can also try the tool online at totalsegmentator.com or as 3D Slicer extension.
ANNOUNCEMENT: TotalSegmentator now can predict height, weight, age and sex: totalseg_get_body_stats.
ANNOUNCEMENT: The new tasks vertebrae_pp will greatly improve vertebrae segmentations (less mixup of neighboring vertebrae).
ANNOUNCEMENT: We created web applications for abdominal organ volume, aorta diameter, spine report, pulmonary artery diameter, contrast phase detection and body weight prediction.
Main classes for CT and MR:

TotalSegmentator supports a lot more structures. See subtasks or here for more details.
Created by the department of Research and Analysis at University Hospital Basel. If you use it please cite our Radiology AI paper (free preprint). If you use it for MR images please cite the TotalSegmentator MRI Radiology paper (free preprint). Please also cite nnUNet since TotalSegmentator is heavily based on it.
TotalSegmentator works on Ubuntu, Mac, and Windows and on CPU and GPU.
Install dependencies:
Optionally:
--preview you have to install fury (pip install fury). FURY <2 additionally requires xvfb (apt-get install xvfb).Install Totalsegmentator
pip install TotalSegmentator
For CT images:
TotalSegmentator -i ct.nii.gz -o segmentations
For MR images:
TotalSegmentator -i mri.nii.gz -o segmentations --task total_mr
Note: A Nifti file or a folder (or zip file) with all DICOM slices of one patient is allowed as input.
Note: If you run on CPU use the option
--fast(uses lower resolution) or--roi_subsetto greatly improve runtime. If you run on a M-series Mac use--device mpsfor great speedup.
Note: This is not a medical device and is not intended for clinical usage. However, it is part of several FDA-approved products, where it has been certified as a component of the overall system.

Next to the default task (total) there are more subtasks with more classes. If the taskname ends with _mr it works for MR images, otherwise for CT images.
Openly available for any usage (Apache-2.0 license):
total task)total task)total task because of added postprocessing)vertebrae_body mask for sharper borders (borders are more accurate than in vertebrae_pp but has longer runtime)total_mr task)*: These models are not trained on the full totalsegmentator dataset but on some small other datasets. Therefore, expect them to work less robustly.
Available with a license (free licenses available for non-commercial usage here. For a commercial license contact jakob.wasserthal@usb.ch):
tissue_types skeletal_muscle is split into two classes: muscle and fat) (see more details)Usage:
TotalSegmentator -i ct.nii.gz -o segmentations -ta <task_name>
Confused by all the structures and tasks? Check this to search through available structures and tasks or run totalseg_info.
The mapping from label ID to class name can be found here.
If you have a nnU-Net model for some structures not supported yet, you can contribute it. This will enable all TotalSegmentator users to easily use it and at the same time increase the reach of your work by more people citing your paper. Contact jakob.wasserthal@usb.ch.
Thank you to INGEDATA for providing a team of radiologists to support some of the data annotations.
--device: Choose cpu or gpu or gpu:X--fast: For faster runtime and less memory requirements use this option. It will run a lower resolution model (3mm instead of 1.5mm).--roi_subset: Takes a space-separated list of class names (e.g. spleen colon brain) and only predicts those classes. Saves a lot of runtime and memory. Might be less accurate especially for small classes (e.g. prostate).--ml: This will save one nifti file containing all labels instead of one file for each class. Saves runtime during saving of nifti files. (see here for index to class name mapping).--output_type: This will output the segmentation as DICOM. Supported are dicom_seg requires (pip install highdicom) and dicom_rtstruct requires (pip install rt_utils).--statistics: This will generate a file statistics.json with volume (in mm³) and mean intensity of each class.--statistics_extra: In addition to volume and intensity, also compute n_voxels, intensity std/min/max and the morphometric centroid_vox and bbox_vox (voxel coordinates) for each class. Off by default to keep the statistics runtime unchanged.--higher_order_resampling: Uses higher order upsampling of the segmentations. Smoother (especially for --fast) but slower.--resampling_order: Spline interpolation order for input image resampling (default: 1). Setting this to 3 may give slightly better segmentation accuracy at the cost of slower resampling.--save_lowres: Save the segmentation at the model resolution (e.g. 1.5mm, or 3mm/6mm with --fast/--fastest) instead of upsampling it back to the input resolution. Skips the slow upsample and keeps the output on the model grid.--robust_crop: For some tasks and for roi_subset a 6mm low resolution model is used to crop to the region of interest. Sometimes this model is incorrect, which leads to artifacts like segmentations being cut off. robust_crop will use a better but slower 3mm model instead.--preview: This will generate a 3D rendering of all classes, giving you a quick overview if the segmentation worked and where it failed (see preview.png in output directory).--radiomics: This will generate a file statistics_radiomics.json with the radiomics features of each class. You have to install pyradiomics to use this (pip install pyradiomics).--report: This will write a machine-readable JSON run manifest to the given path (software and model versions, resolved device, task, classes, runtime and the list of output files). Useful for reproducible pipelines and automation.--list-tasks / --list-classes [task]: Print the available tasks (or the classes of one task) and exit, without running a segmentation. For machine-readable output use the totalseg_info command below.If you want to know body weight, size, age, sex, BMI, BSA, image noise, contrast, FOV and more information about the image you can use the following command (requires pip install timm monai). It runs on CPU in <1min. It requires a license which you can get for free for non-commercial usage here. More details can be found here or in the paper:
totalseg_get_body_stats -i ct.nii.gz -o body_stats.json -m [ct/mr]
If you want to know which contrast phase a CT image is you can use the following command (requires pip install xgboost). More details can be found here:
totalseg_get_phase -i ct.nii.gz -o contrast_phase.json
If you want to know which modality (CT or MR) an image is you can use the following command (requires pip install xgboost).
totalseg_get_modality -i image.nii.gz -o modality.json
If you want to combine some subclasses (e.g. lung lobes) into one binary mask (e.g. entire lung) you can use the following command:
totalseg_combine_masks -i totalsegmentator_output_dir -o combined_mask.nii.gz -m lung
If you want to calculate the Evans index you can use the following command:
totalseg_evans_index -i ct_skull.nii.gz -o evans_index.json -p evans_index.png
If you want to find osteoporotic spine fractures you can use the following command. Please cite this paper:
totalseg_spine_report.py -i ct.nii.gz -o spine_report.nii.gz -j spine_report.json -l spine_report.log
To measure aortic landmark diameters and section lengths/volumes (and curved planar reformation (CPR)), use the aorta report command. (requires a license which you can get for free for non-commercial usage here). See the aorta report documentation for more details:
totalseg_aorta_report -i ct.nii.gz \
-o aorta_report.nii.gz -j aorta_report.json -l aorta_report.log \
-c aorta_cpr.png --run_models
To measure the proximal main pulmonary artery, sinotubular junction, bifurcation, and the left and right pulmonary arteries, use the pulmonary artery report command. See the pulmonary report documentation:
totalseg_pulmonary_report -i ct.nii.gz \
-o pulmonary_report.nii.gz -j pulmonary_report.json \
-l pulmonary_report.log --run_models
Normally weights are automatically downloaded when running TotalSegmentator. If you want to download the weights with an extra command (e.g. when building a docker container) use this:
totalseg_download_weights -t <task_name>
This will download them to ~/.totalsegmentator/nnunet/results. You can change this path by doing export TOTALSEG_HOME_DIR=/new/path/.totalsegmentator. If your machine has no internet, then download on another machine with internet and copy ~/.totalsegmentator to the machine without internet.
After acquiring a license number for the non-open tasks you can set it with the following command:
totalseg_set_license -l aca_12345678910
If you want to run as fast as possible to process many cases and lower resolution is ok, I would recommend this setting (for a large CT image this takes ~30s on GPU and ~70s on CPU):
TotalSegmentator -i ct.nii.gz -o seg.nii.gz -ml -f -sl -ro 1
You can output the softmax probabilities. This will give you a .npz file you can load with numpy. The geometry
might not be identical to your input image. There will also be a .pkl output file with geometry
information. This does not work well for the total task since this is based on multiple models.
TotalSegmentator -i ct.nii.gz -o seg -ta lung_nodules --save_probabilities probs.npz
If you do not have internet access on the machine you want to run TotalSegmentator on:
~/.totalsegmentator.~/.totalsegmentator from this machine to the machine without internet.If you want to discover which tasks are available and which classes each one outputs (e.g. to find valid --roi_subset names) you can use the totalseg_info command. It runs instantly, needs no GPU and downloads no model weights, which also makes it convenient for scripts and AI coding agents:
totalseg_info --list-tasks # table of tasks (modality, license, number of classes)
totalseg_info --classes -ta total # class index -> name for one task
totalseg_info --json # full capability registry as JSON
TotalSegmentator provides a Model Context Protocol (MCP) server for AI clients. See the MCP server documentation for stdio, HTTP, Claude Code, and Cursor instructions.
pipx install \
'TotalSegmentator[mcp] @ git+https://github.com/wasserth/TotalSegmentator.git'
We provide the following web applications to easily process your images:
We also provide a docker container which can be used the following way
docker run --gpus 'device=0' --shm-size=16G -v /absolute/path/to/my/data/directory:/tmp wasserth/totalsegmentator:2.11.0 TotalSegmentator -i /tmp/ct.nii.gz -o /tmp/segmentations
Totalsegmentator has the following runtime and memory requirements (using an Nvidia RTX 3090 GPU):
(1.5mm is the normal model and 3mm is the --fast model. With v2 the runtimes have increased a bit since
we added more classes.)

If you want to reduce memory consumption you can use the following options:
--fast: This will use a lower-resolution model--body_seg: This will crop the image to the body region before processing it--roi_subset <list of classes>: This will only predict a subset of classes--force_split: This will split the image into 3 parts and process them one after another. (Do not use this for small images. Splitting these into even smaller images will result in a field of view which is too small.)--nr_thr_saving 1: Saving big images with several threads will take a lot of memoryYou can run totalsegmentator via Python:
import nibabel as nib
from totalsegmentator.python_api import totalsegmentator
if __name__ == "__main__":
# option 1: provide input and output as file paths
totalsegmentator(input_path, output_path)
# option 2: provide input and output as nifti image objects
input_img = nib.load(input_path)
output_img = totalsegmentator(input_img)
nib.save(output_img, output_path)
You can see all available arguments here. Running from within the main environment should avoid some multiprocessing issues.
The segmentation image contains the names of the classes in the extended header. If you want to load this additional header information you can use the following code (requires pip install xmltodict):
from totalsegmentator.nifti_ext_header import load_multilabel_nifti
segmentation_nifti_img, label_map_dict = load_multilabel_nifti(image_path)
pip install git+https://github.com/wasserth/TotalSegmentator.git
The exact split of the dataset can be found in the file meta.csv inside of the dataset. This was used for the validation in our paper.
The exact numbers of the results for the high-resolution model (1.5mm) can be found here. The paper shows these numbers in the supplementary materials Figure 11.
See here for more info on how to train a nnU-Net yourself on the TotalSegmentator dataset, how to split the data into train/validation/test set as in our paper, and how to run the same evaluation as in our paper.
In some cases the following kind of manual postprocessing might be useful:
tissue_4_types: Within the skeletal_muscle class threshold -190 to -30 HU and move this to intermuscular_fat class. This gives a more detailed segmentation of the intermuscular fat.ITK loading Error When you get the following error message
ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition was found!
you should do
pip install SimpleITK==2.0.2
Alternatively you can try
fslorient -copysform2qform input_file
[fslreorient2std input_file output_file]
or use this python command.
Bad segmentations When you get bad segmentation results check the following:
If you want to keep on using TotalSegmentator v1 (e.g. because you do not want to change your pipeline) you can install it with the following command:
pip install TotalSegmentator==1.5.7
The documentation for v1 can be found here. Bugfixes for v1 are developed in the branch v1_bugfixes.
Our Radiology AI publication refers to TotalSegmentator v1.
send_usage_stats to false in ~/.totalsegmentator/config.json.For more details see our Radiology AI paper (freely available preprint). If you use this tool please cite it as follows
Wasserthal, J., Breit, H.-C., Meyer, M.T., Pradella, M., Hinck, D., Sauter, A.W., Heye, T., Boll, D., Cyriac, J., Yang, S., Bach, M., Segeroth, M., 2023. TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images. Radiology: Artificial Intelligence. https://doi.org/10.1148/ryai.230024
Please also cite nnUNet since TotalSegmentator is heavily based on it. Moreover, we would really appreciate it if you let us know what you are using this tool for. You can also tell us what classes we should add in future releases. You can do so here.
The following table shows a list of all classes for task total.
TA2 is a standardized way to name anatomy. Mostly the TotalSegmentator names follow this standard. For some classes they differ which you can see in the table below.
Here you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes.
| Index | TotalSegmentator name | TA2 name |
|---|---|---|
| 1 | spleen | |
| 2 | kidney_right | |
| 3 | kidney_left | |
| 4 | gallbladder | |
| 5 | liver | |
| 6 | stomach | |
| 7 | pancreas | |
| 8 | adrenal_gland_right | suprarenal gland |
| 9 | adrenal_gland_left | suprarenal gland |
| 10 | lung_upper_lobe_left | superior lobe of left lung |
| 11 | lung_lower_lobe_left | inferior lobe of left lung |
| 12 | lung_upper_lobe_right | superior lobe of right lung |
| 13 | lung_middle_lobe_right | middle lobe of right lung |
| 14 | lung_lower_lobe_right | inferior lobe of right lung |
| 15 | esophagus | |
| 16 | trachea | |
| 17 | thyroid_gland | |
| 18 | small_bowel | small intestine |
| 19 | duodenum | |
| 20 | colon | |
| 21 | urinary_bladder | |
| 22 | prostate | |
| 23 | kidney_cyst_left | |
| 24 | kidney_cyst_right | |
| 25 | sacrum | |
| 26 | vertebrae_S1 | |
| 27 | vertebrae_L5 | |
| 28 | vertebrae_L4 | |
| 29 | vertebrae_L3 | |
| 30 | vertebrae_L2 | |
| 31 | vertebrae_L1 | |
| 32 | vertebrae_T12 | |
| 33 | vertebrae_T11 | |
| 34 | vertebrae_T10 | |
| 35 | vertebrae_T9 | |
| 36 | vertebrae_T8 | |
| 37 | vertebrae_T7 | |
| 38 | vertebrae_T6 | |
| 39 | vertebrae_T5 | |
| 40 | vertebrae_T4 | |
| 41 | vertebrae_T3 | |
| 42 | vertebrae_T2 | |
| 43 | vertebrae_T1 | |
| 44 | vertebrae_C7 | |
| 45 | vertebrae_C6 | |
| 46 | vertebrae_C5 | |
| 47 | vertebrae_C4 | |
| 48 | vertebrae_C3 | |
| 49 | vertebrae_C2 | |
| 50 | vertebrae_C1 | |
| 51 | heart | |
| 52 | aorta | |
| 53 | pulmonary_vein | |
| 54 | brachiocephalic_trunk | |
| 55 | subclavian_artery_right | |
| 56 | subclavian_artery_left | |
| 57 | common_carotid_artery_right | |
| 58 | common_carotid_artery_left | |
| 59 | brachiocephalic_vein_left | |
| 60 | brachiocephalic_vein_right | |
| 61 | atrial_appendage_left | |
| 62 | superior_vena_cava | |
| 63 | inferior_vena_cava | |
| 64 | portal_vein_and_splenic_vein | hepatic portal vein |
| 65 | iliac_artery_left | common iliac artery |
| 66 | iliac_artery_right | common iliac artery |
| 67 | iliac_vena_left | common iliac vein |
| 68 | iliac_vena_right | common iliac vein |
| 69 | humerus_left | |
| 70 | humerus_right | |
| 71 | scapula_left | |
| 72 | scapula_right | |
| 73 | clavicula_left | clavicle |
| 74 | clavicula_right | clavicle |
| 75 | femur_left | |
| 76 | femur_right | |
| 77 | hip_left | |
| 78 | hip_right | |
| 79 | spinal_cord | |
| 80 | gluteus_maximus_left | gluteus maximus muscle |
| 81 | gluteus_maximus_right | gluteus maximus muscle |
| 82 | gluteus_medius_left | gluteus medius muscle |
| 83 | gluteus_medius_right | gluteus medius muscle |
| 84 | gluteus_minimus_left | gluteus minimus muscle |
| 85 | gluteus_minimus_right | gluteus minimus muscle |
| 86 | autochthon_left | |
| 87 | autochthon_right | |
| 88 | iliopsoas_left | iliopsoas muscle |
| 89 | iliopsoas_right | iliopsoas muscle |
| 90 | brain | |
| 91 | skull | |
| 92 | rib_left_1 | |
| 93 | rib_left_2 | |
| 94 | rib_left_3 | |
| 95 | rib_left_4 | |
| 96 | rib_left_5 | |
| 97 | rib_left_6 | |
| 98 | rib_left_7 | |
| 99 | rib_left_8 | |
| 100 | rib_left_9 | |
| 101 | rib_left_10 | |
| 102 | rib_left_11 | |
| 103 | rib_left_12 | |
| 104 | rib_right_1 | |
| 105 | rib_right_2 | |
| 106 | rib_right_3 | |
| 107 | rib_right_4 | |
| 108 | rib_right_5 | |
| 109 | rib_right_6 | |
| 110 | rib_right_7 | |
| 111 | rib_right_8 | |
| 112 | rib_right_9 | |
| 113 | rib_right_10 | |
| 114 | rib_right_11 | |
| 115 | rib_right_12 | |
| 116 | sternum | |
| 117 | costal_cartilages |
Class map for task total_mr:
| Index | TotalSegmentator name | TA2 name |
|---|---|---|
| 1 | spleen | |
| 2 | kidney_right | |
| 3 | kidney_left | |
| 4 | gallbladder | |
| 5 | liver | |
| 6 | stomach | |
| 7 | pancreas | |
| 8 | adrenal_gland_right | suprarenal gland |
| 9 | adrenal_gland_left | suprarenal gland |
| 10 | lung_left | |
| 11 | lung_right | |
| 12 | esophagus | |
| 13 | small_bowel | small intestine |
| 14 | duodenum | |
| 15 | colon | |
| 16 | urinary_bladder | |
| 17 | prostate | |
| 18 | sacrum | |
| 19 | vertebrae | |
| 20 | intervertebral_discs | |
| 21 | spinal_cord | |
| 22 | heart | |
| 23 | aorta | |
| 24 | inferior_vena_cava | |
| 25 | portal_vein_and_splenic_vein | hepatic portal vein |
| 26 | iliac_artery_left | common iliac artery |
| 27 | iliac_artery_right | common iliac artery |
| 28 | iliac_vena_left | common iliac vein |
| 29 | iliac_vena_right | common iliac vein |
| 30 | humerus_left | |
| 31 | humerus_right | |
| 32 | scapula_left | |
| 33 | scapula_right | |
| 34 | clavicula_left | |
| 35 | clavicula_right | |
| 36 | femur_left | |
| 37 | femur_right | |
| 38 | hip_left | |
| 39 | hip_right | |
| 40 | gluteus_maximus_left | gluteus maximus muscle |
| 41 | gluteus_maximus_right | gluteus maximus muscle |
| 42 | gluteus_medius_left | gluteus medius muscle |
| 43 | gluteus_medius_right | gluteus medius muscle |
| 44 | gluteus_minimus_left | gluteus minimus muscle |
| 45 | gluteus_minimus_right | gluteus minimus muscle |
| 46 | autochthon_left | |
| 47 | autochthon_right | |
| 48 | iliopsoas_left | iliopsoas muscle |
| 49 | iliopsoas_right | iliopsoas muscle |
| 50 | brain |
(top 30 of 37)
Python
96.3%
Shell
1.6%
HTML
1.5%
Tool for segmentation of most major anatomical structures in any CT or MR image. It was trained on a wide range of different CT and MR images (different scanners, institutions, protocols,...) and therefore works well on most images. A large part of the training dataset can be downloaded here: CT dataset (1228 subjects) and MR dataset (616 subjects). You can also try the tool online at totalsegmentator.com or as 3D Slicer extension.
ANNOUNCEMENT: TotalSegmentator now can predict height, weight, age and sex: totalseg_get_body_stats.
ANNOUNCEMENT: The new tasks vertebrae_pp will greatly improve vertebrae segmentations (less mixup of neighboring vertebrae).
ANNOUNCEMENT: We created web applications for abdominal organ volume, aorta diameter, spine report, pulmonary artery diameter, contrast phase detection and body weight prediction.
Main classes for CT and MR:

TotalSegmentator supports a lot more structures. See subtasks or here for more details.
Created by the department of Research and Analysis at University Hospital Basel. If you use it please cite our Radiology AI paper (free preprint). If you use it for MR images please cite the TotalSegmentator MRI Radiology paper (free preprint). Please also cite nnUNet since TotalSegmentator is heavily based on it.
TotalSegmentator works on Ubuntu, Mac, and Windows and on CPU and GPU.
Install dependencies:
Optionally:
--preview you have to install fury (pip install fury). FURY <2 additionally requires xvfb (apt-get install xvfb).Install Totalsegmentator
pip install TotalSegmentator
For CT images:
TotalSegmentator -i ct.nii.gz -o segmentations
For MR images:
TotalSegmentator -i mri.nii.gz -o segmentations --task total_mr
Note: A Nifti file or a folder (or zip file) with all DICOM slices of one patient is allowed as input.
Note: If you run on CPU use the option
--fast(uses lower resolution) or--roi_subsetto greatly improve runtime. If you run on a M-series Mac use--device mpsfor great speedup.
Note: This is not a medical device and is not intended for clinical usage. However, it is part of several FDA-approved products, where it has been certified as a component of the overall system.

Next to the default task (total) there are more subtasks with more classes. If the taskname ends with _mr it works for MR images, otherwise for CT images.
Openly available for any usage (Apache-2.0 license):
total task)total task)total task because of added postprocessing)vertebrae_body mask for sharper borders (borders are more accurate than in vertebrae_pp but has longer runtime)total_mr task)*: These models are not trained on the full totalsegmentator dataset but on some small other datasets. Therefore, expect them to work less robustly.
Available with a license (free licenses available for non-commercial usage here. For a commercial license contact jakob.wasserthal@usb.ch):
tissue_types skeletal_muscle is split into two classes: muscle and fat) (see more details)Usage:
TotalSegmentator -i ct.nii.gz -o segmentations -ta <task_name>
Confused by all the structures and tasks? Check this to search through available structures and tasks or run totalseg_info.
The mapping from label ID to class name can be found here.
If you have a nnU-Net model for some structures not supported yet, you can contribute it. This will enable all TotalSegmentator users to easily use it and at the same time increase the reach of your work by more people citing your paper. Contact jakob.wasserthal@usb.ch.
Thank you to INGEDATA for providing a team of radiologists to support some of the data annotations.
--device: Choose cpu or gpu or gpu:X--fast: For faster runtime and less memory requirements use this option. It will run a lower resolution model (3mm instead of 1.5mm).--roi_subset: Takes a space-separated list of class names (e.g. spleen colon brain) and only predicts those classes. Saves a lot of runtime and memory. Might be less accurate especially for small classes (e.g. prostate).--ml: This will save one nifti file containing all labels instead of one file for each class. Saves runtime during saving of nifti files. (see here for index to class name mapping).--output_type: This will output the segmentation as DICOM. Supported are dicom_seg requires (pip install highdicom) and dicom_rtstruct requires (pip install rt_utils).--statistics: This will generate a file statistics.json with volume (in mm³) and mean intensity of each class.--statistics_extra: In addition to volume and intensity, also compute n_voxels, intensity std/min/max and the morphometric centroid_vox and bbox_vox (voxel coordinates) for each class. Off by default to keep the statistics runtime unchanged.--higher_order_resampling: Uses higher order upsampling of the segmentations. Smoother (especially for --fast) but slower.--resampling_order: Spline interpolation order for input image resampling (default: 1). Setting this to 3 may give slightly better segmentation accuracy at the cost of slower resampling.--save_lowres: Save the segmentation at the model resolution (e.g. 1.5mm, or 3mm/6mm with --fast/--fastest) instead of upsampling it back to the input resolution. Skips the slow upsample and keeps the output on the model grid.--robust_crop: For some tasks and for roi_subset a 6mm low resolution model is used to crop to the region of interest. Sometimes this model is incorrect, which leads to artifacts like segmentations being cut off. robust_crop will use a better but slower 3mm model instead.--preview: This will generate a 3D rendering of all classes, giving you a quick overview if the segmentation worked and where it failed (see preview.png in output directory).--radiomics: This will generate a file statistics_radiomics.json with the radiomics features of each class. You have to install pyradiomics to use this (pip install pyradiomics).--report: This will write a machine-readable JSON run manifest to the given path (software and model versions, resolved device, task, classes, runtime and the list of output files). Useful for reproducible pipelines and automation.--list-tasks / --list-classes [task]: Print the available tasks (or the classes of one task) and exit, without running a segmentation. For machine-readable output use the totalseg_info command below.If you want to know body weight, size, age, sex, BMI, BSA, image noise, contrast, FOV and more information about the image you can use the following command (requires pip install timm monai). It runs on CPU in <1min. It requires a license which you can get for free for non-commercial usage here. More details can be found here or in the paper:
totalseg_get_body_stats -i ct.nii.gz -o body_stats.json -m [ct/mr]
If you want to know which contrast phase a CT image is you can use the following command (requires pip install xgboost). More details can be found here:
totalseg_get_phase -i ct.nii.gz -o contrast_phase.json
If you want to know which modality (CT or MR) an image is you can use the following command (requires pip install xgboost).
totalseg_get_modality -i image.nii.gz -o modality.json
If you want to combine some subclasses (e.g. lung lobes) into one binary mask (e.g. entire lung) you can use the following command:
totalseg_combine_masks -i totalsegmentator_output_dir -o combined_mask.nii.gz -m lung
If you want to calculate the Evans index you can use the following command:
totalseg_evans_index -i ct_skull.nii.gz -o evans_index.json -p evans_index.png
If you want to find osteoporotic spine fractures you can use the following command. Please cite this paper:
totalseg_spine_report.py -i ct.nii.gz -o spine_report.nii.gz -j spine_report.json -l spine_report.log
To measure aortic landmark diameters and section lengths/volumes (and curved planar reformation (CPR)), use the aorta report command. (requires a license which you can get for free for non-commercial usage here). See the aorta report documentation for more details:
totalseg_aorta_report -i ct.nii.gz \
-o aorta_report.nii.gz -j aorta_report.json -l aorta_report.log \
-c aorta_cpr.png --run_models
To measure the proximal main pulmonary artery, sinotubular junction, bifurcation, and the left and right pulmonary arteries, use the pulmonary artery report command. See the pulmonary report documentation:
totalseg_pulmonary_report -i ct.nii.gz \
-o pulmonary_report.nii.gz -j pulmonary_report.json \
-l pulmonary_report.log --run_models
Normally weights are automatically downloaded when running TotalSegmentator. If you want to download the weights with an extra command (e.g. when building a docker container) use this:
totalseg_download_weights -t <task_name>
This will download them to ~/.totalsegmentator/nnunet/results. You can change this path by doing export TOTALSEG_HOME_DIR=/new/path/.totalsegmentator. If your machine has no internet, then download on another machine with internet and copy ~/.totalsegmentator to the machine without internet.
After acquiring a license number for the non-open tasks you can set it with the following command:
totalseg_set_license -l aca_12345678910
If you want to run as fast as possible to process many cases and lower resolution is ok, I would recommend this setting (for a large CT image this takes ~30s on GPU and ~70s on CPU):
TotalSegmentator -i ct.nii.gz -o seg.nii.gz -ml -f -sl -ro 1
You can output the softmax probabilities. This will give you a .npz file you can load with numpy. The geometry
might not be identical to your input image. There will also be a .pkl output file with geometry
information. This does not work well for the total task since this is based on multiple models.
TotalSegmentator -i ct.nii.gz -o seg -ta lung_nodules --save_probabilities probs.npz
If you do not have internet access on the machine you want to run TotalSegmentator on:
~/.totalsegmentator.~/.totalsegmentator from this machine to the machine without internet.If you want to discover which tasks are available and which classes each one outputs (e.g. to find valid --roi_subset names) you can use the totalseg_info command. It runs instantly, needs no GPU and downloads no model weights, which also makes it convenient for scripts and AI coding agents:
totalseg_info --list-tasks # table of tasks (modality, license, number of classes)
totalseg_info --classes -ta total # class index -> name for one task
totalseg_info --json # full capability registry as JSON
TotalSegmentator provides a Model Context Protocol (MCP) server for AI clients. See the MCP server documentation for stdio, HTTP, Claude Code, and Cursor instructions.
pipx install \
'TotalSegmentator[mcp] @ git+https://github.com/wasserth/TotalSegmentator.git'
We provide the following web applications to easily process your images:
We also provide a docker container which can be used the following way
docker run --gpus 'device=0' --shm-size=16G -v /absolute/path/to/my/data/directory:/tmp wasserth/totalsegmentator:2.11.0 TotalSegmentator -i /tmp/ct.nii.gz -o /tmp/segmentations
Totalsegmentator has the following runtime and memory requirements (using an Nvidia RTX 3090 GPU):
(1.5mm is the normal model and 3mm is the --fast model. With v2 the runtimes have increased a bit since
we added more classes.)

If you want to reduce memory consumption you can use the following options:
--fast: This will use a lower-resolution model--body_seg: This will crop the image to the body region before processing it--roi_subset <list of classes>: This will only predict a subset of classes--force_split: This will split the image into 3 parts and process them one after another. (Do not use this for small images. Splitting these into even smaller images will result in a field of view which is too small.)--nr_thr_saving 1: Saving big images with several threads will take a lot of memoryYou can run totalsegmentator via Python:
import nibabel as nib
from totalsegmentator.python_api import totalsegmentator
if __name__ == "__main__":
# option 1: provide input and output as file paths
totalsegmentator(input_path, output_path)
# option 2: provide input and output as nifti image objects
input_img = nib.load(input_path)
output_img = totalsegmentator(input_img)
nib.save(output_img, output_path)
You can see all available arguments here. Running from within the main environment should avoid some multiprocessing issues.
The segmentation image contains the names of the classes in the extended header. If you want to load this additional header information you can use the following code (requires pip install xmltodict):
from totalsegmentator.nifti_ext_header import load_multilabel_nifti
segmentation_nifti_img, label_map_dict = load_multilabel_nifti(image_path)
pip install git+https://github.com/wasserth/TotalSegmentator.git
The exact split of the dataset can be found in the file meta.csv inside of the dataset. This was used for the validation in our paper.
The exact numbers of the results for the high-resolution model (1.5mm) can be found here. The paper shows these numbers in the supplementary materials Figure 11.
See here for more info on how to train a nnU-Net yourself on the TotalSegmentator dataset, how to split the data into train/validation/test set as in our paper, and how to run the same evaluation as in our paper.
In some cases the following kind of manual postprocessing might be useful:
tissue_4_types: Within the skeletal_muscle class threshold -190 to -30 HU and move this to intermuscular_fat class. This gives a more detailed segmentation of the intermuscular fat.ITK loading Error When you get the following error message
ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition was found!
you should do
pip install SimpleITK==2.0.2
Alternatively you can try
fslorient -copysform2qform input_file
[fslreorient2std input_file output_file]
or use this python command.
Bad segmentations When you get bad segmentation results check the following:
If you want to keep on using TotalSegmentator v1 (e.g. because you do not want to change your pipeline) you can install it with the following command:
pip install TotalSegmentator==1.5.7
The documentation for v1 can be found here. Bugfixes for v1 are developed in the branch v1_bugfixes.
Our Radiology AI publication refers to TotalSegmentator v1.
send_usage_stats to false in ~/.totalsegmentator/config.json.For more details see our Radiology AI paper (freely available preprint). If you use this tool please cite it as follows
Wasserthal, J., Breit, H.-C., Meyer, M.T., Pradella, M., Hinck, D., Sauter, A.W., Heye, T., Boll, D., Cyriac, J., Yang, S., Bach, M., Segeroth, M., 2023. TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images. Radiology: Artificial Intelligence. https://doi.org/10.1148/ryai.230024
Please also cite nnUNet since TotalSegmentator is heavily based on it. Moreover, we would really appreciate it if you let us know what you are using this tool for. You can also tell us what classes we should add in future releases. You can do so here.
The following table shows a list of all classes for task total.
TA2 is a standardized way to name anatomy. Mostly the TotalSegmentator names follow this standard. For some classes they differ which you can see in the table below.
Here you can find a mapping of the TotalSegmentator classes to SNOMED-CT codes.
| Index | TotalSegmentator name | TA2 name |
|---|---|---|
| 1 | spleen | |
| 2 | kidney_right | |
| 3 | kidney_left | |
| 4 | gallbladder | |
| 5 | liver | |
| 6 | stomach | |
| 7 | pancreas | |
| 8 | adrenal_gland_right | suprarenal gland |
| 9 | adrenal_gland_left | suprarenal gland |
| 10 | lung_upper_lobe_left | superior lobe of left lung |
| 11 | lung_lower_lobe_left | inferior lobe of left lung |
| 12 | lung_upper_lobe_right | superior lobe of right lung |
| 13 | lung_middle_lobe_right | middle lobe of right lung |
| 14 | lung_lower_lobe_right | inferior lobe of right lung |
| 15 | esophagus | |
| 16 | trachea | |
| 17 | thyroid_gland | |
| 18 | small_bowel | small intestine |
| 19 | duodenum | |
| 20 | colon | |
| 21 | urinary_bladder | |
| 22 | prostate | |
| 23 | kidney_cyst_left | |
| 24 | kidney_cyst_right | |
| 25 | sacrum | |
| 26 | vertebrae_S1 | |
| 27 | vertebrae_L5 | |
| 28 | vertebrae_L4 | |
| 29 | vertebrae_L3 | |
| 30 | vertebrae_L2 | |
| 31 | vertebrae_L1 | |
| 32 | vertebrae_T12 | |
| 33 | vertebrae_T11 | |
| 34 | vertebrae_T10 | |
| 35 | vertebrae_T9 | |
| 36 | vertebrae_T8 | |
| 37 | vertebrae_T7 | |
| 38 | vertebrae_T6 | |
| 39 | vertebrae_T5 | |
| 40 | vertebrae_T4 | |
| 41 | vertebrae_T3 | |
| 42 | vertebrae_T2 | |
| 43 | vertebrae_T1 | |
| 44 | vertebrae_C7 | |
| 45 | vertebrae_C6 | |
| 46 | vertebrae_C5 | |
| 47 | vertebrae_C4 | |
| 48 | vertebrae_C3 | |
| 49 | vertebrae_C2 | |
| 50 | vertebrae_C1 | |
| 51 | heart | |
| 52 | aorta | |
| 53 | pulmonary_vein | |
| 54 | brachiocephalic_trunk | |
| 55 | subclavian_artery_right | |
| 56 | subclavian_artery_left | |
| 57 | common_carotid_artery_right | |
| 58 | common_carotid_artery_left | |
| 59 | brachiocephalic_vein_left | |
| 60 | brachiocephalic_vein_right | |
| 61 | atrial_appendage_left | |
| 62 | superior_vena_cava | |
| 63 | inferior_vena_cava | |
| 64 | portal_vein_and_splenic_vein | hepatic portal vein |
| 65 | iliac_artery_left | common iliac artery |
| 66 | iliac_artery_right | common iliac artery |
| 67 | iliac_vena_left | common iliac vein |
| 68 | iliac_vena_right | common iliac vein |
| 69 | humerus_left | |
| 70 | humerus_right | |
| 71 | scapula_left | |
| 72 | scapula_right | |
| 73 | clavicula_left | clavicle |
| 74 | clavicula_right | clavicle |
| 75 | femur_left | |
| 76 | femur_right | |
| 77 | hip_left | |
| 78 | hip_right | |
| 79 | spinal_cord | |
| 80 | gluteus_maximus_left | gluteus maximus muscle |
| 81 | gluteus_maximus_right | gluteus maximus muscle |
| 82 | gluteus_medius_left | gluteus medius muscle |
| 83 | gluteus_medius_right | gluteus medius muscle |
| 84 | gluteus_minimus_left | gluteus minimus muscle |
| 85 | gluteus_minimus_right | gluteus minimus muscle |
| 86 | autochthon_left | |
| 87 | autochthon_right | |
| 88 | iliopsoas_left | iliopsoas muscle |
| 89 | iliopsoas_right | iliopsoas muscle |
| 90 | brain | |
| 91 | skull | |
| 92 | rib_left_1 | |
| 93 | rib_left_2 | |
| 94 | rib_left_3 | |
| 95 | rib_left_4 | |
| 96 | rib_left_5 | |
| 97 | rib_left_6 | |
| 98 | rib_left_7 | |
| 99 | rib_left_8 | |
| 100 | rib_left_9 | |
| 101 | rib_left_10 | |
| 102 | rib_left_11 | |
| 103 | rib_left_12 | |
| 104 | rib_right_1 | |
| 105 | rib_right_2 | |
| 106 | rib_right_3 | |
| 107 | rib_right_4 | |
| 108 | rib_right_5 | |
| 109 | rib_right_6 | |
| 110 | rib_right_7 | |
| 111 | rib_right_8 | |
| 112 | rib_right_9 | |
| 113 | rib_right_10 | |
| 114 | rib_right_11 | |
| 115 | rib_right_12 | |
| 116 | sternum | |
| 117 | costal_cartilages |
Class map for task total_mr:
| Index | TotalSegmentator name | TA2 name |
|---|---|---|
| 1 | spleen | |
| 2 | kidney_right | |
| 3 | kidney_left | |
| 4 | gallbladder | |
| 5 | liver | |
| 6 | stomach | |
| 7 | pancreas | |
| 8 | adrenal_gland_right | suprarenal gland |
| 9 | adrenal_gland_left | suprarenal gland |
| 10 | lung_left | |
| 11 | lung_right | |
| 12 | esophagus | |
| 13 | small_bowel | small intestine |
| 14 | duodenum | |
| 15 | colon | |
| 16 | urinary_bladder | |
| 17 | prostate | |
| 18 | sacrum | |
| 19 | vertebrae | |
| 20 | intervertebral_discs | |
| 21 | spinal_cord | |
| 22 | heart | |
| 23 | aorta | |
| 24 | inferior_vena_cava | |
| 25 | portal_vein_and_splenic_vein | hepatic portal vein |
| 26 | iliac_artery_left | common iliac artery |
| 27 | iliac_artery_right | common iliac artery |
| 28 | iliac_vena_left | common iliac vein |
| 29 | iliac_vena_right | common iliac vein |
| 30 | humerus_left | |
| 31 | humerus_right | |
| 32 | scapula_left | |
| 33 | scapula_right | |
| 34 | clavicula_left | |
| 35 | clavicula_right | |
| 36 | femur_left | |
| 37 | femur_right | |
| 38 | hip_left | |
| 39 | hip_right | |
| 40 | gluteus_maximus_left | gluteus maximus muscle |
| 41 | gluteus_maximus_right | gluteus maximus muscle |
| 42 | gluteus_medius_left | gluteus medius muscle |
| 43 | gluteus_medius_right | gluteus medius muscle |
| 44 | gluteus_minimus_left | gluteus minimus muscle |
| 45 | gluteus_minimus_right | gluteus minimus muscle |
| 46 | autochthon_left | |
| 47 | autochthon_right | |
| 48 | iliopsoas_left | iliopsoas muscle |
| 49 | iliopsoas_right | iliopsoas muscle |
| 50 | brain |
(top 30 of 37)
Python
96.3%
Shell
1.6%
HTML
1.5%