annotate Framework/Toolbox/DicomStructureSet2.h @ 988:4c9b4c4de814 toa2019090901

Fixed bug in DicomStructureSet that prevented points from being added to polygons
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 09 Sep 2019 16:15:28 +0200
parents d225bccd4d4a
children 38b6bb0bdd72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
987
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /**
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 * Stone of Orthanc
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 * the License, or (at your option) any later version.
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 * Affero General Public License for more details.
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 **/
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 #pragma once
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 #include "CoordinateSystem3D.h"
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 #include "Extent2D.h"
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 #include "../Scene2D/Color.h"
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 #include <Plugins/Samples/Common/FullOrthancDataset.h>
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 #include <list>
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 namespace OrthancStone
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 class DicomStructureSet2 : public boost::noncopyable
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 public:
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 typedef std::pair<double, double> PolygonPoint2D;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 private:
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 struct ReferencedSlice
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 std::string seriesInstanceUid_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 CoordinateSystem3D geometry_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 double thickness_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 ReferencedSlice()
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 ReferencedSlice(const std::string& seriesInstanceUid,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 const CoordinateSystem3D& geometry,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 double thickness) :
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 seriesInstanceUid_(seriesInstanceUid),
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 geometry_(geometry),
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 thickness_(thickness)
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 };
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 typedef std::map<std::string, ReferencedSlice> ReferencedSlices;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 typedef std::vector<Vector> Points;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 class Polygon
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 private:
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 std::string sopInstanceUid_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 bool hasSlice_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 CoordinateSystem3D geometry_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 double projectionAlongNormal_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 double sliceThickness_; // In millimeters
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 Points points_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 Extent2D extent_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 void CheckPointIsOnSlice(const Vector& v) const;
988
4c9b4c4de814 Fixed bug in DicomStructureSet that prevented points from being added to polygons
Benjamin Golinvaux <bgo@osimis.io>
parents: 987
diff changeset
76 bool IsPointOnSliceIfAny(const Vector& v) const;
987
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 public:
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 Polygon(const std::string& sopInstanceUid) :
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 sopInstanceUid_(sopInstanceUid),
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 hasSlice_(false)
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 void Reserve(size_t n)
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 points_.reserve(n);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 void AddPoint(const Vector& v);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 bool UpdateReferencedSlice(const ReferencedSlices& slices);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 bool IsOnSlice(const CoordinateSystem3D& geometry) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 const std::string& GetSopInstanceUid() const
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 return sopInstanceUid_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 const Points& GetPoints() const
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
102 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 return points_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 double GetSliceThickness() const
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 return sliceThickness_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 bool Project(double& x1,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 double& y1,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 double& x2,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 double& y2,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
115 const CoordinateSystem3D& slice) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
116 };
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 typedef std::list<Polygon> Polygons;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 struct Structure
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 std::string name_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 std::string interpretation_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 Polygons polygons_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 uint8_t red_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 uint8_t green_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127 uint8_t blue_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
128 };
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
129
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 typedef std::vector<Structure> Structures;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 Structures structures_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 ReferencedSlices referencedSlices_;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135 const Structure& GetStructure(size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 Structure& GetStructure(size_t index);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 bool ProjectStructure(std::vector< std::vector<PolygonPoint2D> >& polygons,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 const Structure& structure,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141 const CoordinateSystem3D& slice) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143 public:
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 DicomStructureSet2(const OrthancPlugins::FullOrthancDataset& instance);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 size_t GetStructuresCount() const
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148 return structures_.size();
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 Vector GetStructureCenter(size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 const std::string& GetStructureName(size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 const std::string& GetStructureInterpretation(size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 Color GetStructureColor(size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 // TODO - remove
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 void GetStructureColor(uint8_t& red,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 uint8_t& green,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162 uint8_t& blue,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 size_t index) const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 void GetReferencedInstances(std::set<std::string>& instances);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 void AddReferencedSlice(const std::string& sopInstanceUid,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 const std::string& seriesInstanceUid,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 const CoordinateSystem3D& geometry,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 double thickness);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 void AddReferencedSlice(const Orthanc::DicomMap& dataset);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 void CheckReferencedSlices();
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
176 Vector GetNormal() const;
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 bool ProjectStructure(std::vector< std::vector<PolygonPoint2D> >& polygons,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 size_t index,
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 const CoordinateSystem3D& slice) const
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 {
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
182 return ProjectStructure(polygons, GetStructure(index), slice);
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183 }
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184 };
d225bccd4d4a Scaffolding for A/B tests with DicomStructureSet[Loader] (A/B testing)
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
185 }