Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing SegmentDescription in PydicomReader #6937

Merged
merged 11 commits into from
Sep 4, 2023
3 changes: 2 additions & 1 deletion monai/data/image_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ def _get_seg_data(self, img):
all_segs = np.zeros([*spatial_shape, n_classes])

for i, (frames, description) in enumerate(self._get_frame_data(img)):
class_name = description.SegmentDescription
segment_label = getattr(description, "SegmentLabel", f"label_{i}")
class_name = getattr(description, "SegmentDescription", segment_label)
if class_name not in metadata["labels"].keys():
metadata["labels"][class_name] = i
class_num = metadata["labels"][class_name]
Expand Down
Loading