From b58899ce8dbdc543e28c647b2f0ac1b725a42ac7 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 11 Oct 2023 22:19:33 +0200 Subject: [PATCH] Revert 2 out of 3 list comprehension changes The order of the returned list should not be modified. --- src/highdicom/seg/sop.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/highdicom/seg/sop.py b/src/highdicom/seg/sop.py index ef55022e..33b5b149 100644 --- a/src/highdicom/seg/sop.py +++ b/src/highdicom/seg/sop.py @@ -2595,9 +2595,12 @@ def segmented_property_categories(self) -> List[CodedConcept]: descriptions in this SEG image. """ - return list( - {desc.segmented_property_category for desc in self.SegmentSequence} - ) + categories = [] + for desc in self.SegmentSequence: + if desc.segmented_property_category not in categories: + categories.append(desc.segmented_property_category) + + return categories @property def segmented_property_types(self) -> List[CodedConcept]: @@ -2610,9 +2613,12 @@ def segmented_property_types(self) -> List[CodedConcept]: descriptions in this SEG image. """ - return list( - {desc.segmented_property_type for desc in self.SegmentSequence} - ) + types = [] + for desc in self.SegmentSequence: + if desc.segmented_property_type not in types: + types.append(desc.segmented_property_type) + + return types def _get_pixels_by_seg_frame( self,