You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get an error when reading dicom segmentation #6928
Describe the bug
When I tried to read the dicom segmentation label with LoadImage in MONAI transforms, it reported a bug shown below.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/venv/lib/python3.11/site-packages/monai/transforms/io/array.py", line 290, in __call__
img_array, meta_data = reader.get_data(img)
^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/monai/data/image_reader.py", line 586, in get_data
data_array, metadata = self._get_seg_data(d)
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/monai/data/image_reader.py", line 770, in _get_seg_data
class_name = description.SegmentDescription
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/pydicom/dataset.py", line 908, in __getattr__
return object.__getattribute__(self, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Dataset' object has no attribute 'SegmentDescription'
To Reproduce
Steps to reproduce the behavior:
Install the MONAI main branch.
Download the attachment dcm file whose md5 is f511acb750076c56ad2d9647dcfe521d.
If I changed this line to class_name = description.SegmentDescription if hasattr(description, "SegmentDescription") else description.SegmentLabel, it works. However I am not sure if this modification is good enough.
Activity
binliunls commentedon Sep 2, 2023
cc @SachidanandAlle , @tangy5 for reference.
wyli commentedon Sep 2, 2023
it seems
SegmentLabelis a required attribute andSegmentDescriptionis optional, perhaps the logic should be trySegmentLabelfirstfix Project-MONAI#6928
KumoLiu commentedon Sep 4, 2023
Not sure whether
SegmentLabelis unique here for frames otherwise we need to specify something like flabel_{i}here.Fix missing `SegmentDescription` in `PydicomReader` (#6937)