changeset 4691:a08ef46c95a1

applying modifications to subsequences after all the other modifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jun 2021 12:15:38 +0200
parents 13efc0967cea
children e68edf92e5cc
files OrthancFramework/Sources/DicomParsing/DicomModification.cpp
diffstat 1 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Jun 10 11:21:22 2021 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Jun 10 12:15:38 2021 +0200
@@ -964,24 +964,7 @@
                        DicomReplaceMode_InsertIfAbsent, privateCreator_);
     }
 
-    // (6) New in Orthanc 1.9.4: Apply modifications to subsequences
-    for (ListOfPaths::const_iterator it = removeSequences_.begin();
-         it != removeSequences_.end(); ++it)
-    {
-      assert(it->GetPrefixLength() > 0);
-      toModify.RemovePath(*it);
-    }
-
-    for (SequenceReplacements::const_iterator it = sequenceReplacements_.begin();
-         it != sequenceReplacements_.end(); ++it)
-    {
-      assert(*it != NULL);
-      assert((*it)->GetPath().GetPrefixLength() > 0);
-      toModify.ReplacePath((*it)->GetPath(), (*it)->GetValue(), true /* decode data URI scheme */,
-                           DicomReplaceMode_InsertIfAbsent, privateCreator_);
-    }
-
-    // (7) Update the DICOM identifiers
+    // (6) Update the DICOM identifiers
     if (level_ <= ResourceType_Study &&
         !IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
     {
@@ -1021,7 +1004,7 @@
       }
     }
 
-    // (8) Update the "referenced" relationships in the case of an anonymization
+    // (7) Update the "referenced" relationships in the case of an anonymization
     if (isAnonymization_)
     {
       RelationshipsVisitor visitor(*this);
@@ -1035,6 +1018,23 @@
         visitor.RemoveRelationships(toModify);
       }
     }
+
+    // (8) New in Orthanc 1.9.4: Apply modifications to subsequences
+    for (ListOfPaths::const_iterator it = removeSequences_.begin();
+         it != removeSequences_.end(); ++it)
+    {
+      assert(it->GetPrefixLength() > 0);
+      toModify.RemovePath(*it);
+    }
+
+    for (SequenceReplacements::const_iterator it = sequenceReplacements_.begin();
+         it != sequenceReplacements_.end(); ++it)
+    {
+      assert(*it != NULL);
+      assert((*it)->GetPath().GetPrefixLength() > 0);
+      toModify.ReplacePath((*it)->GetPath(), (*it)->GetValue(), true /* decode data URI scheme */,
+                           DicomReplaceMode_InsertIfAbsent, privateCreator_);
+    }
   }
 
   void DicomModification::SetAllowManualIdentifiers(bool check)