Mercurial > hg > orthanc
diff OrthancServer/DicomModification.cpp @ 991:2f76b92addd4
keep private tags during anonymization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 02 Jul 2014 11:56:08 +0200 |
parents | b4b46e3e6017 |
children | 80671157d051 |
line wrap: on
line diff
--- a/OrthancServer/DicomModification.cpp Tue Jul 01 17:17:45 2014 +0200 +++ b/OrthancServer/DicomModification.cpp Wed Jul 02 11:56:08 2014 +0200 @@ -96,12 +96,18 @@ { removals_.erase(tag); replacements_.erase(tag); + + if (FromDcmtkBridge::IsPrivateTag(tag)) + { + privateTagsToKeep_.insert(tag); + } } void DicomModification::Remove(const DicomTag& tag) { removals_.insert(tag); replacements_.erase(tag); + privateTagsToKeep_.erase(tag); } bool DicomModification::IsRemoved(const DicomTag& tag) const @@ -113,6 +119,7 @@ const std::string& value) { removals_.erase(tag); + privateTagsToKeep_.erase(tag); replacements_[tag] = value; } @@ -153,6 +160,7 @@ removePrivateTags_ = true; level_ = ResourceType_Patient; uidMap_.clear(); + privateTagsToKeep_.clear(); // This is Table E.1-1 from PS 3.15-2008 - DICOM Part 15: Security and System Management Profiles removals_.insert(DicomTag(0x0008, 0x0014)); // Instance Creator UID @@ -261,11 +269,11 @@ // (1) Remove the private tags, if need be if (removePrivateTags_) { - toModify.RemovePrivateTags(); + toModify.RemovePrivateTags(privateTagsToKeep_); } // (2) Remove the tags specified by the user - for (Removals::const_iterator it = removals_.begin(); + for (SetOfTags::const_iterator it = removals_.begin(); it != removals_.end(); ++it) { toModify.Remove(*it);