changeset 390:0cb925325470

renamed SiblingSliceLocation as ReferenceLine
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Nov 2018 17:37:34 +0100
parents 3e6e10a5a6c8
children 021480604c92
files Applications/Samples/LayoutPetCtFusionApplication.h Applications/Samples/SynchronizedSeriesApplication.h Framework/Layers/ReferenceLineFactory.cpp Framework/Layers/ReferenceLineFactory.h Framework/Layers/SiblingSliceLocationFactory.cpp Framework/Layers/SiblingSliceLocationFactory.h Framework/dev.h Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 8 files changed, 226 insertions(+), 225 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/LayoutPetCtFusionApplication.h	Fri Nov 09 17:28:32 2018 +0100
+++ b/Applications/Samples/LayoutPetCtFusionApplication.h	Fri Nov 09 17:37:34 2018 +0100
@@ -23,7 +23,7 @@
 
 #include "SampleInteractor.h"
 
-#include "../../Framework/Layers/SiblingSliceLocationFactory.h"
+#include "../../Framework/Layers/ReferenceLineFactory.h"
 #include "../../Framework/Layers/DicomStructureSetRendererFactory.h"
 #include "../../Framework/Widgets/LayoutWidget.h"
 
@@ -144,9 +144,9 @@
                                    LayeredSceneWidget& coronal,
                                    LayeredSceneWidget& sagittal)
       {
-        SiblingSliceLocationFactory::Configure(axial, coronal);
-        SiblingSliceLocationFactory::Configure(axial, sagittal);
-        SiblingSliceLocationFactory::Configure(coronal, sagittal);
+        ReferenceLineFactory::Configure(axial, coronal);
+        ReferenceLineFactory::Configure(axial, sagittal);
+        ReferenceLineFactory::Configure(coronal, sagittal);
       }
 
 
--- a/Applications/Samples/SynchronizedSeriesApplication.h	Fri Nov 09 17:28:32 2018 +0100
+++ b/Applications/Samples/SynchronizedSeriesApplication.h	Fri Nov 09 17:37:34 2018 +0100
@@ -25,7 +25,7 @@
 
 #include "../../Framework/Toolbox/OrthancSeriesLoader.h"
 #include "../../Framework/Layers/SeriesFrameRendererFactory.h"
-#include "../../Framework/Layers/SiblingSliceLocationFactory.h"
+#include "../../Framework/Layers/ReferenceLineFactory.h"
 #include "../../Framework/Widgets/LayoutWidget.h"
 
 #include <Core/Logging.h>
@@ -87,9 +87,9 @@
         std::auto_ptr<LayeredSceneWidget> b(CreateSeriesWidget(context, parameters["b"].as<std::string>()));
         std::auto_ptr<LayeredSceneWidget> c(CreateSeriesWidget(context, parameters["c"].as<std::string>()));
 
-        SiblingSliceLocationFactory::Configure(*a, *b);
-        SiblingSliceLocationFactory::Configure(*a, *c);
-        SiblingSliceLocationFactory::Configure(*b, *c);
+        ReferenceLineFactory::Configure(*a, *b);
+        ReferenceLineFactory::Configure(*a, *c);
+        ReferenceLineFactory::Configure(*b, *c);
 
         std::auto_ptr<LayoutWidget> layout(new LayoutWidget);
         layout->SetPadding(5);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/Layers/ReferenceLineFactory.cpp	Fri Nov 09 17:37:34 2018 +0100
@@ -0,0 +1,137 @@
+/**
+ * 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 "ReferenceLineFactory.h"
+
+#include "LineLayerRenderer.h"
+
+namespace OrthancStone
+{
+  ReferenceLineFactory::ReferenceLineFactory(LayeredSceneWidget& owner,
+                                             LayeredSceneWidget& sibling) :
+    owner_(owner),
+    sibling_(sibling),
+    hasLayerIndex_(false)
+  {
+    style_.SetColor(0, 255, 0);
+    slice_ = sibling.GetSlice();
+    sibling_.Register(*this);
+  }
+
+
+  void ReferenceLineFactory::NotifySliceChange(const LayeredSceneWidget& source,
+                                               const SliceGeometry& slice)
+  {
+    if (&source == &sibling_)
+    {
+      SetSlice(slice);
+    }
+  }
+
+
+  void ReferenceLineFactory::SetLayerIndex(size_t layerIndex)
+  {
+    hasLayerIndex_ = true;
+    layerIndex_ = layerIndex;
+  }
+
+
+  void ReferenceLineFactory::SetStyle(const RenderStyle& style)
+  {
+    style_ = style;
+  }
+
+
+  RenderStyle ReferenceLineFactory::GetRenderStyle()
+  {
+    return style_;
+  }
+
+
+  void ReferenceLineFactory::SetSlice(const SliceGeometry& slice)
+  {
+    slice_ = slice;
+
+    if (hasLayerIndex_)
+    {
+      owner_.InvalidateLayer(layerIndex_);
+    }
+  }
+
+
+  ILayerRenderer* ReferenceLineFactory::CreateLayerRenderer(const SliceGeometry& viewportSlice)
+  {
+    Vector p, d;
+
+    // Compute the line of intersection between the two slices
+    if (!GeometryToolbox::IntersectTwoPlanes(p, d, 
+                                             slice_.GetOrigin(), slice_.GetNormal(),
+                                             viewportSlice.GetOrigin(), viewportSlice.GetNormal()))
+    {
+      // The two slice are parallel, don't try and display the intersection
+      return NULL;
+    }
+
+    double x1, y1, x2, y2;
+    viewportSlice.ProjectPoint(x1, y1, p);
+    viewportSlice.ProjectPoint(x2, y2, p + 1000.0 * d);
+
+    double sx1, sy1, sx2, sy2;
+    owner_.GetView().GetSceneExtent(sx1, sy1, sx2, sy2);
+        
+    if (GeometryToolbox::ClipLineToRectangle(x1, y1, x2, y2, 
+                                             x1, y1, x2, y2,
+                                             sx1, sy1, sx2, sy2))
+    {
+      std::auto_ptr<ILayerRenderer> layer(new LineLayerRenderer(x1, y1, x2, y2));
+      layer->SetLayerStyle(style_);
+      return layer.release();
+    }
+    else
+    {
+      // Parallel slices
+      return NULL;
+    }
+  }
+
+
+  ISliceableVolume& ReferenceLineFactory::GetSourceVolume() const
+  {
+    throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+  }
+
+
+  void ReferenceLineFactory::Configure(LayeredSceneWidget& a,
+                                       LayeredSceneWidget& b)
+  {
+    {
+      size_t layerIndex;
+      ILayerRendererFactory& factory = a.AddLayer(layerIndex, new ReferenceLineFactory(a, b));
+      dynamic_cast<ReferenceLineFactory&>(factory).SetLayerIndex(layerIndex);
+    }
+
+    {
+      size_t layerIndex;
+      ILayerRendererFactory& factory = b.AddLayer(layerIndex, new ReferenceLineFactory(b, a));
+      dynamic_cast<ReferenceLineFactory&>(factory).SetLayerIndex(layerIndex);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/Layers/ReferenceLineFactory.h	Fri Nov 09 17:37:34 2018 +0100
@@ -0,0 +1,77 @@
+/**
+ * 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 "../Widgets/LayeredSceneWidget.h"
+
+namespace OrthancStone
+{
+  class ReferenceLineFactory : 
+    public ILayerRendererFactory,
+    public LayeredSceneWidget::ISliceObserver
+  {
+  private:
+    LayeredSceneWidget&   owner_;
+    LayeredSceneWidget&   sibling_;
+    SliceGeometry         slice_;
+    RenderStyle           style_;
+    bool                  hasLayerIndex_;
+    size_t                layerIndex_;
+
+      
+  public:
+    ReferenceLineFactory(LayeredSceneWidget& owner,
+                         LayeredSceneWidget& sibling);
+
+    virtual void NotifySliceChange(const LayeredSceneWidget& source,
+                                   const SliceGeometry& slice);
+
+    void SetLayerIndex(size_t layerIndex);
+
+    void SetStyle(const RenderStyle& style);
+
+    RenderStyle GetRenderStyle();
+
+    void SetSlice(const SliceGeometry& slice);
+
+    virtual bool GetExtent(double& x1,
+                           double& y1,
+                           double& x2,
+                           double& y2,
+                           const SliceGeometry& viewportSlice)
+    {
+      return false;
+    }
+
+    virtual ILayerRenderer* CreateLayerRenderer(const SliceGeometry& viewportSlice);
+
+    virtual bool HasSourceVolume() const
+    {
+      return false;
+    }
+
+    virtual ISliceableVolume& GetSourceVolume() const;
+
+    static void Configure(LayeredSceneWidget& a,
+                          LayeredSceneWidget& b);
+  };
+}
--- a/Framework/Layers/SiblingSliceLocationFactory.cpp	Fri Nov 09 17:28:32 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +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 "SiblingSliceLocationFactory.h"
-
-#include "LineLayerRenderer.h"
-
-namespace OrthancStone
-{
-  SiblingSliceLocationFactory::SiblingSliceLocationFactory(LayeredSceneWidget& owner,
-                                                           LayeredSceneWidget& sibling) :
-    owner_(owner),
-    sibling_(sibling),
-    hasLayerIndex_(false)
-  {
-    style_.SetColor(0, 255, 0);
-    slice_ = sibling.GetSlice();
-    sibling_.Register(*this);
-  }
-
-
-  void SiblingSliceLocationFactory::NotifySliceChange(const LayeredSceneWidget& source,
-                                                      const SliceGeometry& slice)
-  {
-    if (&source == &sibling_)
-    {
-      SetSlice(slice);
-    }
-  }
-
-
-  void SiblingSliceLocationFactory::SetLayerIndex(size_t layerIndex)
-  {
-    hasLayerIndex_ = true;
-    layerIndex_ = layerIndex;
-  }
-
-
-  void SiblingSliceLocationFactory::SetStyle(const RenderStyle& style)
-  {
-    style_ = style;
-  }
-
-
-  RenderStyle SiblingSliceLocationFactory::GetRenderStyle()
-  {
-    return style_;
-  }
-
-
-  void SiblingSliceLocationFactory::SetSlice(const SliceGeometry& slice)
-  {
-    slice_ = slice;
-
-    if (hasLayerIndex_)
-    {
-      owner_.InvalidateLayer(layerIndex_);
-    }
-  }
-
-
-  ILayerRenderer* SiblingSliceLocationFactory::CreateLayerRenderer(const SliceGeometry& viewportSlice)
-  {
-    Vector p, d;
-
-    // Compute the line of intersection between the two slices
-    if (!GeometryToolbox::IntersectTwoPlanes(p, d, 
-                                             slice_.GetOrigin(), slice_.GetNormal(),
-                                             viewportSlice.GetOrigin(), viewportSlice.GetNormal()))
-    {
-      // The two slice are parallel, don't try and display the intersection
-      return NULL;
-    }
-
-    double x1, y1, x2, y2;
-    viewportSlice.ProjectPoint(x1, y1, p);
-    viewportSlice.ProjectPoint(x2, y2, p + 1000.0 * d);
-
-    double sx1, sy1, sx2, sy2;
-    owner_.GetView().GetSceneExtent(sx1, sy1, sx2, sy2);
-        
-    if (GeometryToolbox::ClipLineToRectangle(x1, y1, x2, y2, 
-                                             x1, y1, x2, y2,
-                                             sx1, sy1, sx2, sy2))
-    {
-      std::auto_ptr<ILayerRenderer> layer(new LineLayerRenderer(x1, y1, x2, y2));
-      layer->SetLayerStyle(style_);
-      return layer.release();
-    }
-    else
-    {
-      // Parallel slices
-      return NULL;
-    }
-  }
-
-
-  ISliceableVolume& SiblingSliceLocationFactory::GetSourceVolume() const
-  {
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
-  }
-
-
-  void SiblingSliceLocationFactory::Configure(LayeredSceneWidget& a,
-                                              LayeredSceneWidget& b)
-  {
-    {
-      size_t layerIndex;
-      ILayerRendererFactory& factory = a.AddLayer(layerIndex, new SiblingSliceLocationFactory(a, b));
-      dynamic_cast<SiblingSliceLocationFactory&>(factory).SetLayerIndex(layerIndex);
-    }
-
-    {
-      size_t layerIndex;
-      ILayerRendererFactory& factory = b.AddLayer(layerIndex, new SiblingSliceLocationFactory(b, a));
-      dynamic_cast<SiblingSliceLocationFactory&>(factory).SetLayerIndex(layerIndex);
-    }
-  }
-}
--- a/Framework/Layers/SiblingSliceLocationFactory.h	Fri Nov 09 17:28:32 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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 "../Widgets/LayeredSceneWidget.h"
-
-namespace OrthancStone
-{
-  class SiblingSliceLocationFactory : 
-    public ILayerRendererFactory,
-    public LayeredSceneWidget::ISliceObserver
-  {
-  private:
-    LayeredSceneWidget&   owner_;
-    LayeredSceneWidget&   sibling_;
-    SliceGeometry         slice_;
-    RenderStyle           style_;
-    bool                  hasLayerIndex_;
-    size_t                layerIndex_;
-
-      
-  public:
-    SiblingSliceLocationFactory(LayeredSceneWidget& owner,
-                                LayeredSceneWidget& sibling);
-
-    virtual void NotifySliceChange(const LayeredSceneWidget& source,
-                                   const SliceGeometry& slice);
-
-    void SetLayerIndex(size_t layerIndex);
-
-    void SetStyle(const RenderStyle& style);
-
-    RenderStyle GetRenderStyle();
-
-    void SetSlice(const SliceGeometry& slice);
-
-    virtual bool GetExtent(double& x1,
-                           double& y1,
-                           double& x2,
-                           double& y2,
-                           const SliceGeometry& viewportSlice)
-    {
-      return false;
-    }
-
-    virtual ILayerRenderer* CreateLayerRenderer(const SliceGeometry& viewportSlice);
-
-    virtual bool HasSourceVolume() const
-    {
-      return false;
-    }
-
-    virtual ISliceableVolume& GetSourceVolume() const;
-
-    static void Configure(LayeredSceneWidget& a,
-                          LayeredSceneWidget& b);
-  };
-}
--- a/Framework/dev.h	Fri Nov 09 17:28:32 2018 +0100
+++ b/Framework/dev.h	Fri Nov 09 17:37:34 2018 +0100
@@ -862,7 +862,7 @@
 
 
 
-  class SliceLocationSource : public LayerSourceBase
+  class ReferenceLineSource : public LayerSourceBase
   {
   private:
     class RendererFactory : public LayerReadyMessage::IRendererFactory
@@ -897,7 +897,8 @@
     SliceViewerWidget&  otherPlane_;
 
   public:
-    SliceLocationSource(MessageBroker& broker, SliceViewerWidget&  otherPlane) :
+    ReferenceLineSource(MessageBroker& broker, 
+                        SliceViewerWidget&  otherPlane) :
       LayerSourceBase(broker),
       otherPlane_(otherPlane)
     {
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Fri Nov 09 17:28:32 2018 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Fri Nov 09 17:37:34 2018 +0100
@@ -233,7 +233,7 @@
 
 list(APPEND ORTHANC_STONE_SOURCES
   #${ORTHANC_STONE_ROOT}/Framework/Layers/SeriesFrameRendererFactory.cpp
-  #${ORTHANC_STONE_ROOT}/Framework/Layers/SiblingSliceLocationFactory.cpp
+  #${ORTHANC_STONE_ROOT}/Framework/Layers/ReferenceLineFactory.cpp
   #${ORTHANC_STONE_ROOT}/Framework/Layers/SingleFrameRendererFactory.cpp
 
   ${ORTHANC_STONE_ROOT}/Framework/Layers/CircleMeasureTracker.cpp