Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/DicomStructureSet.h @ 1885:ddaee6b96501
retrieving rt-struct info
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Jan 2022 19:04:05 +0100 |
parents | 7053b8a0aaec |
children | 6ce81914f7e4 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
47 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
0 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
0 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1455
diff
changeset
|
26 #include "../OrthancStone.h" |
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1455
diff
changeset
|
27 |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
28 #if !defined(ORTHANC_ENABLE_DCMTK) |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
29 # error The macro ORTHANC_ENABLE_DCMTK must be defined |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
30 #endif |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
31 |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
32 #include "DicomStructureSetUtils.h" |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
33 #include "CoordinateSystem3D.h" |
131 | 34 #include "Extent2D.h" |
1504 | 35 #include "OrthancDatasets/FullOrthancDataset.h" |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
36 #include "../Scene2D/Color.h" |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
37 #include "../Scene2D/PolylineSceneLayer.h" |
1885
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
38 #include "../Scene2D/ScenePoint2D.h" |
0 | 39 |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
40 #if ORTHANC_ENABLE_DCMTK == 1 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
41 # include <DicomParsing/ParsedDicomFile.h> |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
42 #endif |
0 | 43 |
1006
4f28d9459e31
Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
44 //#define USE_BOOST_UNION_FOR_POLYGONS 1 |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
45 |
201
e9c7a78a3e77
removed absolute paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
196
diff
changeset
|
46 |
0 | 47 #include <list> |
48 | |
49 namespace OrthancStone | |
50 { | |
51 class DicomStructureSet : public boost::noncopyable | |
52 { | |
53 private: | |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
54 struct ReferencedSlice |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
55 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
56 std::string seriesInstanceUid_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
57 CoordinateSystem3D geometry_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
58 double thickness_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
59 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
60 ReferencedSlice() |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
61 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
62 } |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
63 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
64 ReferencedSlice(const std::string& seriesInstanceUid, |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
65 const CoordinateSystem3D& geometry, |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
66 double thickness) : |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
67 seriesInstanceUid_(seriesInstanceUid), |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
68 geometry_(geometry), |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
69 thickness_(thickness) |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
70 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
71 } |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
72 }; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
73 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
74 typedef std::map<std::string, ReferencedSlice> ReferencedSlices; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
75 |
132
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
76 typedef std::vector<Vector> Points; |
0 | 77 |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
78 class Polygon |
0 | 79 { |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
80 private: |
131 | 81 std::string sopInstanceUid_; |
82 bool hasSlice_; | |
83 CoordinateSystem3D geometry_; | |
84 double projectionAlongNormal_; | |
85 double sliceThickness_; // In millimeters | |
86 Points points_; | |
87 Extent2D extent_; | |
0 | 88 |
981
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
89 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:
981
diff
changeset
|
90 bool IsPointOnSliceIfAny(const Vector& v) const; |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
91 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
92 public: |
1571 | 93 explicit Polygon(const std::string& sopInstanceUid) : |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
94 sopInstanceUid_(sopInstanceUid), |
1571 | 95 hasSlice_(false), |
96 projectionAlongNormal_(0), | |
97 sliceThickness_(0) | |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
98 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
99 } |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
100 |
132
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
101 void Reserve(size_t n) |
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
102 { |
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
103 points_.reserve(n); |
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
104 } |
35c2b85836ce
fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
131
diff
changeset
|
105 |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
106 void AddPoint(const Vector& v); |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
107 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
108 bool UpdateReferencedSlice(const ReferencedSlices& slices); |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
109 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
110 bool IsOnSlice(const CoordinateSystem3D& geometry) const; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
111 |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
112 const Vector& GetGeometryOrigin() const |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
113 { |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
114 return geometry_.GetOrigin(); |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
115 } |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
116 |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
117 const std::string& GetSopInstanceUid() const |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
118 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
119 return sopInstanceUid_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
120 } |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
121 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
122 const Points& GetPoints() const |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
123 { |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
124 return points_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
125 } |
126
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
125
diff
changeset
|
126 |
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
125
diff
changeset
|
127 double GetSliceThickness() const |
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
125
diff
changeset
|
128 { |
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
125
diff
changeset
|
129 return sliceThickness_; |
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
125
diff
changeset
|
130 } |
131 | 131 |
132 bool Project(double& x1, | |
133 double& y1, | |
134 double& x2, | |
135 double& y2, | |
136 const CoordinateSystem3D& slice) const; | |
0 | 137 }; |
138 | |
139 typedef std::list<Polygon> Polygons; | |
140 | |
141 struct Structure | |
142 { | |
143 std::string name_; | |
144 std::string interpretation_; | |
145 Polygons polygons_; | |
146 uint8_t red_; | |
147 uint8_t green_; | |
148 uint8_t blue_; | |
149 }; | |
150 | |
151 typedef std::vector<Structure> Structures; | |
152 | |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
153 Structures structures_; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
154 ReferencedSlices referencedSlices_; |
0 | 155 |
1504 | 156 void Setup(const IDicomDataset& dataset); |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
157 |
0 | 158 const Structure& GetStructure(size_t index) const; |
159 | |
125 | 160 Structure& GetStructure(size_t index); |
161 | |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
162 bool ProjectStructure( |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
163 #if USE_BOOST_UNION_FOR_POLYGONS == 1 |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
164 std::vector< std::vector<Point2D> >& polygons, |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
165 #else |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
166 std::vector< std::pair<Point2D, Point2D> >& segments, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
167 #endif |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
168 const Structure& structure, |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
169 const CoordinateSystem3D& slice) const; |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
170 |
0 | 171 public: |
1546
94750ef63ad5
support of Orthanc framework shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
172 explicit DicomStructureSet(const FullOrthancDataset& instance) |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
173 { |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
174 Setup(instance); |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
175 } |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
176 |
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
177 #if ORTHANC_ENABLE_DCMTK == 1 |
1546
94750ef63ad5
support of Orthanc framework shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
178 explicit DicomStructureSet(Orthanc::ParsedDicomFile& instance); |
1180
9c8f557ea799
ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
179 #endif |
0 | 180 |
794 | 181 size_t GetStructuresCount() const |
0 | 182 { |
183 return structures_.size(); | |
184 } | |
185 | |
186 Vector GetStructureCenter(size_t index) const; | |
187 | |
188 const std::string& GetStructureName(size_t index) const; | |
189 | |
190 const std::string& GetStructureInterpretation(size_t index) const; | |
191 | |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
192 Color GetStructureColor(size_t index) const; |
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
193 |
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
194 // TODO - remove |
0 | 195 void GetStructureColor(uint8_t& red, |
196 uint8_t& green, | |
197 uint8_t& blue, | |
198 size_t index) const; | |
199 | |
1885
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
200 void GetReferencedInstances(std::set<std::string>& instances) const; |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
201 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
202 void AddReferencedSlice(const std::string& sopInstanceUid, |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
203 const std::string& seriesInstanceUid, |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
204 const CoordinateSystem3D& geometry, |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
205 double thickness); |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
206 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
207 void AddReferencedSlice(const Orthanc::DicomMap& dataset); |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
208 |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
209 void CheckReferencedSlices(); |
0 | 210 |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
211 Vector GetNormal() const; |
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
212 |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
213 #if USE_BOOST_UNION_FOR_POLYGONS == 1 |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
214 bool ProjectStructure(std::vector< std::vector<Point2D> >& polygons, |
1165 | 215 size_t index, |
216 const CoordinateSystem3D& slice) const | |
0 | 217 { |
125 | 218 return ProjectStructure(polygons, GetStructure(index), slice); |
0 | 219 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
220 #else |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
221 bool ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments, |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
222 size_t index, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
223 const CoordinateSystem3D& slice) const |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
224 { |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
225 return ProjectStructure(segments, GetStructure(index), slice); |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
226 } |
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
988
diff
changeset
|
227 #endif |
1178
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
228 |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
229 void ProjectOntoLayer(PolylineSceneLayer& layer, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
230 const CoordinateSystem3D& plane, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
231 size_t structureIndex, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
232 const Color& color) const; |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
233 |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
234 void ProjectOntoLayer(PolylineSceneLayer& layer, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
235 const CoordinateSystem3D& plane, |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
236 size_t structureIndex) const |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
237 { |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
238 ProjectOntoLayer(layer, plane, structureIndex, GetStructureColor(structureIndex)); |
3c7cdbf32e2a
DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1170
diff
changeset
|
239 } |
1885
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
240 |
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
241 void GetStructurePoints(std::list< std::vector<Vector> >& target, |
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
242 size_t structureIndex, |
ddaee6b96501
retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
243 const std::string& sopInstanceUid) const; |
0 | 244 }; |
245 } |