Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomStructureSetUtils.cpp @ 1895:14c8f339d480
removed redundant definitions Point2D, Point3D and Vector3D from DicomStructureSetUtils.h
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Jan 2022 14:51:55 +0100 |
parents | 7053b8a0aaec |
children |
comparison
equal
deleted
inserted
replaced
1894:438071a29f77 | 1895:14c8f339d480 |
---|---|
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 // static | 119 // static |
120 void ProcessBoundaryList( | 120 void ProcessBoundaryList( |
121 std::vector< std::pair<Point2D, Point2D> > & segments, | 121 std::vector< std::pair<ScenePoint2D, ScenePoint2D> > & segments, |
122 const std::vector<std::pair<double, RectangleBoundaryKind> > & boundaries, | 122 const std::vector<std::pair<double, RectangleBoundaryKind> > & boundaries, |
123 double y) | 123 double y) |
124 { | 124 { |
125 Point2D start; | 125 ScenePoint2D start; |
126 Point2D end; | 126 ScenePoint2D end; |
127 int curNumberOfSegments = 0; // we count the number of segments. we only draw if it is 1 (not 0 or 2) | 127 int curNumberOfSegments = 0; // we count the number of segments. we only draw if it is 1 (not 0 or 2) |
128 for (size_t i = 0; i < boundaries.size(); ++i) | 128 for (size_t i = 0; i < boundaries.size(); ++i) |
129 { | 129 { |
130 switch (boundaries[i].second) | 130 switch (boundaries[i].second) |
131 { | 131 { |
136 case 0: | 136 case 0: |
137 assert(false); | 137 assert(false); |
138 break; | 138 break; |
139 case 1: | 139 case 1: |
140 // a new segment has begun! | 140 // a new segment has begun! |
141 start.x = boundaries[i].first; | 141 start = ScenePoint2D(boundaries[i].first, y); |
142 start.y = y; | |
143 break; | 142 break; |
144 case 2: | 143 case 2: |
145 // an extra segment has begun : stop the current one (we don't draw overlaps) | 144 // an extra segment has begun : stop the current one (we don't draw overlaps) |
146 end.x = boundaries[i].first; | 145 end = ScenePoint2D(boundaries[i].first, y); |
147 end.y = y; | 146 segments.push_back(std::pair<ScenePoint2D, ScenePoint2D>(start, end)); |
148 segments.push_back(std::pair<Point2D, Point2D>(start, end)); | |
149 break; | 147 break; |
150 default: | 148 default: |
151 //assert(false); // seen IRL ! | 149 //assert(false); // seen IRL ! |
152 break; | 150 break; |
153 } | 151 } |
156 curNumberOfSegments -= 1; | 154 curNumberOfSegments -= 1; |
157 switch (curNumberOfSegments) | 155 switch (curNumberOfSegments) |
158 { | 156 { |
159 case 0: | 157 case 0: |
160 // a lone (thus active) segment has ended. | 158 // a lone (thus active) segment has ended. |
161 end.x = boundaries[i].first; | 159 end = ScenePoint2D(boundaries[i].first, y); |
162 end.y = y; | 160 segments.push_back(std::pair<ScenePoint2D, ScenePoint2D>(start, end)); |
163 segments.push_back(std::pair<Point2D, Point2D>(start, end)); | |
164 break; | 161 break; |
165 case 1: | 162 case 1: |
166 // an extra segment has ended : start a new one one | 163 // an extra segment has ended : start a new one one |
167 start.x = boundaries[i].first; | 164 start = ScenePoint2D(boundaries[i].first, y); |
168 start.y = y; | |
169 break; | 165 break; |
170 default: | 166 default: |
171 // this should not happen! | 167 // this should not happen! |
172 //assert(false); | 168 //assert(false); |
173 break; | 169 break; |
180 } | 176 } |
181 } | 177 } |
182 | 178 |
183 #if 0 | 179 #if 0 |
184 void ConvertListOfSlabsToSegments( | 180 void ConvertListOfSlabsToSegments( |
185 std::vector< std::pair<Point2D, Point2D> >& segments, | 181 std::vector< std::pair<ScenePoint2D, ScenePoint2D> >& segments, |
186 const std::vector<RtStructRectanglesInSlab>& slabCuts, | 182 const std::vector<RtStructRectanglesInSlab>& slabCuts, |
187 const size_t totalRectCount) | 183 const size_t totalRectCount) |
188 { | 184 { |
189 #error to delete | 185 #error to delete |
190 } | 186 } |
191 #else | 187 #else |
192 // See https://www.dropbox.com/s/bllco6q8aazxk44/2019-09-18-rtstruct-cut-algorithm-rect-merge.png | 188 // See https://www.dropbox.com/s/bllco6q8aazxk44/2019-09-18-rtstruct-cut-algorithm-rect-merge.png |
193 void ConvertListOfSlabsToSegments( | 189 void ConvertListOfSlabsToSegments( |
194 std::vector< std::pair<Point2D, Point2D> > & segments, | 190 std::vector< std::pair<ScenePoint2D, ScenePoint2D> > & segments, |
195 const std::vector<RtStructRectanglesInSlab> & slabCuts, | 191 const std::vector<RtStructRectanglesInSlab> & slabCuts, |
196 const size_t totalRectCount) | 192 const size_t totalRectCount) |
197 { | 193 { |
198 if (slabCuts.size() == 0) | 194 if (slabCuts.size() == 0) |
199 return; | 195 return; |
208 { | 204 { |
209 for (size_t iRect = 0; iRect < slabCuts[iSlab].size(); ++iRect) | 205 for (size_t iRect = 0; iRect < slabCuts[iSlab].size(); ++iRect) |
210 { | 206 { |
211 const RtStructRectangleInSlab& rect = slabCuts[iSlab][iRect]; | 207 const RtStructRectangleInSlab& rect = slabCuts[iSlab][iRect]; |
212 { | 208 { |
213 Point2D p1(rect.xmin, rect.ymin); | 209 ScenePoint2D p1(rect.xmin, rect.ymin); |
214 Point2D p2(rect.xmin, rect.ymax); | 210 ScenePoint2D p2(rect.xmin, rect.ymax); |
215 segments.push_back(std::pair<Point2D, Point2D>(p1, p2)); | 211 segments.push_back(std::pair<ScenePoint2D, ScenePoint2D>(p1, p2)); |
216 } | 212 } |
217 { | 213 { |
218 Point2D p1(rect.xmax, rect.ymin); | 214 ScenePoint2D p1(rect.xmax, rect.ymin); |
219 Point2D p2(rect.xmax, rect.ymax); | 215 ScenePoint2D p2(rect.xmax, rect.ymax); |
220 segments.push_back(std::pair<Point2D, Point2D>(p1, p2)); | 216 segments.push_back(std::pair<ScenePoint2D, ScenePoint2D>(p1, p2)); |
221 } | 217 } |
222 } | 218 } |
223 } | 219 } |
224 | 220 |
225 /* | 221 /* |