Skip to content

Fix: Add empty defaults to tags

Ronan Lefol requested to merge rl_patch_sr_builder into develop

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)
  • Modify the if <tag> in <dicom> statement of InstitutionalDepartmentalName with if 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

Merge request reports

Loading