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

**URL:** <https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710>\
**Category:** Support\
**Tags:** feature, segmentation, ai\
**Created:** [December 13, 2022, 1:32pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710 "2022-12-13T13:32:08Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![abertelsen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/abertelsen/32/8788_2.png) [@abertelsen](https://discourse.slicer.org/u/abertelsen)\
**Post date:** [December 22, 2022, 10:25am UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/24 "2022-12-22T10:25:34Z")

</div>

Truly amazing! Thanks for sharing this!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 28, 2022, 1:18pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/25 "2022-12-28T13:18:34Z")

</div>

6 posts were split to a new topic: [Error while installing pytorch](https://discourse.slicer.org/t/error-while-installing-pytorch/26956)

---

<div class="post-metadata">

**Author:** ![R.Boellaard](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@R.Boellaard](https://discourse.slicer.org/u/R.Boellaard)\
**Post date:** [December 28, 2022, 1:30pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/26 "2022-12-28T13:30:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Anish\_Raj](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_raj/32/13980_2.png) [@Anish\_Raj](https://discourse.slicer.org/u/Anish_Raj)\
**Post date:** [December 28, 2022, 1:39pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/27 "2022-12-28T13:39:34Z")

</div>

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\util.py”, line 2961, in tryWithErrorDisplay  
yield  
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, 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/TotalSegmentator.py”, line 715, in process  
self.logProcessOutput(proc)  
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, 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

---

<div class="post-metadata">

**Author:** ![Aoz](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Aoz](https://discourse.slicer.org/u/Aoz)\
**Post date:** [December 28, 2022, 4:01pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/28 "2022-12-28T16:01:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [December 28, 2022, 4:05pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/29 "2022-12-28T16:05:49Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/7/c74edab685a6979581383246f2572b4b06809f91.png)

What is your GPU memory size?

---

<div class="post-metadata">

**Author:** ![Anish\_Raj](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_raj/32/13980_2.png) [@Anish\_Raj](https://discourse.slicer.org/u/Anish_Raj)\
**Post date:** [December 28, 2022, 4:12pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/30 "2022-12-28T16:12:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [December 28, 2022, 4:18pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/31 "2022-12-28T16:18:23Z")

</div>

> [@Aoz](#):
>
> Any plan to add the shoulder rotator cuff muscles one day?

As @lassoan pointed out, this is a Slicer wrapper around [TotalSegmentator](https://github.com/wasserth/TotalSegmentator), which itself uses [nnUNet](https://github.com/MIC-DKFZ/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.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [December 28, 2022, 4:19pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/32 "2022-12-28T16:19:05Z")

</div>

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](https://github.com/wasserth/TotalSegmentator/issues/1) and you could even train the software yourself or provide ground truth data to the creators because all training data are disclosed.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [December 28, 2022, 4:27pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/33 "2022-12-28T16:27:47Z")

</div>

4 GB GPU memory is on the very low side of system requirements. See [more details here](https://github.com/wasserth/TotalSegmentator#resource-requirements).  
So more GPU memory and RAM should help 🙂

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 28, 2022, 5:28pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/34 "2022-12-28T17:28:06Z")

</div>

> [@Anish\_Raj](#):
>
> I have a 4gb gpu. Surprising thing is it works for a bigger file. Any suggestions?

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](https://github.com/lassoan/SlicerTotalSegmentator#segmentation-fails-while-predicting) or upgrade your GPU.

> [@Aoz](#):
>
> rotator cuff muscles

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.

---

<div class="post-metadata">

**Author:** ![Atena90](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Atena90](https://discourse.slicer.org/u/Atena90)\
**Post date:** [December 29, 2022, 3:11pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/35 "2022-12-29T15:11:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 29, 2022, 3:53pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/36 "2022-12-29T15:53:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Atena90](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Atena90](https://discourse.slicer.org/u/Atena90)\
**Post date:** [December 29, 2022, 4:06pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/37 "2022-12-29T16:06:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LipTeck\_Chew](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lipteck_chew/32/13519_2.png) [@LipTeck\_Chew](https://discourse.slicer.org/u/LipTeck_Chew)\
**Post date:** [January 6, 2023, 6:04am UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/38 "2023-01-06T06:04:30Z")

</div>

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?

Thanks,  
LipTeck

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 6, 2023, 6:12am UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/39 "2023-01-06T06:12:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 9, 2023, 2:10pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/40 "2023-01-09T14:10:10Z")

</div>

7 posts were split to a new topic: [TotalSegmentator failed to compute results - file not found](https://discourse.slicer.org/t/totalsegmentator-failed-to-compute-results-file-not-found/27129)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 9, 2023, 2:18pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/44 "2023-01-09T14:18:57Z")

</div>

A post was merged into an existing topic: [TotalSegmentator failed to compute results - file not found](https://discourse.slicer.org/t/totalsegmentator-failed-to-compute-results-file-not-found/27129/9)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 5, 2023, 8:00pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/47 "2023-04-05T20:00:04Z")

</div>

3 posts were split to a new topic: [Convert TotalSegmentator results to RT structure set](https://discourse.slicer.org/t/convert-totalsegmentator-results-to-rt-structure-set/28767)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 5, 2023, 8:01pm UTC](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710/50 "2023-04-05T20:01:25Z")

</div>

2 posts were split to a new topic: [TotalSegmentator results computed in fast mode are rough](https://discourse.slicer.org/t/totalsegmentator-results-computed-in-fast-mode-are-rough/28768)

[Previous page](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710.md?page=1)

[Next page](https://discourse.slicer.org/t/new-extension-fully-automatic-whole-body-ct-segmentation-in-2-minutes-using-totalsegmentator/26710.md?page=3)
