diff Framework/Layers/DicomStructureSetRendererFactory.cpp @ 128:c993693e9e63 wasm

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 Nov 2017 17:26:10 +0100
parents c9e88e7935a4
children a823122db53d
line wrap: on
line diff
--- a/Framework/Layers/DicomStructureSetRendererFactory.cpp	Wed Nov 08 17:53:55 2017 +0100
+++ b/Framework/Layers/DicomStructureSetRendererFactory.cpp	Tue Nov 14 17:26:10 2017 +0100
@@ -164,7 +164,7 @@
         for (std::set<std::string>::const_iterator it = instances.begin();
              it != instances.end(); ++it)
         {
-          orthanc_.SchedulePostRequest(*this, "/tools/lookup", *it,
+          orthanc_.SchedulePostRequest(loader_, "/tools/lookup", *it,
                                        new Operation(Operation::Type_LookupSopInstanceUid, *it));
         }
         
@@ -189,7 +189,7 @@
           }
 
           const std::string& instance = lookup[0]["ID"].asString();
-          orthanc_.ScheduleGetRequest(*this, "/instances/" + instance + "/tags",
+          orthanc_.ScheduleGetRequest(loader_, "/instances/" + instance + "/tags",
                                       new Operation(Operation::Type_LoadReferencedSlice, instance));
         }
         else
@@ -219,15 +219,27 @@
   } 
 
   
-  DicomStructureSetRendererFactory::DicomStructureSetRendererFactory(IWebService& orthanc,
-                                                                     const std::string& instance) :
+  DicomStructureSetRendererFactory::DicomStructureSetRendererFactory(IWebService& orthanc) :
+    loader_(*this),
     orthanc_(orthanc)
   {
-    const std::string uri = "/instances/" + instance + "/tags?ignore-length=3006-0050";
-    orthanc_.ScheduleGetRequest(*this, uri, new Operation(Operation::Type_LoadStructureSet, instance));
   }
   
+
+  void DicomStructureSetRendererFactory::ScheduleLoadInstance(const std::string& instance)
+  {
+    if (structureSet_.get() != NULL)
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
+    }
+    else
+    {
+      const std::string uri = "/instances/" + instance + "/tags?ignore-length=3006-0050";
+      orthanc_.ScheduleGetRequest(loader_, uri, new Operation(Operation::Type_LoadStructureSet, instance));
+    }
+  }
   
+
   void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
   {
     if (structureSet_.get() != NULL)