TotalSegmentor python package for Slicer plugin showing error

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

Can anyone help me?

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.

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.

@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), but it did not segment anything. Am I missing something?

Thanks.

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.

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.

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

@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.

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.

1 Like

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.

1 Like