Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/DicomStructureSet.h @ 1000:50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 20 Sep 2019 11:59:29 +0200 |
parents | 4c9b4c4de814 |
children | 4f28d9459e31 |
comparison
equal
deleted
inserted
replaced
999:2d69b8bee484 | 1000:50e5acf5553b |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "DicomStructureSetUtils.h" | |
24 #include "CoordinateSystem3D.h" | 25 #include "CoordinateSystem3D.h" |
25 #include "Extent2D.h" | 26 #include "Extent2D.h" |
26 #include "../Scene2D/Color.h" | 27 #include "../Scene2D/Color.h" |
28 | |
29 //#define USE_OLD_SJO_CUT_CODE 1 | |
27 | 30 |
28 #include <Plugins/Samples/Common/FullOrthancDataset.h> | 31 #include <Plugins/Samples/Common/FullOrthancDataset.h> |
29 | 32 |
30 #include <list> | 33 #include <list> |
31 | 34 |
32 namespace OrthancStone | 35 namespace OrthancStone |
33 { | 36 { |
34 class DicomStructureSet : public boost::noncopyable | 37 class DicomStructureSet : public boost::noncopyable |
35 { | 38 { |
36 public: | |
37 typedef std::pair<double, double> PolygonPoint2D; | |
38 | |
39 private: | 39 private: |
40 struct ReferencedSlice | 40 struct ReferencedSlice |
41 { | 41 { |
42 std::string seriesInstanceUid_; | 42 std::string seriesInstanceUid_; |
43 CoordinateSystem3D geometry_; | 43 CoordinateSystem3D geometry_; |
91 | 91 |
92 bool UpdateReferencedSlice(const ReferencedSlices& slices); | 92 bool UpdateReferencedSlice(const ReferencedSlices& slices); |
93 | 93 |
94 bool IsOnSlice(const CoordinateSystem3D& geometry) const; | 94 bool IsOnSlice(const CoordinateSystem3D& geometry) const; |
95 | 95 |
96 const Vector& GetGeometryOrigin() const | |
97 { | |
98 return geometry_.GetOrigin(); | |
99 } | |
100 | |
96 const std::string& GetSopInstanceUid() const | 101 const std::string& GetSopInstanceUid() const |
97 { | 102 { |
98 return sopInstanceUid_; | 103 return sopInstanceUid_; |
99 } | 104 } |
100 | 105 |
134 | 139 |
135 const Structure& GetStructure(size_t index) const; | 140 const Structure& GetStructure(size_t index) const; |
136 | 141 |
137 Structure& GetStructure(size_t index); | 142 Structure& GetStructure(size_t index); |
138 | 143 |
139 bool ProjectStructure(std::vector< std::vector<PolygonPoint2D> >& polygons, | 144 #ifdef USE_OLD_SJO_CUT_CODE |
145 bool ProjectStructure(std::vector< std::vector<Point2D> >& polygons, | |
140 const Structure& structure, | 146 const Structure& structure, |
141 const CoordinateSystem3D& slice) const; | 147 const CoordinateSystem3D& slice) const; |
142 | 148 #else |
149 bool ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments, | |
150 const Structure& structure, | |
151 const CoordinateSystem3D& slice) const; | |
152 #endif | |
143 public: | 153 public: |
144 DicomStructureSet(const OrthancPlugins::FullOrthancDataset& instance); | 154 DicomStructureSet(const OrthancPlugins::FullOrthancDataset& instance); |
145 | 155 |
146 size_t GetStructuresCount() const | 156 size_t GetStructuresCount() const |
147 { | 157 { |
173 | 183 |
174 void CheckReferencedSlices(); | 184 void CheckReferencedSlices(); |
175 | 185 |
176 Vector GetNormal() const; | 186 Vector GetNormal() const; |
177 | 187 |
178 bool ProjectStructure(std::vector< std::vector<PolygonPoint2D> >& polygons, | 188 #ifdef USE_OLD_SJO_CUT_CODE |
179 size_t index, | 189 bool ProjectStructure(std::vector< std::vector<Point2D> >& polygons, |
180 const CoordinateSystem3D& slice) const | 190 size_t index, |
191 const CoordinateSystem3D& slice) const | |
181 { | 192 { |
182 return ProjectStructure(polygons, GetStructure(index), slice); | 193 return ProjectStructure(polygons, GetStructure(index), slice); |
183 } | 194 } |
195 #else | |
196 bool ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments, | |
197 size_t index, | |
198 const CoordinateSystem3D& slice) const | |
199 { | |
200 return ProjectStructure(segments, GetStructure(index), slice); | |
201 } | |
202 #endif | |
184 }; | 203 }; |
185 } | 204 } |