changeset 2721:062776ab4a21 jobs

author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Jul 2018 12:55:48 +0200
parents db0f33b2aeeb
children a191bbd55a2b
files Core/DicomParsing/DicomModification.cpp Core/DicomParsing/DicomModification.h NEWS
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/DicomModification.cpp	Thu Jul 12 11:34:45 2018 +0200
+++ b/Core/DicomParsing/DicomModification.cpp	Thu Jul 12 12:55:48 2018 +0200
@@ -316,6 +316,7 @@
     keepStudyInstanceUid_(false),
     keepSeriesInstanceUid_(false),
     updateReferencedRelationships_(true),
+    isAnonymization_(false),
     identifierGenerator_(NULL)
   {
   }
@@ -820,6 +821,8 @@
 
   void DicomModification::SetupAnonymization(DicomVersion version)
   {
+    isAnonymization_ = true;
+    
     removals_.clear();
     clearings_.clear();
     ClearReplacements();
@@ -1030,7 +1033,8 @@
       MapDicomTags(toModify, ResourceType_Instance);
     }
 
-    // (6) Update the "referenced" relationships
+    // (6) Update the "referenced" relationships in the case of an anonymization
+    if (isAnonymization_)
     {
       RelationshipsVisitor visitor(*this);
 
@@ -1248,6 +1252,7 @@
   static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID";
   static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID";
   static const char* UPDATE_REFERENCED_RELATIONSHIPS = "UpdateReferencedRelationships";
+  static const char* IS_ANONYMIZATION = "IsAnonymization";
   static const char* REMOVALS = "Removals";
   static const char* CLEARINGS = "Clearings";
   static const char* PRIVATE_TAGS_TO_KEEP = "PrivateTagsToKeep";
@@ -1272,6 +1277,7 @@
     value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_;
     value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_;
     value[UPDATE_REFERENCED_RELATIONSHIPS] = updateReferencedRelationships_;
+    value[IS_ANONYMIZATION] = isAnonymization_;
 
     SerializationToolbox::WriteSetOfTags(value, removals_, REMOVALS);
     SerializationToolbox::WriteSetOfTags(value, clearings_, CLEARINGS);
@@ -1368,6 +1374,7 @@
     keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID);
     updateReferencedRelationships_ = SerializationToolbox::ReadBoolean
       (serialized, UPDATE_REFERENCED_RELATIONSHIPS);
+    isAnonymization_ = SerializationToolbox::ReadBoolean(serialized, IS_ANONYMIZATION);
 
     SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS);
     SerializationToolbox::ReadSetOfTags(clearings_, serialized, CLEARINGS);
--- a/Core/DicomParsing/DicomModification.h	Thu Jul 12 11:34:45 2018 +0200
+++ b/Core/DicomParsing/DicomModification.h	Thu Jul 12 12:55:48 2018 +0200
@@ -84,6 +84,7 @@
     bool keepStudyInstanceUid_;
     bool keepSeriesInstanceUid_;
     bool updateReferencedRelationships_;
+    bool isAnonymization_;
     DicomMap currentSource_;
 
     IDicomIdentifierGenerator* identifierGenerator_;
--- a/NEWS	Thu Jul 12 11:34:45 2018 +0200
+++ b/NEWS	Thu Jul 12 12:55:48 2018 +0200
@@ -47,6 +47,7 @@
 
 * Fix generation of DICOMDIR if PatientID is empty
 * Fix issue 25 (Deadlock with Lua scripts): The event queue is now implemented for Lua
+* Fix issue 94 (Instance modification should not modify FrameOfReferenceUID)
 * Configuration option "LogExportedResources" is now "false" by default
 * Header "OrthancCppDatabasePlugin.h" is now part of the "orthanc-databases" project
 * Upgraded dependencies for static and Windows builds: