Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DicomText - treat DT (DateTime) types similarly to DA (Date) types #1562

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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