# TotalSegmentor python package for Slicer plugin showing error

**URL:** <https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259>\
**Category:** Support\
**Tags:** totalsegmentator\
**Created:** [April 3, 2024, 3:45pm UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259 "2024-04-03T15:45:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![imruljubair](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/imruljubair/32/69323_2.png) [@imruljubair](https://discourse.slicer.org/u/imruljubair)\
**Post date:** [April 3, 2024, 3:45pm UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/1 "2024-04-03T15:45:26Z")

</div>

I am getting following error message to work with TotalSegmentor python package on Slicer plugin showing.

Can anyone help me?

```auto
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 2961, in tryWithErrorDisplay
    yield
  File "/Applications/Slicer.app/Contents/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py", line 255, in onApplyButton
    self.logic.setupPythonRequirements()
  File "/Applications/Slicer.app/Contents/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py", line 624, in setupPythonRequirements
    slicer.util.pip_install(self.totalSegmentatorPythonPackageDownloadUrl)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3571, in pip_install
    _executePythonModule('pip', args)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3533, in _executePythonModule
    logProcessOutput(proc)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3502, in logProcessOutput
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'https://github.com/wasserth/TotalSegmentator/archive/ecf84f9e59b84dddb447e2b13542f58c29ee4c6a.zip']' returned non-zero exit status 1.

```

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 3, 2024, 5:18pm UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/2 "2024-04-03T17:18:49Z")

</div>

It appears you are using Slicer 5.2. Please download the latest Slicer stable (5.6.1) and try again. Let us know here if switching to the new version fixes things for you.

> **[Download 3D Slicer](https://download.slicer.org/)**
>
> 3D Slicer is a free, open source software for visualization, processing, segmentation, registration, and analysis of medical, biomedical, and other 3D images and meshes; and planning and navigating image-guided procedures.

---

<div class="post-metadata">

**Author:** ![imruljubair](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/imruljubair/32/69323_2.png) [@imruljubair](https://discourse.slicer.org/u/imruljubair)\
**Post date:** [April 5, 2024, 10:25am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/3 "2024-04-05T10:25:10Z")

</div>

@jamesobutler Thanks. I installed the latest one and it worked. Only thing is that I do not see any segmentation after applying TotalSegmentor with heartchambers\_highres with license. I took a sample from Medical Segmentation Decathlon task 02 Heart ([MSD - Google Drive](https://drive.google.com/drive/folders/1HqEgzS8BV2c7xYNrZdEAnrHk7osJJ--2)), but it did not segment anything. Am I missing something?

Thanks.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 5, 2024, 11:24am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/4 "2024-04-05T11:24:25Z")

</div>

I looked up about MSD and it seems that heart data is MRI while TotalSegmentator works only on CT images. The developer of TotalSegmentator has mentioned about creating an MRI version, but there is no timeline about when it would be available to use.

Other groups are also aiming to build an MRI based segmentator, but again nothing publicly available at this moment.

> [@TotalSegmentator for MRI dataset](https://discourse.slicer.org/t/totalsegmentator-for-mri-dataset/35080/3):
>
> We have a project underway to try training an MR segmenter based on TotalSegmentator using the SynthSeg approach (not muscles yet though). The preprint paper actually just went up on arxiv: Would be great to generalize to other segmentation tasks.

---

<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, 2024, 2:44pm UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/5 "2024-04-05T14:44:02Z")

</div>

MONAI Auto3DSeg extension has some MRI models already and more are coming.

If there is a training data set for heart chambers and you have a good GPU then you can train an Auto3DSeg model yourself by following the [this tutorial](https://github.com/Project-MONAI/tutorials/blob/main/auto3dseg/README.md).

---

<div class="post-metadata">

**Author:** ![imruljubair](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/imruljubair/32/69323_2.png) [@imruljubair](https://discourse.slicer.org/u/imruljubair)\
**Post date:** [April 6, 2024, 4:22am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/6 "2024-04-06T04:22:38Z")

</div>

@jamesobutler Thanks a lot. Is there any way I can convert MRI data to fit into TotalSegmentor model?

---

<div class="post-metadata">

**Author:** ![imruljubair](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/imruljubair/32/69323_2.png) [@imruljubair](https://discourse.slicer.org/u/imruljubair)\
**Post date:** [April 6, 2024, 4:24am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/7 "2024-04-06T04:24:10Z")

</div>

@lassoan Thanks for the suggestions. I already applied Auto3dSeg and nnU-Net on my dataset. I was looking for to observe how pretrained models performs on my dataset. But my dataset is MRI, not CT.

---

<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 6, 2024, 4:34am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/8 "2024-04-06T04:34:27Z")

</div>

TotalSegmentator offers a set of pre-trained models for CT. These will not be useful for you for your MRI images.

Since both nn-UNet and MONAI Auto3DSeg can train the AI models fully automatically, all you need to do is to get some training data (the Decathlon task 02 should be good) and run the training. I would recommend to follow the tutorial that I linked above to train the model using MONAI Auto3DSeg; and then you can use the result in MONAIAuto3DSeg extension in Slicer. Alternatively, you can follow some nn-UNet tutorials to train your model and then use the resulting model in Slicer via the NNUnet extension.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 31, 2024, 3:06am UTC](https://discourse.slicer.org/t/totalsegmentor-python-package-for-slicer-plugin-showing-error/35259/9 "2024-05-31T03:06:45Z")

</div>

> [@jamesobutler](#):
>
> The developer of TotalSegmentator has mentioned about creating an MRI version

Following up here, TotalSegmentator v2.2 now has support for MR tasks. SlicerTotalSegmentator will have to be updated to specify to use this new version.
