From 9790c0a4dfe83dd0f1abdc396953f6f9707ba116 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 18 Dec 2023 18:25:39 +0000 Subject: [PATCH] . --- atlas/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/atlas/models.py b/atlas/models.py index db8ad77b..2f12e674 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -939,6 +939,26 @@ class UncategorisedDicom(models.Model): return None def get_basic_dicom_tags(self): + with pydicom.read_file(self.image) as ds: + to_include = ( + "StudyDescription", + "Modality", + "ProtocolName", + "SeriesDescription", + "SeriesInstanceUID", + "BodyPartExamined", + "SliceThickness", + ) + + tags = {} + + for tag in to_include: + if tag in ds: + tags[tag] = ds[tag].value + else: + tags[tag] = "" + + return tags try: with pydicom.read_file(self.image) as ds: to_include = (