This commit is contained in:
Ross
2023-12-18 18:25:39 +00:00
parent 0ed7968415
commit 9790c0a4df
+20
View File
@@ -939,6 +939,26 @@ class UncategorisedDicom(models.Model):
return None return None
def get_basic_dicom_tags(self): 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: try:
with pydicom.read_file(self.image) as ds: with pydicom.read_file(self.image) as ds:
to_include = ( to_include = (