Skip to content

Commit

Permalink
Merge pull request #1562 from SMI/bugfix/srdatetime
Browse files Browse the repository at this point in the history
DicomText - treat DT (DateTime) types similarly to DA (Date) types
  • Loading branch information
rkm authored May 31, 2023
2 parents 0bf3ad9 + 0e21d63 commit 444d2b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/1562-bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DicomText - Redact all tags which have a data type (VR) of 'DT' (DateTime). It was already doing dates and names.
4 changes: 3 additions & 1 deletion src/common/Smi_Common_Python/SmiServices/DicomText.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def _dataset_redact_callback(self, dataset, data_element):
#if not replaced:
# print('WARNING: offsets slipped:')
# print(' expected to find %s but found %s' % (repr(annot['text']), repr(rc[annot_at:annot_end])))
if data_element.VR == 'PN' or data_element.VR == 'DA':
if data_element.VR == 'PN' or data_element.VR == 'DA' or data_element.VR == 'DT':
# Always fully redact the content of PersonName and Date tags
replacement = self.redact_string(rc, 0, len(rc), data_element.VR)
replacedAny = True
Expand Down Expand Up @@ -300,6 +300,8 @@ def redact_PN_DA_callback(self, dataset, data_element):
data_element.value = DicomText._redact_char.rjust(len(data_element.value), DicomText._redact_char)
if data_element.VR == "DA":
data_element.value = "19000101"
if data_element.VR == "DT":
data_element.value = "19000101000000"

def text(self):
""" Returns the text after parse() has been called.
Expand Down

0 comments on commit 444d2b5

Please # to comment.