changeset 394:17d54c028805

rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Nov 2018 08:44:18 +0100
parents e7a494bdd956
children 5f13809f3f76
files Framework/Layers/ColorFrameRenderer.cpp Framework/Layers/ColorFrameRenderer.h Framework/Layers/DicomStructureSetRendererFactory.cpp Framework/Layers/DicomStructureSetRendererFactory.h Framework/Layers/FrameRenderer.cpp Framework/Layers/FrameRenderer.h Framework/Layers/GrayscaleFrameRenderer.cpp Framework/Layers/GrayscaleFrameRenderer.h Framework/Layers/ILayerRenderer.h Framework/Layers/LineLayerRenderer.cpp Framework/Layers/LineLayerRenderer.h Framework/Widgets/SliceViewerWidget.cpp Framework/Widgets/SliceViewerWidget.h
diffstat 13 files changed, 82 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Layers/ColorFrameRenderer.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/ColorFrameRenderer.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -41,11 +41,11 @@
 
 
   ColorFrameRenderer::ColorFrameRenderer(const Orthanc::ImageAccessor& frame,
-                                         const CoordinateSystem3D& frameSlice,
+                                         const CoordinateSystem3D& framePlane,
                                          double pixelSpacingX,
                                          double pixelSpacingY,
                                          bool isFullQuality) :
-    FrameRenderer(frameSlice, pixelSpacingX, pixelSpacingY, isFullQuality),
+    FrameRenderer(framePlane, pixelSpacingX, pixelSpacingY, isFullQuality),
     frame_(Orthanc::Image::Clone(frame))
   {
     if (frame_.get() == NULL)
--- a/Framework/Layers/ColorFrameRenderer.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/ColorFrameRenderer.h	Sat Nov 10 08:44:18 2018 +0100
@@ -35,7 +35,7 @@
 
   public:
     ColorFrameRenderer(const Orthanc::ImageAccessor& frame,
-                       const CoordinateSystem3D& frameSlice,
+                       const CoordinateSystem3D& framePlane,
                        double pixelSpacingX,
                        double pixelSpacingY,
                        bool isFullQuality);
--- a/Framework/Layers/DicomStructureSetRendererFactory.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/DicomStructureSetRendererFactory.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -38,12 +38,12 @@
 
     public:
       Structure(DicomStructureSet& structureSet,
-                const CoordinateSystem3D& slice,
+                const CoordinateSystem3D& plane,
                 size_t index) :
         name_(structureSet.GetStructureName(index))
       {
         structureSet.GetStructureColor(red_, green_, blue_, index);
-        visible_ = structureSet.ProjectStructure(polygons_, index, slice);
+        visible_ = structureSet.ProjectStructure(polygons_, index, plane);
       }
 
       void Render(CairoContext& context)
@@ -72,17 +72,17 @@
 
     typedef std::list<Structure*>  Structures;
     
-    CoordinateSystem3D  slice_;
+    CoordinateSystem3D  plane_;
     Structures          structures_;
     
   public:
     Renderer(DicomStructureSet& structureSet,
-             const CoordinateSystem3D& slice) :
-      slice_(slice)
+             const CoordinateSystem3D& plane) :
+      plane_(plane)
     {
       for (size_t k = 0; k < structureSet.GetStructureCount(); k++)
       {
-        structures_.push_back(new Structure(structureSet, slice, k));
+        structures_.push_back(new Structure(structureSet, plane, k));
       }
     }
 
@@ -110,9 +110,9 @@
       return true;
     }
 
-    virtual const CoordinateSystem3D& GetLayerSlice()
+    virtual const CoordinateSystem3D& GetLayerPlane()
     {
-      return slice_;
+      return plane_;
     }
 
     virtual void SetLayerStyle(const RenderStyle& style)
@@ -130,29 +130,29 @@
   {
   private:
     DicomStructureSet&         structureSet_;
-    const CoordinateSystem3D&  slice_;
+    const CoordinateSystem3D&  plane_;
 
   public:
     RendererFactory(DicomStructureSet& structureSet,
-                    const CoordinateSystem3D&  slice) :
+                    const CoordinateSystem3D&  plane) :
       structureSet_(structureSet),
-      slice_(slice)
+      plane_(plane)
     {
     }
 
     virtual ILayerRenderer* CreateRenderer() const
     {
-      return new Renderer(structureSet_, slice_);
+      return new Renderer(structureSet_, plane_);
     }
   };
   
 
-  void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
+  void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportPlane)
   {
     if (loader_.HasStructureSet())
     {
-      RendererFactory factory(loader_.GetStructureSet(), viewportSlice);
-      NotifyLayerReady(factory, viewportSlice);
+      RendererFactory factory(loader_.GetStructureSet(), viewportPlane);
+      NotifyLayerReady(factory, viewportPlane);
     }
   }
 }
--- a/Framework/Layers/DicomStructureSetRendererFactory.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/DicomStructureSetRendererFactory.h	Sat Nov 10 08:44:18 2018 +0100
@@ -60,11 +60,11 @@
     }
 
     virtual bool GetExtent(std::vector<Vector>& points,
-                           const CoordinateSystem3D& viewportSlice)
+                           const CoordinateSystem3D& viewportPlane)
     {
       return false;
     }
 
-    virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice);
+    virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportPlane);
   };
 }
--- a/Framework/Layers/FrameRenderer.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/FrameRenderer.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -28,11 +28,11 @@
 
 namespace OrthancStone
 {
-  FrameRenderer::FrameRenderer(const CoordinateSystem3D& frameSlice,
+  FrameRenderer::FrameRenderer(const CoordinateSystem3D& framePlane,
                                double pixelSpacingX,
                                double pixelSpacingY,
                                bool isFullQuality) :
-    frameSlice_(frameSlice),
+    framePlane_(framePlane),
     pixelSpacingX_(pixelSpacingX),
     pixelSpacingY_(pixelSpacingY),
     isFullQuality_(isFullQuality)
@@ -118,23 +118,23 @@
 
 
   ILayerRenderer* FrameRenderer::CreateRenderer(const Orthanc::ImageAccessor& frame,
-                                                const Slice& frameSlice,
+                                                const Slice& framePlane,
                                                 bool isFullQuality)
   {
     if (frame.GetFormat() == Orthanc::PixelFormat_RGB24)
     {
       return new ColorFrameRenderer(frame,
-                                    frameSlice.GetGeometry(), 
-                                    frameSlice.GetPixelSpacingX(),
-                                    frameSlice.GetPixelSpacingY(), isFullQuality);
+                                    framePlane.GetGeometry(), 
+                                    framePlane.GetPixelSpacingX(),
+                                    framePlane.GetPixelSpacingY(), isFullQuality);
     }
     else
     {
       return new GrayscaleFrameRenderer(frame,
-                                        frameSlice.GetConverter(),
-                                        frameSlice.GetGeometry(), 
-                                        frameSlice.GetPixelSpacingX(),
-                                        frameSlice.GetPixelSpacingY(), isFullQuality);
+                                        framePlane.GetConverter(),
+                                        framePlane.GetGeometry(), 
+                                        framePlane.GetPixelSpacingX(),
+                                        framePlane.GetPixelSpacingY(), isFullQuality);
     }
   }
 }
--- a/Framework/Layers/FrameRenderer.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/FrameRenderer.h	Sat Nov 10 08:44:18 2018 +0100
@@ -30,7 +30,7 @@
   class FrameRenderer : public ILayerRenderer
   {
   private:
-    CoordinateSystem3D            frameSlice_;
+    CoordinateSystem3D            framePlane_;
     double                        pixelSpacingX_;
     double                        pixelSpacingY_;
     RenderStyle                   style_;
@@ -41,7 +41,7 @@
     virtual CairoSurface* GenerateDisplay(const RenderStyle& style) = 0;
 
   public:
-    FrameRenderer(const CoordinateSystem3D& frameSlice,
+    FrameRenderer(const CoordinateSystem3D& framePlane,
                   double pixelSpacingX,
                   double pixelSpacingY,
                   bool isFullQuality);
@@ -49,9 +49,9 @@
     virtual bool RenderLayer(CairoContext& context,
                              const ViewportGeometry& view);
 
-    virtual const CoordinateSystem3D& GetLayerSlice()
+    virtual const CoordinateSystem3D& GetLayerPlane()
     {
-      return frameSlice_;
+      return framePlane_;
     }
 
     virtual void SetLayerStyle(const RenderStyle& style);
@@ -63,7 +63,7 @@
 
     // TODO: Avoid cloning the "frame"
     static ILayerRenderer* CreateRenderer(const Orthanc::ImageAccessor& frame,
-                                          const Slice& frameSlice,
+                                          const Slice& framePlane,
                                           bool isFullQuality);
   };
 }
--- a/Framework/Layers/GrayscaleFrameRenderer.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/GrayscaleFrameRenderer.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -115,11 +115,11 @@
 
   GrayscaleFrameRenderer::GrayscaleFrameRenderer(const Orthanc::ImageAccessor& frame,
                                                  const DicomFrameConverter& converter,
-                                                 const CoordinateSystem3D& frameSlice,
+                                                 const CoordinateSystem3D& framePlane,
                                                  double pixelSpacingX,
                                                  double pixelSpacingY,
                                                  bool isFullQuality) :
-    FrameRenderer(frameSlice, pixelSpacingX, pixelSpacingY, isFullQuality),
+    FrameRenderer(framePlane, pixelSpacingX, pixelSpacingY, isFullQuality),
     frame_(Orthanc::Image::Clone(frame)),
     defaultWindowCenter_(converter.GetDefaultWindowCenter()),
     defaultWindowWidth_(converter.GetDefaultWindowWidth()),
--- a/Framework/Layers/GrayscaleFrameRenderer.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/GrayscaleFrameRenderer.h	Sat Nov 10 08:44:18 2018 +0100
@@ -40,7 +40,7 @@
   public:
     GrayscaleFrameRenderer(const Orthanc::ImageAccessor& frame,
                            const DicomFrameConverter& converter,
-                           const CoordinateSystem3D& frameSlice,
+                           const CoordinateSystem3D& framePlane,
                            double pixelSpacingX,
                            double pixelSpacingY,
                            bool isFullQuality);
--- a/Framework/Layers/ILayerRenderer.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/ILayerRenderer.h	Sat Nov 10 08:44:18 2018 +0100
@@ -40,7 +40,7 @@
 
     virtual void SetLayerStyle(const RenderStyle& style) = 0;
 
-    virtual const CoordinateSystem3D& GetLayerSlice() = 0;
+    virtual const CoordinateSystem3D& GetLayerPlane() = 0;
     
     virtual bool IsFullQuality() = 0;
   };
--- a/Framework/Layers/LineLayerRenderer.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/LineLayerRenderer.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -27,12 +27,12 @@
                                        double y1,
                                        double x2,
                                        double y2,
-                                       const CoordinateSystem3D& slice) : 
+                                       const CoordinateSystem3D& plane) : 
     x1_(x1),
     y1_(y1),
     x2_(x2),
     y2_(y2),
-    slice_(slice)
+    plane_(plane)
   {
     RenderStyle style;
     SetLayerStyle(style);
--- a/Framework/Layers/LineLayerRenderer.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Layers/LineLayerRenderer.h	Sat Nov 10 08:44:18 2018 +0100
@@ -32,7 +32,7 @@
     double              y1_;
     double              x2_;
     double              y2_;
-    CoordinateSystem3D  slice_;
+    CoordinateSystem3D  plane_;
     bool                visible_;
     uint8_t             color_[3];
 
@@ -41,16 +41,16 @@
                       double y1,
                       double x2,
                       double y2,
-                      const CoordinateSystem3D& slice);
+                      const CoordinateSystem3D& plane);
 
     virtual bool RenderLayer(CairoContext& context,
                              const ViewportGeometry& view);
 
     virtual void SetLayerStyle(const RenderStyle& style);
 
-    virtual const CoordinateSystem3D& GetLayerSlice()
+    virtual const CoordinateSystem3D& GetLayerPlane()
     {
-      return slice_;
+      return plane_;
     }
     
     virtual bool IsFullQuality()
--- a/Framework/Widgets/SliceViewerWidget.cpp	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Widgets/SliceViewerWidget.cpp	Sat Nov 10 08:44:18 2018 +0100
@@ -37,7 +37,7 @@
   class SliceViewerWidget::Scene : public boost::noncopyable
   {
   private:
-    CoordinateSystem3D            slice_;
+    CoordinateSystem3D            plane_;
     double                        thickness_;
     size_t                        countMissing_;
     std::vector<ILayerRenderer*>  renderers_;
@@ -61,10 +61,10 @@
       }
     }
 
-    Scene(const CoordinateSystem3D& slice,
+    Scene(const CoordinateSystem3D& plane,
           double thickness,
           size_t countLayers) :
-      slice_(slice),
+      plane_(plane),
       thickness_(thickness),
       countMissing_(countLayers),
       renderers_(countLayers, NULL)
@@ -97,9 +97,9 @@
       countMissing_--;
     }
 
-    const CoordinateSystem3D& GetSlice() const
+    const CoordinateSystem3D& GetPlane() const
     {
-      return slice_;
+      return plane_;
     }
 
     bool HasRenderer(size_t index)
@@ -119,7 +119,7 @@
 
     bool RenderScene(CairoContext& context,
                      const ViewportGeometry& view,
-                     const CoordinateSystem3D& viewportSlice)
+                     const CoordinateSystem3D& viewportPlane)
     {
       bool fullQuality = true;
       cairo_t *cr = context.GetObject();
@@ -128,12 +128,12 @@
       {
         if (renderers_[i] != NULL)
         {
-          const CoordinateSystem3D& frameSlice = renderers_[i]->GetLayerSlice();
+          const CoordinateSystem3D& framePlane = renderers_[i]->GetLayerPlane();
           
           double x0, y0, x1, y1, x2, y2;
-          viewportSlice.ProjectPoint(x0, y0, frameSlice.GetOrigin());
-          viewportSlice.ProjectPoint(x1, y1, frameSlice.GetOrigin() + frameSlice.GetAxisX());
-          viewportSlice.ProjectPoint(x2, y2, frameSlice.GetOrigin() + frameSlice.GetAxisY());
+          viewportPlane.ProjectPoint(x0, y0, framePlane.GetOrigin());
+          viewportPlane.ProjectPoint(x1, y1, framePlane.GetOrigin() + framePlane.GetAxisX());
+          viewportPlane.ProjectPoint(x2, y2, framePlane.GetOrigin() + framePlane.GetAxisY());
 
           /**
            * Now we solve the system of linear equations Ax + b = x', given:
@@ -206,19 +206,19 @@
       }
     }
 
-    bool ContainsPlane(const CoordinateSystem3D& slice) const
+    bool ContainsPlane(const CoordinateSystem3D& plane) const
     {
       bool isOpposite;
       if (!GeometryToolbox::IsParallelOrOpposite(isOpposite,
-                                                 slice.GetNormal(),
-                                                 slice_.GetNormal()))
+                                                 plane.GetNormal(),
+                                                 plane_.GetNormal()))
       {
         return false;
       }
       else
       {
-        double z = (slice_.ProjectAlongNormal(slice.GetOrigin()) -
-                    slice_.ProjectAlongNormal(slice_.GetOrigin()));
+        double z = (plane_.ProjectAlongNormal(plane.GetOrigin()) -
+                    plane_.ProjectAlongNormal(plane_.GetOrigin()));
 
         if (z < 0)
         {
@@ -261,12 +261,12 @@
     extent.Reset();
 
     std::vector<Vector> points;
-    if (source.GetExtent(points, slice_))
+    if (source.GetExtent(points, plane_))
     {
       for (size_t i = 0; i < points.size(); i++)
       {
         double x, y;
-        slice_.ProjectPoint(x, y, points[i]);
+        plane_.ProjectPoint(x, y, points[i]);
         extent.AddPoint(x, y);
       }
     }
@@ -295,7 +295,7 @@
   {
     if (currentScene_.get() != NULL)
     {
-      return currentScene_->RenderScene(context, view, slice_);
+      return currentScene_->RenderScene(context, view, plane_);
     }
     else
     {
@@ -316,13 +316,13 @@
       thickness = pendingScene_->GetThickness();
     }
     
-    pendingScene_.reset(new Scene(slice_, thickness, layers_.size()));
+    pendingScene_.reset(new Scene(plane_, thickness, layers_.size()));
   }
   
 
   void SliceViewerWidget::UpdateLayer(size_t index,
                                       ILayerRenderer* renderer,
-                                      const CoordinateSystem3D& slice)
+                                      const CoordinateSystem3D& plane)
   {
     LOG(INFO) << "Updating layer " << index;
     
@@ -342,13 +342,13 @@
     renderer->SetLayerStyle(styles_[index]);
 
     if (currentScene_.get() != NULL &&
-        currentScene_->ContainsPlane(slice))
+        currentScene_->ContainsPlane(plane))
     {
       currentScene_->SetLayer(index, tmp.release());
       NotifyContentChanged();
     }
     else if (pendingScene_.get() != NULL &&
-             pendingScene_->ContainsPlane(slice))
+             pendingScene_->ContainsPlane(plane))
     {
       pendingScene_->SetLayer(index, tmp.release());
 
@@ -503,13 +503,13 @@
   }
   
 
-  void SliceViewerWidget::SetSlice(const CoordinateSystem3D& slice)
+  void SliceViewerWidget::SetSlice(const CoordinateSystem3D& plane)
   {
-    LOG(INFO) << "Setting slice origin: (" << slice.GetOrigin()[0]
-              << "," << slice.GetOrigin()[1]
-              << "," << slice.GetOrigin()[2] << ")";
+    LOG(INFO) << "Setting slice origin: (" << plane.GetOrigin()[0]
+              << "," << plane.GetOrigin()[1]
+              << "," << plane.GetOrigin()[2] << ")";
     
-    Slice displayedSlice(slice_, THIN_SLICE_THICKNESS);
+    Slice displayedSlice(plane_, THIN_SLICE_THICKNESS);
 
     //if (!displayedSlice.ContainsPlane(slice))
     {
@@ -520,7 +520,7 @@
         currentScene_ = pendingScene_;
       }
 
-      slice_ = slice;
+      plane_ = plane;
       ResetPendingScene();
 
       InvalidateAllLayers();   // TODO Removing this line avoid loading twice the image in WASM
@@ -536,7 +536,7 @@
       LOG(INFO) << ": Geometry ready for layer " << i << " in " << GetName();
 
       changedLayers_[i] = true;
-      //layers_[i]->ScheduleLayerCreation(slice_);
+      //layers_[i]->ScheduleLayerCreation(plane_);
     }
     EmitMessage(GeometryChangedMessage(*this));
   }
@@ -549,7 +549,7 @@
       assert(layers_[i] != NULL);
       changedLayers_[i] = true;
       
-      //layers_[i]->ScheduleLayerCreation(slice_);
+      //layers_[i]->ScheduleLayerCreation(plane_);
     }
   }
 
@@ -564,7 +564,7 @@
     assert(layers_[layer] != NULL);
     changedLayers_[layer] = true;
 
-    //layers_[layer]->ScheduleLayerCreation(slice_);
+    //layers_[layer]->ScheduleLayerCreation(plane_);
   }
 
 
@@ -582,7 +582,7 @@
 
   void SliceViewerWidget::OnSliceChanged(const ILayerSource::SliceChangedMessage& message)
   {
-    if (message.GetSlice().ContainsPlane(slice_))
+    if (message.GetSlice().ContainsPlane(plane_))
     {
       size_t index;
       if (LookupLayer(index, message.GetOrigin()))
@@ -642,7 +642,7 @@
     {
       if (changedLayers_[i])
       {
-        layers_[i]->ScheduleLayerCreation(slice_);
+        layers_[i]->ScheduleLayerCreation(plane_);
       }
     }
     
--- a/Framework/Widgets/SliceViewerWidget.h	Fri Nov 09 18:30:30 2018 +0100
+++ b/Framework/Widgets/SliceViewerWidget.h	Sat Nov 10 08:44:18 2018 +0100
@@ -48,7 +48,7 @@
     LayersIndex                 layersIndex_;
     std::vector<ILayerSource*>  layers_;
     std::vector<RenderStyle>    styles_;
-    CoordinateSystem3D          slice_;
+    CoordinateSystem3D          plane_;
     std::auto_ptr<Scene>        currentScene_;
     std::auto_ptr<Scene>        pendingScene_;
     std::vector<bool>           changedLayers_;
@@ -87,7 +87,7 @@
 
     void UpdateLayer(size_t index,
                      ILayerRenderer* renderer,
-                     const CoordinateSystem3D& slice);
+                     const CoordinateSystem3D& plane);
 
     void InvalidateAllLayers();
 
@@ -112,11 +112,11 @@
     void SetLayerStyle(size_t layer,
                        const RenderStyle& style);
 
-    void SetSlice(const CoordinateSystem3D& slice);
+    void SetSlice(const CoordinateSystem3D& plane);
 
     const CoordinateSystem3D& GetSlice() const
     {
-      return slice_;
+      return plane_;
     }
 
     virtual bool HasAnimation() const