I keep getting errors trying to run totalsegmenter. I suspect it has to do with pyTorch not being installed properly on my system. Linux Ubuntu 22.04. To install pyTorch seems a bit tricky and most sites recommend using anaconda. Any advice? error message included:
Traceback (most recent call last):
File “/home/samuel/Slicer-5.2.1-linux-amd64/bin/Python/slicer/util.py”, line 2961, in tryWithErrorDisplay
yield
File “/home/samuel/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 248, in onApplyButton
self.logic.setupPythonRequirements()
File “/home/samuel/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 531, in setupPythonRequirements
slicer.util.pip_install(totalSegmentatorPackage + " --no-deps" + (" --upgrade" if upgrade else “”))
File “/home/samuel/Slicer-5.2.1-linux-amd64/bin/Python/slicer/util.py”, line 3571, in pip_install
_executePythonModule(‘pip’, args)
File “/home/samuel/Slicer-5.2.1-linux-amd64/bin/Python/slicer/util.py”, line 3533, in _executePythonModule
logProcessOutput(proc)
File “/home/samuel/Slicer-5.2.1-linux-amd64/bin/Python/slicer/util.py”, line 3502, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[’/home/samuel/Slicer-5.2.1-linux-amd64/bin/…/bin/PythonSlicer’, ‘-m’, ‘pip’, ‘install’, ‘git+https://github.com/wasserth/TotalSegmentator.git’, ‘–no-deps’]’ returned non-zero exit status 1.
There is a new 3D Slicer extension available for installing and running TotalSegmentator within 3D Slicer.
Highly recommended.
Sources on GitHub: GitHub - lassoan/SlicerTotalSegmentator: Fully automatic total body segmentation in 3D Slicer using "TotalSegmentator" AI model
You will also need to install PyTorch by using the PyTorch extension:
Thank-you, I installed newer version and also GIT which I overlooked previously. Now running fine. Is there a version for the Mac OS platform?
Yes, the TotalSegmentator extenstion works on a mac (tested on an M2 mac book air) but the GPU version is not available and I didn’t see an option to run the high-res version (but the faster low-res version did work).
Thanks I updated my mac version and was able to load the extension but as you said I couldn’t get the hi res version to compile.
The full-resolution model works fine on CPU (at least on Windows). Tested on two computers. Even completes successfully on an 8th-generation Intel i5 with 8GB RAM (it takes 30-40 minutes, which is long, but still much shorter than doing the segmentation manually).
What error did you get on macOS when you attempted to segment with “fast” mode disabled?
I does not see the totalsegmentation plug-in in the list when I open the extension manager.I am working with3D slicer 5-1-0-2022-11-12
Please update Slicer to the recent stable version 5.2.1.
You should find the extension here after installation:
This is a new extension. It is not available in older Slicer Preview Releases.
I would recommend to use the latest Slicer Stable Release (currently Slicer-5.2.1), as it allows you to easily update the extensions as we make improvements/fixes.
Thank you so much, I missed the latest release! I will do that.
Very best regards
Pr Philippe Pellerin.
Former coordinator of the French National Reference Center for rare craniofacial malformations.
Departement of Plastic Surgery.
Lille University Hospital.
France
I have downloaded Slicer 5-3 and the total segmentation extension, tried it at once: great result, I can’t believe how you did that but this is for me as a miracle!
Bravo and thanks again for the incredible tool that you provided.
Happy X’mas
Thanks for the kind words. TotalSegmentator is indeed amazing, and it is still in early stage. It is expected to become much better - more accurate and more comprehensive. Credits go to DKFZ for releasing this AI segmentation tool (including training method and data sets) for public use without restrictions (see GitHub - wasserth/TotalSegmentator: Tool for robust segmentation of 104 important anatomical structures in CT images for details).
Dear Andras, I am trying to work with Bale’s team to implement face segmentation in Totalsegmentator. I am asked to send the CT data as Nifti files, I am OK with this, but they ask as well a Nifti or NRRD for the segmentation. I can’t find a way to export the segmentation this way. Is it one that I could use?
Thanks for your time and help.
Super, thank you, in the meantime, Jakob has been happy with the .nrrb file in the saved bundle. But this way, I could select what he is specifically interested in.
Thanks a lot for your fast answer.
All the best.
Hi, I am trying to run TotalSegmentor,but its showing error.pyTorch has already been installed on my system Windows 64 bit.
Traceback (most recent call last):
File “C:\Users\lvarghese\AppData\Local\NA-MIC\Slicer 5.2.2\bin\Python\slicer\util.py”, line 2967, in tryWithErrorDisplay
yield
File “C:/Users/lvarghese/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/lvarghese/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 799, in process
self.logProcessOutput(proc)
File “C:/Users/lvarghese/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 692, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/lvarghese/AppData/Local/NA-MIC/Slicer 5.2.2/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\lvarghese\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/lvarghese/AppData/Local/Temp/Slicer/__SlicerTemp__2023-06-04_19+38+07.977/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/lvarghese/AppData/Local/Temp/Slicer/__SlicerTemp__2023-06-04_19+38+07.977/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.
I am not that good with coding,can someone help me where I am doing wrong,is there anyother extensions for support I have to install?
Please go to Pytorch Utils module and copy here the displayed version of Pytorch and cuda.
Please go to Pytorch Utils module and check what are the Pytorch and cuda versions displayed there.