Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/DicomStructurePolygon2.h @ 1310:9bea7e15b519 broker
- first pass at changes to cope with the refactoring of the loading system
- global loader-related data accessible through ILoadersContext::ILock
- many changes in legacy loaders (CT, RTSTRUCT, DOSE) + loader cache
- NOT FINISHED! there are shared_from_this calls in ctors! this will crash!
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 09 Mar 2020 14:53:22 +0100 |
parents | 2d8ab34c8c91 |
children | 30deba7bc8e2 |
rev | line source |
---|---|
998
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1019
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
998
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 * |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 * |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 **/ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 #pragma once |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
23 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
24 |
998
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include "CoordinateSystem3D.h" |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 #include "DicomStructureSetUtils.h" |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 #include "Extent2D.h" |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 #include "../Scene2D/Color.h" |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 #include "../StoneException.h" |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 #include <Plugins/Samples/Common/FullOrthancDataset.h> |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 #include <list> |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 #include <string> |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 namespace OrthancStone |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 Only polygons that are planar and parallel to either the X,Y or Z plane |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 ("X plane" == plane where X is equal to a constant for each point) are |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 supported. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 class DicomStructurePolygon2 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 public: |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 enum Type |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
50 ClosedPlanar, |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 Unsupported |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 }; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 DicomStructurePolygon2(std::string referencedSopInstanceUid, const std::string& type) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 : referencedSopInstanceUid_(referencedSopInstanceUid) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 , state_(Building) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 , minX_(std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 , maxX_(-std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 , minY_(std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 , maxY_(-std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 , minZ_(std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 , maxZ_(-std::numeric_limits<double>::max()) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 , type_(TypeFromString(type)) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 ORTHANC_ASSERT(type_ == ClosedPlanar); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 void ComputeDependentProperties(); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 size_t GetPointCount() const |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 ORTHANC_ASSERT(state_ == Valid); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
73 return points_.size(); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 const Point3D& GetPoint(size_t i) const |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 ORTHANC_ASSERT(state_ == Valid); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 return points_.at(i); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 void AddPoint(const Point3D& v) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 ORTHANC_ASSERT(state_ == Building); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 points_.push_back(v); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 void Reserve(size_t n) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 ORTHANC_ASSERT(state_ == Building); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 points_.reserve(n); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
92 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 This method takes a plane+coord system that is parallel to the polygon |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 and adds to polygons a new vector with the ordered set of points projected |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 on the plane, in the plane coordinate system. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 void ProjectOnParallelPlane( |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 std::vector< std::pair<Point2D,Point2D> >& segments, |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 const CoordinateSystem3D& plane) const; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 Returns the coordinates of the intersection of the polygon and a plane |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 that is perpendicular to the polygons (plane has either constant X or |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 constant Y) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 void ProjectOnConstantPlane( |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 std::vector<Point2D>& intersections, |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 const CoordinateSystem3D& plane) const; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
113 This method assumes polygon has a normal equal to 0,0,-1 and 0,0,1 (thus, |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
114 the polygon is parallel to the XY plane) and returns the Z coordinate of |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 all the polygon points |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 double GetZ() const; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
120 The normal sign is left undefined for now |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
121 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
122 Vector3D GetNormal() const |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 return normal_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
126 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 /** |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 This method will compute the intersection between a polygon and |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
129 a plane where either X, Y or Z is constant. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 The plane is given with an origin and a normal. If the normal is |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 not parallel to an axis, an error is raised. |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 */ |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 void ComputeIntersectionWithPlane(const CoordinateSystem3D& plane); |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 private: |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 static Type TypeFromString(const std::string& s) |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 if (s == "CLOSED_PLANAR") |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 return ClosedPlanar; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
140 else |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 return Unsupported; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 enum State |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 { |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 Building, |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 Valid |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 }; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 std::string referencedSopInstanceUid_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 CoordinateSystem3D geometry_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 std::vector<Point3D> points_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 Vector3D normal_; // sign is irrelevant for now |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 State state_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 double minX_, maxX_, minY_, maxY_, minZ_, maxZ_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 Type type_; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 }; |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 } |
38b6bb0bdd72
added a new set of classes that correctly handle non-convex polygons (not
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
158 #endif |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
159 // BGO_ENABLE_DICOMSTRUCTURESETLOADER2 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
160 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
998
diff
changeset
|
161 |