diff Applications/Samples/SingleFrameApplication.h @ 89:f244018a4e4b wasm

BUGGY- trying to remove IVolumeSlicesObserver
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 May 2017 18:27:59 +0200
parents bd48431ac285
children 64e60018943f
line wrap: on
line diff
--- a/Applications/Samples/SingleFrameApplication.h	Fri May 26 16:11:52 2017 +0200
+++ b/Applications/Samples/SingleFrameApplication.h	Fri May 26 18:27:59 2017 +0200
@@ -34,7 +34,7 @@
   {
     class SingleFrameApplication :
       public SampleApplicationBase,
-      public IVolumeSlicesObserver
+      private ILayerSource::IObserver
     {
     private:
       class Interactor : public IWorldSceneInteractor
@@ -92,21 +92,40 @@
         }
       };
 
-      LayerWidget* widget_;
+      virtual void NotifyGeometryReady(const ILayerSource& source)
+      {
+      }
       
-    public:
-      SingleFrameApplication() : widget_(NULL)
+      virtual void NotifyGeometryError(const ILayerSource& source)
       {
       }
       
-      virtual void NotifySlicesAvailable(const ParallelSlices& slices)
+      virtual void NotifyContentChange(const ILayerSource& source)
+      {
+      }
+
+      virtual void NotifySliceChange(const ILayerSource& source,
+                                     const Slice& slice)
+      {
+      }
+ 
+      virtual void NotifyLayerReady(ILayerRenderer *layer,
+                                    const ILayerSource& source,
+                                    const Slice& slice)
       {
-        if (widget_ != NULL &&
-            slices.GetSliceCount() > 0)
-        {
-          widget_->SetSlice(slices.GetSlice(0));
-          widget_->SetDefaultView();
-        }
+      }
+
+      virtual void NotifyLayerError(const ILayerSource& source,
+                                    const SliceGeometry& slice)
+      {
+      }
+
+      LayerWidget*    widget_;
+      
+    public:
+      SingleFrameApplication() : 
+        widget_(NULL)
+      {
       }
       
       virtual void DeclareCommandLineOptions(boost::program_options::options_description& options)
@@ -146,7 +165,6 @@
 #if 1
         std::auto_ptr<OrthancFrameLayerSource> layer
           (new OrthancFrameLayerSource(context.GetWebService(), instance, frame));
-        layer->SetObserver(*this);
         widget->AddLayer(layer.release());
 
         if (parameters["smooth"].as<bool>())
@@ -157,13 +175,14 @@
         }
 #else
         // 0178023P**
-        std::auto_ptr<OrthancFrameLayerSource> layer;
-        layer.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0));
-        //layer.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0));  // BAD SLICE
-        layer->SetObserver(*this);
-        widget->AddLayer(layer.release());
+        std::auto_ptr<OrthancFrameLayerSource> ct;
+        ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0));
+        //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0));  // BAD SLICE
+        widget->AddLayer(ct.release());
 
-        widget->AddLayer(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0));
+        std::auto_ptr<OrthancFrameLayerSource> pet;
+        pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0));
+        widget->AddLayer(pet.release());
 
         {
           RenderStyle s;
@@ -173,7 +192,7 @@
 
         {
           RenderStyle s;
-          s.drawGrid_ = true;
+          //s.drawGrid_ = true;
           s.SetColor(255, 0, 0);  // Draw missing PET layer in red
           s.alpha_ = 0.5;
           s.applyLut_ = true;