wasserth / TotalSegmentator

Tool for robust segmentation of >100 important anatomical structures in CT and MR images
Apache License 2.0
1.42k stars 237 forks source link

bug : bones extremities segmentation task does not work #238

Closed ivanstepanovftw closed 1 month ago

ivanstepanovftw commented 9 months ago
Traceback (most recent call last):
  File "/home/i/Downloads/Slicer-5.4.0-linux-amd64/bin/Python/slicer/util.py", line 3146, in tryWithErrorDisplay
    yield
  File "/home/i/Downloads/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/TotalSegmentator/lib/Slicer-5.4/qt-scripted-modules/TotalSegmentator.py", line 271, in onApplyButton
    self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
  File "/home/i/Downloads/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/TotalSegmentator/lib/Slicer-5.4/qt-scripted-modules/TotalSegmentator.py", line 790, in process
    self.readSegmentation(outputSegmentation, outputSegmentationFile, task)
  File "/home/i/Downloads/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/TotalSegmentator/lib/Slicer-5.4/qt-scripted-modules/TotalSegmentator.py", line 864, in readSegmentation
    labelValueToSegmentName = class_map[task]
KeyError: 'bones_extremities'

Using CPU only on Fedora. Reproduce is as usual: selected bones extremities, create new segmentation on apply, then clicked on Apply. More logs

Details

``` Processing started Writing input file to /tmp/Slicer-i/__SlicerTemp__2023-11-26_09+37+05.403/total-segmentator-input.nii Creating segmentations with TotalSegmentator AI (pre-run)... Total Segmentator arguments: ['-i', '/tmp/Slicer-i/__SlicerTemp__2023-11-26_09+37+05.403/total-segmentator-input.nii', '-o', '/tmp/Slicer-i/__SlicerTemp__2023-11-26_09+37+05.403/segmentation', '--fast'] /home/i/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/bin/TotalSegmentator:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import require /home/i/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.18) or chardet (5.1.0)/charset_normalizer (2.0.12) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " /home/i/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/torch/cuda/amp/grad_scaler.py:125: UserWarning: torch.cuda.amp.GradScaler is enabled, but CUDA is not available. Disabling. warnings.warn( /home/i/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn( If you use this tool please cite: https://doi.org/10.48550/arXiv.2208.05868 No GPU detected. Running on CPU. This can be very slow. The '--fast' option can help to some extend. Using 'fast' option: resampling to lower resolution (3mm) Resampling... Resampled in 3.14s Predicting... If you use this tool please cite: https://doi.org/10.48550/arXiv.2208.05868 No GPU detected. Running on CPU. This can be very slow. The '--fast' option can help to some extend. Using 'fast' option: resampling to lower resolution (3mm) Resampling... Resampled in 3.14s Predicting... Predicted in 10.04s Resampling... Saving segmentations... 0%| | 0/104 [00:00

ivanstepanovftw commented 9 months ago

Same for tissue_types

MOHeller commented 9 months ago

I think you will find that slicer 5.4 only supports TotalSegmentator v1, and the tasks you try to run are only supported in v2 afaik. You would need to update to slicer 5.5 to use TotalSegmentator v2 (where the tasks in question do work).

see the discussion e.g. here: https://discourse.slicer.org/t/problem-running-totalsegmentator-in-slicer-5-4/32491

philippeif commented 7 months ago

Hello,

I tried TotalSegmentator v2 within Slicer 5.6.1. The limbs are missing (below the knee / humerus) on all CTs I tried (5).

Version 5.5 is mentioned there but not available in the collection of older slicer packages on Kitware's site (5.4->5.6).

Which version should be used for v2?

Thanks Philippe PS: posted on slicer discourse as well