diff --git a/code/preprocessing/01_scanDicom.py b/code/preprocessing/01_scanDicom.py index b0a14ae..9439b83 100755 --- a/code/preprocessing/01_scanDicom.py +++ b/code/preprocessing/01_scanDicom.py @@ -228,6 +228,8 @@ def _extractDicom_impl(f: str, slice_counts: Dict[str, int] = None) -> Optional[ 'DATE': extract.Date(), 'DOB': extract.DOB(), 'Series_desc': extract.Desc(), + 'Study_desc': extract.StudyDesc(), + 'Anatomic_region': extract.AnatomicRegion(), 'Modality': extract.Modality(), 'Part': extract.Part(), 'AcqTime': extract.Acq(), diff --git a/code/preprocessing/DICOM.py b/code/preprocessing/DICOM.py index 731a89d..bb36fc5 100644 --- a/code/preprocessing/DICOM.py +++ b/code/preprocessing/DICOM.py @@ -17,6 +17,8 @@ tag.Tag('AccessionNumber'), # Accession() tag.Tag('StudyDate'), # Date() tag.Tag('SeriesDescription'), # Desc(), LR() fallback chain + tag.Tag('StudyDescription'), # StudyDesc() + tag.Tag(0x0018, 0x0015), # AnatomicRegion() tag.Tag('RepetitionTime'), # Modality() tag.Tag('AcquisitionTime'), # Acq() tag.Tag('BodyPartExamined'), # Part() @@ -122,6 +124,22 @@ def Desc(self) -> str: except Exception as e: self.log_error('Unable to read SeriesDescription', e) return self.UNKNOWN + + def StudyDesc(self) -> str: + """Attempts to extract the study description""" + try: + return self.metadata.StudyDescription + except Exception as e: + self.log_error('Unable to read StudyDescription', e) + return self.UNKNOWN + + def AnatomicRegion(self) -> str: + """Attempts to extract the anatomic region of the scan""" + try: + return self.metadata.AnatomicRegion + except Exception as e: + self.log_error('Unable to read AnatomicRegion', e) + return self.UNKNOWN def Modality(self) -> str: """Attempts to extract the modality of the scan"""