changeset 402:72355b637945

removed VolumeSlicerBase
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Nov 2018 12:34:45 +0100
parents f1c769b3a5c2
children 99e31898910e
files Applications/StoneApplicationContext.h Framework/Layers/DicomSeriesVolumeSlicer.cpp Framework/Layers/DicomSeriesVolumeSlicer.h Framework/Layers/DicomStructureSetSlicer.h Framework/Layers/VolumeSlicerBase.cpp Framework/Layers/VolumeSlicerBase.h Framework/dev.h Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 8 files changed, 78 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneApplicationContext.h	Sat Nov 10 10:11:29 2018 +0100
+++ b/Applications/StoneApplicationContext.h	Sat Nov 10 12:34:45 2018 +0100
@@ -51,6 +51,8 @@
       webService_ = &webService;
     }
 
-    virtual ~StoneApplicationContext() {}
+    virtual ~StoneApplicationContext()
+    {
+    }
   };
 }
--- a/Framework/Layers/DicomSeriesVolumeSlicer.cpp	Sat Nov 10 10:11:29 2018 +0100
+++ b/Framework/Layers/DicomSeriesVolumeSlicer.cpp	Sat Nov 10 12:34:45 2018 +0100
@@ -40,13 +40,13 @@
     }
     else
     {
-      VolumeSlicerBase::NotifyGeometryError();
+      EmitMessage(IVolumeSlicer::GeometryErrorMessage(*this));
     }
   }
 
   void DicomSeriesVolumeSlicer::OnSliceGeometryError(const OrthancSlicesLoader::SliceGeometryErrorMessage& message)
   {
-    VolumeSlicerBase::NotifyGeometryError();
+    EmitMessage(IVolumeSlicer::GeometryErrorMessage(*this));
   }
 
 
@@ -76,20 +76,19 @@
     EmitMessage(FrameReadyMessage(*this, message.GetImage(), 
                                   message.GetEffectiveQuality(), message.GetSlice()));
 
-    // then notify that the layer is ready for render
+    // then notify that the layer is ready for rendering
     RendererFactory factory(message);
-
     EmitMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, message.GetSlice().GetGeometry()));
   }
 
   void DicomSeriesVolumeSlicer::OnSliceImageError(const OrthancSlicesLoader::SliceImageErrorMessage& message)
   {
-    VolumeSlicerBase::NotifyLayerError(message.GetSlice().GetGeometry());
+    EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, message.GetSlice().GetGeometry()));
   }
 
 
   DicomSeriesVolumeSlicer::DicomSeriesVolumeSlicer(MessageBroker& broker, OrthancApiClient& orthanc) :
-    VolumeSlicerBase(broker),
+    IVolumeSlicer(broker),
     IObserver(broker),
     loader_(broker, orthanc),
     quality_(SliceImageQuality_FullPng)
--- a/Framework/Layers/DicomSeriesVolumeSlicer.h	Sat Nov 10 10:11:29 2018 +0100
+++ b/Framework/Layers/DicomSeriesVolumeSlicer.h	Sat Nov 10 12:34:45 2018 +0100
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include "VolumeSlicerBase.h"
+#include "IVolumeSlicer.h"
 #include "../Toolbox/IWebService.h"
 #include "../Toolbox/OrthancSlicesLoader.h"
 #include "../Toolbox/OrthancApiClient.h"
@@ -32,7 +32,7 @@
   // once it's been loaded (first the geometry and then the image),
   // messages are sent to observers so they can use it
   class DicomSeriesVolumeSlicer :
-    public VolumeSlicerBase,
+    public IVolumeSlicer,
     public IObserver
     //private OrthancSlicesLoader::ISliceLoaderObserver
   {
--- a/Framework/Layers/DicomStructureSetSlicer.h	Sat Nov 10 10:11:29 2018 +0100
+++ b/Framework/Layers/DicomStructureSetSlicer.h	Sat Nov 10 12:34:45 2018 +0100
@@ -21,34 +21,24 @@
 
 #pragma once
 
-#include "VolumeSlicerBase.h"
+#include "IVolumeSlicer.h"
 #include "../Volumes/StructureSetLoader.h"
 
 namespace OrthancStone
 {
   class DicomStructureSetSlicer :
-    public VolumeSlicerBase,
+    public IVolumeSlicer,
     private IVolumeLoader::IObserver
   {
   private:
     class Renderer;
     class RendererFactory;
 
-    virtual void NotifyGeometryError(const IVolumeLoader& loader)
-    {
-      VolumeSlicerBase::NotifyGeometryError();
-    }
-
-    virtual void NotifyContentChange(const IVolumeLoader& loader)
-    {
-      VolumeSlicerBase::NotifyContentChange();
-    }
-
     StructureSetLoader& loader_;
 
   public:
     DicomStructureSetSlicer(MessageBroker& broker, StructureSetLoader& loader) :
-      VolumeSlicerBase(broker),
+      IVolumeSlicer(broker),
       loader_(loader)
     {
       loader_.Register(*this);
--- a/Framework/Layers/VolumeSlicerBase.cpp	Sat Nov 10 10:11:29 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/**
- * Stone of Orthanc
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2018 Osimis S.A., Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Affero General Public License for more details.
- * 
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#include "VolumeSlicerBase.h"
-
-#include <Core/OrthancException.h>
-
-namespace OrthancStone
-{
-  void VolumeSlicerBase::NotifyGeometryError()
-  {
-    EmitMessage(IVolumeSlicer::GeometryErrorMessage(*this));
-  }
-    
-  void VolumeSlicerBase::NotifyContentChange()
-  {
-    EmitMessage(IVolumeSlicer::ContentChangedMessage(*this));
-  }
-
-  void VolumeSlicerBase::NotifySliceContentChange(const Slice& slice)
-  {
-    EmitMessage(IVolumeSlicer::SliceContentChangedMessage(*this, slice));
-  }
-
-  void VolumeSlicerBase::NotifyLayerError(const CoordinateSystem3D& slice)
-  {
-    EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, slice));
-  }
-}
--- a/Framework/Layers/VolumeSlicerBase.h	Sat Nov 10 10:11:29 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/**
- * Stone of Orthanc
- * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
- * Department, University Hospital of Liege, Belgium
- * Copyright (C) 2017-2018 Osimis S.A., Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#pragma once
-
-#include "IVolumeSlicer.h"
-#include "../Toolbox/ObserversRegistry.h"
-
-namespace OrthancStone
-{
-  class VolumeSlicerBase : public IVolumeSlicer
-  {
-  protected:
-    VolumeSlicerBase(MessageBroker& broker) :
-      IVolumeSlicer(broker)
-    {
-    }
-
-    void NotifyGeometryError();
-
-    void NotifyContentChange();
-
-    void NotifySliceContentChange(const Slice& slice);
-
-    void NotifyLayerError(const CoordinateSystem3D& slice);
-  };
-}
--- a/Framework/dev.h	Sat Nov 10 10:11:29 2018 +0100
+++ b/Framework/dev.h	Sat Nov 10 12:34:45 2018 +0100
@@ -22,15 +22,14 @@
 #pragma once
 
 #include "Layers/FrameRenderer.h"
-#include "Layers/VolumeSlicerBase.h"
+#include "Layers/LineLayerRenderer.h"
 #include "Layers/SliceOutlineRenderer.h"
-#include "Layers/LineLayerRenderer.h"
-#include "Widgets/SliceViewerWidget.h"
 #include "Toolbox/DownloadStack.h"
 #include "Toolbox/GeometryToolbox.h"
 #include "Toolbox/OrthancSlicesLoader.h"
 #include "Volumes/ImageBuffer3D.h"
 #include "Volumes/SlicedVolumeBase.h"
+#include "Widgets/SliceViewerWidget.h"
 
 #include <Core/Logging.h>
 #include <Core/Images/ImageProcessing.h>
@@ -42,8 +41,8 @@
 {
   // TODO: Handle errors while loading
   class OrthancVolumeImage :
-      public SlicedVolumeBase,
-      public OrthancStone::IObserver
+    public SlicedVolumeBase,
+    public OrthancStone::IObserver
   {
   private:
     OrthancSlicesLoader           loader_;
@@ -418,20 +417,20 @@
 
       switch (projection)
       {
-      case VolumeProjection_Axial:
-        SetupAxial(volume);
-        break;
+        case VolumeProjection_Axial:
+          SetupAxial(volume);
+          break;
 
-      case VolumeProjection_Coronal:
-        SetupCoronal(volume);
-        break;
+        case VolumeProjection_Coronal:
+          SetupCoronal(volume);
+          break;
 
-      case VolumeProjection_Sagittal:
-        SetupSagittal(volume);
-        break;
+        case VolumeProjection_Sagittal:
+          SetupSagittal(volume);
+          break;
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
+        default:
+          throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
       }
     }
 
@@ -495,8 +494,8 @@
 
 
   class VolumeImageMPRSlicer :
-      public VolumeSlicerBase,
-      private ISlicedVolume::IObserver
+    public IVolumeSlicer,
+    private ISlicedVolume::IObserver
   {
   private:
     class RendererFactory : public LayerReadyMessage::IRendererFactory
@@ -535,7 +534,7 @@
     }
 
     
-    virtual void NotifyGeometryReady(const ISlicedVolume& volume)
+    virtual void NotifyGeometryReady(const ISlicedVolume& volume) ORTHANC_OVERRIDE
     {
       // These 3 values are only used to speed up the IVolumeSlicer
       axialGeometry_.reset(new VolumeImageGeometry(volume_, VolumeProjection_Axial));
@@ -545,27 +544,27 @@
       EmitMessage(IVolumeSlicer::GeometryReadyMessage(*this));
     }
 
-    virtual void NotifyGeometryError(const ISlicedVolume& volume)
+    virtual void NotifyGeometryError(const ISlicedVolume& volume) ORTHANC_OVERRIDE
     {
-      VolumeSlicerBase::NotifyGeometryError();
+      EmitMessage(IVolumeSlicer::GeometryErrorMessage(*this));
     }
 
-    virtual void NotifyContentChange(const ISlicedVolume& volume)
+    virtual void NotifyContentChange(const ISlicedVolume& volume) ORTHANC_OVERRIDE
     {
-      VolumeSlicerBase::NotifyContentChange();
+      EmitMessage(IVolumeSlicer::ContentChangedMessage(*this));
     }
 
     virtual void NotifySliceContentChange(const ISlicedVolume& volume,
-                                   const size_t& sliceIndex,
-                                   const Slice& slice)
+                                          const size_t& sliceIndex,
+                                          const Slice& slice) ORTHANC_OVERRIDE
     {
-      //VolumeSlicerBase::NotifySliceContentChange(slice);
+      //IVolumeSlicer::NotifySliceContentChange(slice);
 
       // TODO Improve this?
-      VolumeSlicerBase::NotifyContentChange();
+      EmitMessage(IVolumeSlicer::ContentChangedMessage(*this));
     }
 
-    virtual void NotifyVolumeReady(const ISlicedVolume& volume)
+    virtual void NotifyVolumeReady(const ISlicedVolume& volume) ORTHANC_OVERRIDE
     {
     }
 
@@ -578,17 +577,17 @@
 
       switch (projection)
       {
-      case VolumeProjection_Axial:
-        return *axialGeometry_;
+        case VolumeProjection_Axial:
+          return *axialGeometry_;
 
-      case VolumeProjection_Sagittal:
-        return *sagittalGeometry_;
+        case VolumeProjection_Sagittal:
+          return *sagittalGeometry_;
 
-      case VolumeProjection_Coronal:
-        return *coronalGeometry_;
+        case VolumeProjection_Coronal:
+          return *coronalGeometry_;
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        default:
+          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
       }
     }
 
@@ -629,14 +628,18 @@
   public:
     VolumeImageMPRSlicer(MessageBroker& broker, 
                          OrthancVolumeImage&  volume) :
-      VolumeSlicerBase(broker),
+      IVolumeSlicer(broker),
       volume_(volume)
     {
       volume_.Register(*this);
     }
 
+    virtual ~VolumeImageMPRSlicer()
+    {
+    }
+
     virtual bool GetExtent(std::vector<Vector>& points,
-                           const CoordinateSystem3D& viewportSlice)
+                           const CoordinateSystem3D& viewportSlice) ORTHANC_OVERRIDE
     {
       VolumeProjection projection;
       
@@ -657,7 +660,7 @@
     }
     
 
-    virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
+    virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) ORTHANC_OVERRIDE
     {
       VolumeProjection projection;
       
@@ -692,14 +695,14 @@
 
       // Error
       CoordinateSystem3D slice;
-      VolumeSlicerBase::NotifyLayerError(slice);
+      EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, slice));
     }
   };
 
 
   class VolumeImageInteractor :
-      public IWorldSceneInteractor,
-      protected ISlicedVolume::IObserver
+    public IWorldSceneInteractor,
+    protected ISlicedVolume::IObserver
   {
   private:
     SliceViewerWidget&                        widget_;
@@ -730,8 +733,8 @@
     }
 
     virtual void NotifySliceContentChange(const ISlicedVolume& volume,
-                                   const size_t& sliceIndex,
-                                   const Slice& slice)
+                                          const size_t& sliceIndex,
+                                          const Slice& slice)
     {
     }
 
@@ -767,16 +770,16 @@
 
       switch (direction)
       {
-      case MouseWheelDirection_Up:
-        OffsetSlice(-scale);
-        break;
+        case MouseWheelDirection_Up:
+          OffsetSlice(-scale);
+          break;
 
-      case MouseWheelDirection_Down:
-        OffsetSlice(scale);
-        break;
+        case MouseWheelDirection_Down:
+          OffsetSlice(scale);
+          break;
 
-      default:
-        break;
+        default:
+          break;
       }
     }
 
@@ -788,12 +791,12 @@
     {
       switch (keyChar)
       {
-      case 's':
-        widget.FitContent();
-        break;
+        case 's':
+          widget.FitContent();
+          break;
 
-      default:
-        break;
+        default:
+          break;
       }
     }
 
@@ -862,7 +865,7 @@
 
 
 
-  class ReferenceLineSource : public VolumeSlicerBase
+  class ReferenceLineSource : public IVolumeSlicer
   {
   private:
     class RendererFactory : public LayerReadyMessage::IRendererFactory
@@ -899,7 +902,7 @@
   public:
     ReferenceLineSource(MessageBroker& broker, 
                         SliceViewerWidget&  otherPlane) :
-      VolumeSlicerBase(broker),
+      IVolumeSlicer(broker),
       otherPlane_(otherPlane)
     {
       EmitMessage(IVolumeSlicer::GeometryReadyMessage(*this));
@@ -925,7 +928,7 @@
                                                viewportSlice.GetOrigin(), viewportSlice.GetNormal()))
       {
         // The two slice are parallel, don't try and display the intersection
-        NotifyLayerError(reference.GetGeometry());
+        EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
       }
       else
       {
@@ -946,7 +949,7 @@
         else
         {
           // Error: Parallel slices
-          NotifyLayerError(reference.GetGeometry());
+          EmitMessage(IVolumeSlicer::LayerErrorMessage(*this, reference.GetGeometry()));
         }
       }
     }
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Sat Nov 10 10:11:29 2018 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Sat Nov 10 12:34:45 2018 +0100
@@ -237,14 +237,13 @@
 
   ${ORTHANC_STONE_ROOT}/Framework/Layers/CircleMeasureTracker.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/ColorFrameRenderer.cpp
+  ${ORTHANC_STONE_ROOT}/Framework/Layers/DicomSeriesVolumeSlicer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/DicomStructureSetSlicer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/FrameRenderer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/GrayscaleFrameRenderer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/IVolumeSlicer.h
-  ${ORTHANC_STONE_ROOT}/Framework/Layers/VolumeSlicerBase.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/LineLayerRenderer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/LineMeasureTracker.cpp
-  ${ORTHANC_STONE_ROOT}/Framework/Layers/DicomSeriesVolumeSlicer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/RenderStyle.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Layers/SliceOutlineRenderer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/SmartLoader.cpp