diff OrthancServer/Scheduler/ModifyInstanceCommand.cpp @ 1341:479e31b13de5

Allow replacing PatientID/StudyInstanceUID/SeriesInstanceUID from Lua scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 Apr 2015 13:53:08 +0200
parents 6e7e5ed91c2d
children f967bdf8534e
line wrap: on
line diff
--- a/OrthancServer/Scheduler/ModifyInstanceCommand.cpp	Fri Apr 03 13:31:00 2015 +0200
+++ b/OrthancServer/Scheduler/ModifyInstanceCommand.cpp	Fri Apr 03 13:53:08 2015 +0200
@@ -36,6 +36,32 @@
 
 namespace Orthanc
 {
+  ModifyInstanceCommand::ModifyInstanceCommand(ServerContext& context,
+                                               const DicomModification& modification) :
+    context_(context),
+    modification_(modification)
+  {
+    modification_.SetAllowManualIdentifiers(true);
+
+    if (modification_.IsReplaced(DICOM_TAG_PATIENT_ID))
+    {
+      modification_.SetLevel(ResourceType_Patient);
+    }
+    else if (modification_.IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID))
+    {
+      modification_.SetLevel(ResourceType_Study);
+    }
+    else if (modification_.IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID))
+    {
+      modification_.SetLevel(ResourceType_Series);
+    }
+    else
+    {
+      modification_.SetLevel(ResourceType_Instance);
+    }
+  }
+
+
   bool ModifyInstanceCommand::Apply(ListOfStrings& outputs,
                                     const ListOfStrings& inputs)
   {