Skip to content

Commit

Permalink
Handle failing to parse image coordinate system by attribute error
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson committed Feb 14, 2024
1 parent 4e211a2 commit 6be4bcc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wsidicom/metadata/schema/dicom/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def load_type(self) -> Type[ImageCoordinateSystem]:
def load(self, dataset: Dataset, **kwargs) -> Optional[ImageCoordinateSystem]:
try:
return super().load(dataset, **kwargs)
except TypeError:
except (TypeError, AttributeError):
return None


Expand Down Expand Up @@ -209,9 +209,9 @@ def pre_dump(self, image: Image, **kwargs):
focal_plane_spacing=image.focal_plane_spacing,
depth_of_field=image.depth_of_field,
),
"lossy_compressions": image.lossy_compressions
if image.lossy_compressions
else [],
"lossy_compressions": (
image.lossy_compressions if image.lossy_compressions else []
),
}

@post_load
Expand Down

0 comments on commit 6be4bcc

Please sign in to comment.