Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomStructure2.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 |
---|---|
193 } | 193 } |
194 return NULL; | 194 return NULL; |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 bool DicomStructure2::Project(std::vector< std::pair<Point2D, Point2D> > & segments, const CoordinateSystem3D & plane) const | 198 bool DicomStructure2::Project(std::vector< std::pair<ScenePoint2D, ScenePoint2D> > & segments, const CoordinateSystem3D & plane) const |
199 { | 199 { |
200 segments.clear(); | 200 segments.clear(); |
201 | 201 |
202 Vector normal = GetNormal(); | 202 Vector normal = GetNormal(); |
203 | 203 |
235 // book an entry for this slab | 235 // book an entry for this slab |
236 rectanglesForEachSlab.push_back(RtStructRectanglesInSlab()); | 236 rectanglesForEachSlab.push_back(RtStructRectanglesInSlab()); |
237 | 237 |
238 // let's compute the intersection between the polygon and the plane | 238 // let's compute the intersection between the polygon and the plane |
239 // intersections are in plane coords | 239 // intersections are in plane coords |
240 std::vector<Point2D> intersections; | 240 std::vector<ScenePoint2D> intersections; |
241 | 241 |
242 polygons_[i].ProjectOnConstantPlane(intersections, plane); | 242 polygons_[i].ProjectOnConstantPlane(intersections, plane); |
243 | 243 |
244 // for each pair of intersections, we add a rectangle. | 244 // for each pair of intersections, we add a rectangle. |
245 if ((intersections.size() % 2) != 0) | 245 if ((intersections.size() % 2) != 0) |
255 totalRectCount += numRects; | 255 totalRectCount += numRects; |
256 | 256 |
257 for (size_t iRect = 0; iRect < numRects; ++iRect) | 257 for (size_t iRect = 0; iRect < numRects; ++iRect) |
258 { | 258 { |
259 RtStructRectangleInSlab rectangle; | 259 RtStructRectangleInSlab rectangle; |
260 ORTHANC_ASSERT(LinearAlgebra::IsNear(intersections[2 * iRect].y, intersections[2 * iRect + 1].y)); | 260 ORTHANC_ASSERT(LinearAlgebra::IsNear(intersections[2 * iRect].GetY(), intersections[2 * iRect + 1].GetY())); |
261 ORTHANC_ASSERT((2 * iRect + 1) < intersections.size()); | 261 ORTHANC_ASSERT((2 * iRect + 1) < intersections.size()); |
262 double x1 = intersections[2 * iRect].x; | 262 double x1 = intersections[2 * iRect].GetX(); |
263 double x2 = intersections[2 * iRect + 1].x; | 263 double x2 = intersections[2 * iRect + 1].GetX(); |
264 double y1 = intersections[2 * iRect].y - sliceThickness_ * 0.5; | 264 double y1 = intersections[2 * iRect].GetY() - sliceThickness_ * 0.5; |
265 double y2 = intersections[2 * iRect].y + sliceThickness_ * 0.5; | 265 double y2 = intersections[2 * iRect].GetY() + sliceThickness_ * 0.5; |
266 | 266 |
267 rectangle.xmin = std::min(x1, x2); | 267 rectangle.xmin = std::min(x1, x2); |
268 rectangle.xmax = std::max(x1, x2); | 268 rectangle.xmax = std::max(x1, x2); |
269 rectangle.ymin = std::min(y1, y2); | 269 rectangle.ymin = std::min(y1, y2); |
270 rectangle.ymax = std::max(y1, y2); | 270 rectangle.ymax = std::max(y1, y2); |