Mercurial > hg > orthanc
changeset 2323:f5fc61337bdf
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Jul 2017 10:50:00 +0200 |
parents | dc7c8eebcc80 |
children | 53df86a17e99 |
files | OrthancServer/DicomModification.cpp OrthancServer/DicomModification.h |
diffstat | 2 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/DicomModification.cpp Fri Jul 14 10:37:50 2017 +0200 +++ b/OrthancServer/DicomModification.cpp Fri Jul 14 10:50:00 2017 +0200 @@ -49,15 +49,20 @@ namespace Orthanc { - void DicomModification::RemoveInternal(const DicomTag& tag) + bool DicomModification::CancelReplacement(const DicomTag& tag) { Replacements::iterator it = replacements_.find(tag); - + if (it != replacements_.end()) { delete it->second; replacements_.erase(it); - } + return true; + } + else + { + return false; + } } @@ -166,9 +171,13 @@ void DicomModification::Keep(const DicomTag& tag) { + bool wasRemoved = IsRemoved(tag); + bool wasCleared = IsCleared(tag); + removals_.erase(tag); clearings_.erase(tag); - RemoveInternal(tag); + + bool wasReplaced = CancelReplacement(tag); if (tag == DICOM_TAG_STUDY_INSTANCE_UID) { @@ -182,7 +191,9 @@ { privateTagsToKeep_.insert(tag); } - else + else if (!wasRemoved && + !wasReplaced && + !wasCleared) { LOG(WARNING) << "Marking this tag as to be kept has no effect: " << tag.Format(); } @@ -194,7 +205,7 @@ { removals_.insert(tag); clearings_.erase(tag); - RemoveInternal(tag); + CancelReplacement(tag); privateTagsToKeep_.erase(tag); MarkNotOrthancAnonymization(); @@ -204,7 +215,7 @@ { removals_.erase(tag); clearings_.insert(tag); - RemoveInternal(tag); + CancelReplacement(tag); privateTagsToKeep_.erase(tag); MarkNotOrthancAnonymization();
--- a/OrthancServer/DicomModification.h Fri Jul 14 10:37:50 2017 +0200 +++ b/OrthancServer/DicomModification.h Fri Jul 14 10:50:00 2017 +0200 @@ -69,7 +69,7 @@ void ClearReplacements(); - void RemoveInternal(const DicomTag& tag); + bool CancelReplacement(const DicomTag& tag); void ReplaceInternal(const DicomTag& tag, const Json::Value& value);