TotalSegmentator + Slicer 5.8.1 - "ModuleNotFoundError: No module named 'pydicom.pixels'"

jochoaTX
Mon, 31 Mar 2025 19:55:08 +0000
Support

Operating system: WinPro 11
Slicer version: 5.8.1
Expected behavior: TotalSegmentator to totally segment
Actual behavior: Pukes

I’ve declared defeat. Cannot solve this myself. It seems that TotalSegmentator may be looking for an earlier version of pydicom? Any help/suggestions appreciated - for the sake of my sanity. Here’s some context:

Processing started
Writing input file to C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+33+57.728/total-segmentator-input.nii
Creating segmentations with TotalSegmentator AI…
Total Segmentator arguments: [‘-i’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+33+57.728/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+33+57.728/segmentation’, ‘–ml’, ‘–task’, ‘total’]
Traceback (most recent call last):
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\runpy.py”, line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Scripts\TotalSegmentator.exe_main.py", line 7, in
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\totalsegmentator\bin\TotalSegmentator.py”, line 143, in main
totalsegmentator(args.input, args.output, args.ml, args.nr_thr_resamp, args.nr_thr_saving,
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\totalsegmentator\python_api.py”, line 137, in totalsegmentator
from totalsegmentator.nnunet import nnUNet_predict_image # this has to be after setting new env vars
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\totalsegmentator\nnunet.py”, line 54, in
from totalsegmentator.dicom_io import dcm_to_nifti, save_mask_as_rtstruct
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\totalsegmentator\dicom_io.py”, line 13, in
import dicom2nifti
File "C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\dicom2nifti_init.py", line 19, in
from dicom2nifti.convert_dicom import dicom_series_to_nifti
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\dicom2nifti\convert_dicom.py”, line 17, in
import dicom2nifti.common as common
File “C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\dicom2nifti\common.py”, line 16, in
from pydicom.pixels import apply_modality_lut
ModuleNotFoundError: No module named ‘pydicom.pixels’

If you use this tool please cite: https://pubs.rsna.org/doi/10.1148/ryai.230024

++++++++++++++
Traceback (most recent call last):
File “C:\ProgramData\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py”, line 3303, in tryWithErrorDisplay
yield
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 307, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 1037, in process
self.processVolume(inputFile, inputVolume,
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 1104, in processVolume
self.logProcessOutput(proc)
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 883, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/ProgramData/slicer.org/Slicer 5.8.1/bin/../bin\PythonSlicer.EXE’, ‘C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Scripts\TotalSegmentator.exe’, ‘-i’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 1.

+++++

[Python] Failed to compute results.
[Python] Command ‘[‘C:/ProgramData/slicer.org/Slicer 5.8.1/bin/../bin\PythonSlicer.EXE’, ‘C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Scripts\TotalSegmentator.exe’, ‘-i’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 1.
Traceback (most recent call last):
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 307, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 1037, in process
self.processVolume(inputFile, inputVolume,
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 1104, in processVolume
self.logProcessOutput(proc)
File “C:/ProgramData/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/TotalSegmentator/lib/Slicer-5.8/qt-scripted-modules/TotalSegmentator.py”, line 883, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/ProgramData/slicer.org/Slicer 5.8.1/bin/../bin\PythonSlicer.EXE’, ‘C:\ProgramData\slicer.org\Slicer 5.8.1\lib\Python\Scripts\TotalSegmentator.exe’, ‘-i’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/jocho/AppData/Local/Temp/Slicer/__SlicerTemp__2025-03-31_11+52+39.591/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 1.
[Qt] QTextCursor::setPosition: Position ‘-18456’ out of range
[Qt] QTextCursor::setPosition: Position ‘-18456’ out of range
[Qt] QTextCursor::setPosition: Position ‘-18456’ out of range
[Qt] QTextCursor::setPosition: Position ‘-18456’ out of range
[Qt] QTextCursor::setPosition: Position ‘-18456’ out of range

3 posts - 2 participants