Fix: Add empty defaults to tags
Adds two main things:
- For the following tags:
StudyDate
,StudyTime
,AccessionNumber
,ReferringPhysicianName
, the code will now provide an empty string instead of erroring when absent from the reference dicom file.- This remains in-line with the standard as these tags are of type
Required, Empty if Unknown (2)
- This remains in-line with the standard as these tags are of type
- Modify the
if <tag> in <dicom>
statement ofInstitutionalDepartmentalName
withif hasattr(<dicom>, <tag>)
as the first causes pydicom to throw warnings in some cases (e.g:UserWarning: Invalid value 'InstitutionalDepartmentalName' used with the 'in' operator: must be an element tag as a 2-tuple or int, or an element keyword
, originates from here in pydicom- Other if-in were modified to simply maintain the same syntax
- Make use of
getattr()
in a few cases for a cleaner means to set defaults per recommendations in comments
Edited by Ronan Lefol