changeset 321:47a709e22d1f

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Jan 2013 15:21:42 +0100
parents 1b0ffed55ab0
children 7233461e2f61
files OrthancServer/OrthancRestApi.cpp
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Thu Jan 03 14:41:12 2013 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Mon Jan 07 15:21:42 2013 +0100
@@ -989,10 +989,19 @@
     // Set the PatientIdentityRemoved
     replacements.insert(std::make_pair(DicomTag(0x0012, 0x0062), "YES"));
 
-    replacements.insert(std::make_pair(DICOM_TAG_STUDY_INSTANCE_UID, 
-                                       FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Study)));
-    replacements.insert(std::make_pair(DICOM_TAG_SERIES_INSTANCE_UID, 
-                                       FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Series)));
+    // Generate random study UID if not specified
+    if (replacements.find(DICOM_TAG_STUDY_INSTANCE_UID) == replacements.end())
+    {
+      replacements.insert(std::make_pair(DICOM_TAG_STUDY_INSTANCE_UID, 
+                                         FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Study)));
+    }
+
+    // Generate random series UID if not specified
+    if (replacements.find(DICOM_TAG_SERIES_INSTANCE_UID) == replacements.end())
+    {
+      replacements.insert(std::make_pair(DICOM_TAG_SERIES_INSTANCE_UID, 
+                                         FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Series)));
+    }
   }
 
 
@@ -1084,7 +1093,7 @@
       for (Removals::iterator it = additionalRemovals.begin(); 
            it != additionalRemovals.end(); it++)
       {
-        removals.erase(*it);
+        removals.insert(*it);
       }     
 
       ParseReplacements(replacements, replacementsPart);