Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
646:b4fe9642e83b | 647:6af3099ed8da |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "Slice.h" | 24 #include "CoordinateSystem3D.h" |
25 | |
26 #include <Core/IDynamicObject.h> | |
25 | 27 |
26 namespace OrthancStone | 28 namespace OrthancStone |
27 { | 29 { |
30 // TODO - Rename this as "PlanesSorter" | |
28 class SlicesSorter : public boost::noncopyable | 31 class SlicesSorter : public boost::noncopyable |
29 { | 32 { |
30 private: | 33 private: |
31 class SliceWithDepth; | 34 class SliceWithDepth; |
32 struct Comparator; | 35 struct Comparator; |
33 | 36 |
34 typedef std::vector<SliceWithDepth*> Slices; | 37 typedef std::vector<SliceWithDepth*> Slices; |
35 | 38 |
36 Slices slices_; | 39 Slices slices_; |
37 bool hasNormal_; | 40 bool hasNormal_; |
41 | |
42 const SliceWithDepth& GetSlice(size_t i) const; | |
38 | 43 |
39 public: | 44 public: |
40 SlicesSorter() : hasNormal_(false) | 45 SlicesSorter() : hasNormal_(false) |
41 { | 46 { |
42 } | 47 } |
46 void Reserve(size_t count) | 51 void Reserve(size_t count) |
47 { | 52 { |
48 slices_.reserve(count); | 53 slices_.reserve(count); |
49 } | 54 } |
50 | 55 |
51 void AddSlice(Slice* slice); // Takes ownership | 56 void AddSlice(const CoordinateSystem3D& plane) |
57 { | |
58 AddSlice(plane, NULL); | |
59 } | |
52 | 60 |
53 size_t GetSliceCount() const | 61 void AddSlice(const CoordinateSystem3D& plane, |
62 Orthanc::IDynamicObject* payload); // Takes ownership | |
63 | |
64 size_t GetSlicesCount() const | |
54 { | 65 { |
55 return slices_.size(); | 66 return slices_.size(); |
56 } | 67 } |
57 | 68 |
58 const Slice& GetSlice(size_t i) const; | 69 const CoordinateSystem3D& GetSliceGeometry(size_t i) const; |
59 | 70 |
71 bool HasSlicePayload(size_t i) const; | |
72 | |
73 const Orthanc::IDynamicObject& GetSlicePayload(size_t i) const; | |
74 | |
60 void SetNormal(const Vector& normal); | 75 void SetNormal(const Vector& normal); |
61 | 76 |
62 void Sort(); | 77 void Sort(); |
63 | 78 |
64 void FilterNormal(const Vector& normal); | 79 void FilterNormal(const Vector& normal); |
65 | 80 |
66 bool SelectNormal(Vector& normal) const; | 81 bool SelectNormal(Vector& normal) const; |
67 | 82 |
68 bool LookupSlice(size_t& index, | 83 bool LookupClosestSlice(size_t& index, |
69 const CoordinateSystem3D& slice) const; | 84 double& distance, |
85 const CoordinateSystem3D& slice) const; | |
70 }; | 86 }; |
71 } | 87 } |