New extension: Fully automatic whole-body CT segmentation in 2 minutes using TotalSegmentator

Truly amazing! Thanks for sharing this!

1 Like

6 posts were split to a new topic: Error while installing pytorch

After installing the totalsegmentor and trying to run it by pressing apply, i got a message that pytorch will be installed in several minutes. However, after one hour it is still not proceeding. Does anyone have a suggestion what might go wrong?

It works for some of my CT data, for other i get this error:
Traceback (most recent call last):
File “E:\apps\Slicer 5.2.1\bin\Python\slicer\”, line 2961, in tryWithErrorDisplay
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/”, line 715, in process
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘E:/apps/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘E:\apps\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ar38/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-28_14+33+20.804/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ar38/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-28_14+33+20.804/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.

Do you know what is the reason for this? Thanks in advance

Amazing work, thanks for sharing such a powerful tool.
Any plan to add the shoulder rotator cuff muscles one day?

This is could indicate GPU memory issues on a big dataset. Please check the content of the console output window for additional information.


What is your GPU memory size?

I have a 4gb gpu. Surprising thing is it works for a bigger file. Any suggestions?

As @lassoan pointed out, this is a Slicer wrapper around TotalSegmentator, which itself uses nnUNet, both of which are fairly new and being actively developed. So we can hope for continued improvement (higher resolution, more segments, etc). Both projects are open source, so it’s also possible to contribute directly to them to build momentum, or even just congratulate the developers directly.

Note that we also work with the MONAI Label application, which is also very powerful and can be used to train new segments using the Slicer extension. These are exciting times as automatic segmentation is (finally) evolving rapidly into useful tools.


We know that the creators are working on including subcutaneous fat, the sternum bone, costovertebral connectors, and vessels. You may ask about specific structures in the TotalSegmentator GitHub Usage Issue and you could even train the software yourself or provide ground truth data to the creators because all training data are disclosed.

4 GB GPU memory is on the very low side of system requirements. See more details here.
So more GPU memory and RAM should help :slight_smile:

Minimum GPU memory requirement is 7GB.below that the segmentation may randomly fail on some data sets. For predictable outcomes, you need to switch to using CPU or upgrade your GPU.

Rotator cuff muscle injuries are so common that I’m sure there is enough interest in adding I to the TotalSegmentator model. If you segment this muscle on the TotalSegmentator datasets (they are all publicly available) and send them to Jakob Wassrthal (main developer of the TotalSegmentator model) then he will add it to the model.

Segmentation of a muscle in 2000 images may seem like a big effort, but if the muscle is well visible in CTs then it could be a very doable. You can use TotalSegmentator to segment each image then extract the relevant ROI based on the segmentation results (e.g., bounding box defined by a couple of segments). After that you can use MONAILabel to segment the muscle in each extracted image region. MONAILabel allows you to segment with adaptive learning, which means that you only need to segment a few dozen images from scratch, for the remaining you can get an automatic segmentation result that you just need to verify and fix up as needed. The automatic segmentation result will improve continuously with each completed case, so you should be able to finish the segmentation fairly quickly.


I am wondering if I can have chest wall and para spinal muscles segmentation by TotalSegmentator?

Similar/nearby structures around the chest wall and para spinal muscles are already segmented. Can you derive sufficient information from those? What is your clinical application?

In general the same answers apply to segmentation of any additional structure as given for the rotator cuff muscle question above, i.e., you need to segment a number of cases with manual/semi-automatic/adaptive learning tools and then that can be used to extend TotalSegmentator.

Thank you for replying.
I found paraspinal muscles segmentations.
I`ll try for the rest of muscles what you explained for Rotator Cuff.

1 Like

Hi Lassoan,

Very impressive work! Are you able to add option to smooth all the contours generated via fast option? Hoping this can reduce the jaggies?


Yes, you can apply smoothing in Segment Editor. However, that would not make the segmentation more accurate, so I would not recommend doing it (unless you just want to improve the look of the segmentation). If you want better image quality but you don’t have a GPU then you can get the full quality segmentation in 30-40 minutes on the CPU. It is fully automatic, so you just start it and it runs in the background.

7 posts were split to a new topic: TotalSegmentator failed to compute results - file not found

A post was merged into an existing topic: TotalSegmentator failed to compute results - file not found

3 posts were split to a new topic: Convert TotalSegmentator results to RT structure set

2 posts were split to a new topic: TotalSegmentator results computed in fast mode are rough