diff Framework/Toolbox/SlicesSorter.h @ 647:6af3099ed8da

uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 May 2019 17:03:46 +0200
parents b70e9be013e4
children 1088d4c4d78c
line wrap: on
line diff
--- a/Framework/Toolbox/SlicesSorter.h	Mon May 13 15:22:08 2019 +0200
+++ b/Framework/Toolbox/SlicesSorter.h	Mon May 13 17:03:46 2019 +0200
@@ -21,10 +21,13 @@
 
 #pragma once
 
-#include "Slice.h"
+#include "CoordinateSystem3D.h"
+
+#include <Core/IDynamicObject.h>
 
 namespace OrthancStone
 {
+  // TODO - Rename this as "PlanesSorter"
   class SlicesSorter : public boost::noncopyable
   {
   private:
@@ -36,6 +39,8 @@
     Slices  slices_;
     bool    hasNormal_;
     
+    const SliceWithDepth& GetSlice(size_t i) const;
+    
   public:
     SlicesSorter() : hasNormal_(false)
     {
@@ -48,15 +53,25 @@
       slices_.reserve(count);
     }
 
-    void AddSlice(Slice* slice);  // Takes ownership
+    void AddSlice(const CoordinateSystem3D& plane)
+    {
+      AddSlice(plane, NULL);
+    }
 
-    size_t GetSliceCount() const
+    void AddSlice(const CoordinateSystem3D& plane,
+                  Orthanc::IDynamicObject* payload);  // Takes ownership
+
+    size_t GetSlicesCount() const
     {
       return slices_.size();
     }
 
-    const Slice& GetSlice(size_t i) const;
+    const CoordinateSystem3D& GetSliceGeometry(size_t i) const;
 
+    bool HasSlicePayload(size_t i) const;
+    
+    const Orthanc::IDynamicObject& GetSlicePayload(size_t i) const;
+    
     void SetNormal(const Vector& normal);
     
     void Sort();
@@ -65,7 +80,8 @@
     
     bool SelectNormal(Vector& normal) const;
 
-    bool LookupSlice(size_t& index,
-                     const CoordinateSystem3D& slice) const;
+    bool LookupClosestSlice(size_t& index,
+                            double& distance,
+                            const CoordinateSystem3D& slice) const;
   };
 }