# HG changeset patch # User Sebastien Jodogne # Date 1631185353 -7200 # Node ID 51ec061516c91a6dbbd2072c47e4b907836af27f # Parent b47ee86a0d109b189b4659b878638e78a6f40b64 Fix handling of option "DeidentifyLogs", notably for tags (0010,0010) and (0010,0020) diff -r b47ee86a0d10 -r 51ec061516c9 NEWS --- a/NEWS Mon Sep 06 22:13:07 2021 +0200 +++ b/NEWS Thu Sep 09 13:02:33 2021 +0200 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* Fix handling of option "DeidentifyLogs", notably for tags (0010,0010) and (0010,0020) + Version 1.9.7 (2021-08-31) ========================== diff -r b47ee86a0d10 -r 51ec061516c9 OrthancFramework/Sources/DicomParsing/DicomModification.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Mon Sep 06 22:13:07 2021 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Thu Sep 09 13:02:33 2021 +0200 @@ -1808,4 +1808,25 @@ } } } + + + bool DicomModification::IsAlteredTag(const DicomTag& tag) const + { + return (uids_.find(tag) != uids_.end() || + IsCleared(tag) || + IsRemoved(tag) || + IsReplaced(tag) || + (tag.IsPrivate() && + ArePrivateTagsRemoved() && + privateTagsToKeep_.find(tag) == privateTagsToKeep_.end()) || + (isAnonymization_ && ( + tag == DICOM_TAG_PATIENT_NAME || + tag == DICOM_TAG_PATIENT_ID)) || + (tag == DICOM_TAG_STUDY_INSTANCE_UID && + !keepStudyInstanceUid_) || + (tag == DICOM_TAG_SERIES_INSTANCE_UID && + !keepSeriesInstanceUid_) || + (tag == DICOM_TAG_SOP_INSTANCE_UID && + !keepSopInstanceUid_)); + } } diff -r b47ee86a0d10 -r 51ec061516c9 OrthancFramework/Sources/DicomParsing/DicomModification.h --- a/OrthancFramework/Sources/DicomParsing/DicomModification.h Mon Sep 06 22:13:07 2021 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.h Thu Sep 09 13:02:33 2021 +0200 @@ -252,5 +252,7 @@ void Replace(const DicomPath& path, const Json::Value& value, // Encoded using UTF-8 bool safeForAnonymization); + + bool IsAlteredTag(const DicomTag& tag) const; }; } diff -r b47ee86a0d10 -r 51ec061516c9 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Mon Sep 06 22:13:07 2021 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Thu Sep 09 13:02:33 2021 +0200 @@ -1987,10 +1987,9 @@ static const std::string redactedContent = "*** POTENTIAL PHI ***"; const DicomTag& tag = element.GetTag(); - if (deidentifyLogs_ && ( - logsDeidentifierRules_.IsCleared(tag) || - logsDeidentifierRules_.IsRemoved(tag) || - logsDeidentifierRules_.IsReplaced(tag))) + if (deidentifyLogs_ && + !element.GetValue().GetContent().empty() && + logsDeidentifierRules_.IsAlteredTag(tag)) { return redactedContent; }