annotate Framework/Toolbox/DicomStructureSet.h @ 1326:55166e57a77c broker

doc
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 24 Mar 2020 21:32:35 +0100
parents 7ec8fea061b9
children 30deba7bc8e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1006
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
16 *
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1180
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
24 #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
25 # 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
26 #endif
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
27
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
28 #include "DicomStructureSetUtils.h"
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
29 #include "CoordinateSystem3D.h"
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
30 #include "Extent2D.h"
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
31 #include "../Scene2D/Color.h"
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
32 #include "../Scene2D/PolylineSceneLayer.h"
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
1180
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
34 #if ORTHANC_ENABLE_DCMTK == 1
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
35 # include <Core/DicomParsing/ParsedDicomFile.h>
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
36 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
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
38 //#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
39
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
40 #include <Plugins/Samples/Common/FullOrthancDataset.h>
201
e9c7a78a3e77 removed absolute paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 196
diff changeset
41
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #include <list>
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 namespace OrthancStone
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 class DicomStructureSet : public boost::noncopyable
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 private:
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
49 struct ReferencedSlice
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
50 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
51 std::string seriesInstanceUid_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
52 CoordinateSystem3D geometry_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
53 double thickness_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
54
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
55 ReferencedSlice()
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
56 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
57 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
58
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
59 ReferencedSlice(const std::string& seriesInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
60 const CoordinateSystem3D& geometry,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
61 double thickness) :
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
62 seriesInstanceUid_(seriesInstanceUid),
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
63 geometry_(geometry),
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
64 thickness_(thickness)
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
65 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
66 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
67 };
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
68
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
69 typedef std::map<std::string, ReferencedSlice> ReferencedSlices;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
70
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
71 typedef std::vector<Vector> Points;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
73 class Polygon
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 {
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
75 private:
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
76 std::string sopInstanceUid_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
77 bool hasSlice_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
78 CoordinateSystem3D geometry_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
79 double projectionAlongNormal_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
80 double sliceThickness_; // In millimeters
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
81 Points points_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
82 Extent2D extent_;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
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
84 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
85 bool IsPointOnSliceIfAny(const Vector& v) const;
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
86
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
87 public:
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
88 Polygon(const std::string& sopInstanceUid) :
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
89 sopInstanceUid_(sopInstanceUid),
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
90 hasSlice_(false)
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 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
93
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
94 void Reserve(size_t n)
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
95 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
96 points_.reserve(n);
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
97 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
98
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
99 void AddPoint(const Vector& v);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
100
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
101 bool UpdateReferencedSlice(const ReferencedSlices& slices);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
102
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
103 bool IsOnSlice(const CoordinateSystem3D& geometry) const;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
104
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
105 const Vector& GetGeometryOrigin() const
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
106 {
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
107 return geometry_.GetOrigin();
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
108 }
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
109
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
110 const std::string& GetSopInstanceUid() const
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
111 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
112 return sopInstanceUid_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
113 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
114
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
115 const Points& GetPoints() const
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
116 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
117 return points_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
118 }
126
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
119
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
120 double GetSliceThickness() const
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
121 {
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
122 return sliceThickness_;
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
123 }
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
124
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
125 bool Project(double& x1,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
126 double& y1,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
127 double& x2,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
128 double& y2,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
129 const CoordinateSystem3D& slice) const;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 typedef std::list<Polygon> Polygons;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 struct Structure
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 std::string name_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 std::string interpretation_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 Polygons polygons_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 uint8_t red_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 uint8_t green_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 uint8_t blue_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 typedef std::vector<Structure> Structures;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
146 Structures structures_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
147 ReferencedSlices referencedSlices_;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
1180
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
149 void Setup(const OrthancPlugins::IDicomDataset& dataset);
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
150
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 const Structure& GetStructure(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
125
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
153 Structure& GetStructure(size_t index);
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
154
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
155 bool ProjectStructure(
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
156 #if USE_BOOST_UNION_FOR_POLYGONS == 1
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
157 std::vector< std::vector<Point2D> >& polygons,
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
158 #else
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
159 std::vector< std::pair<Point2D, Point2D> >& segments,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
160 #endif
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
161 const Structure& structure,
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
162 const CoordinateSystem3D& slice) const;
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
163
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 public:
1180
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
165 DicomStructureSet(const OrthancPlugins::FullOrthancDataset& instance)
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
166 {
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
167 Setup(instance);
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
168 }
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
169
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
170 #if ORTHANC_ENABLE_DCMTK == 1
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
171 DicomStructureSet(Orthanc::ParsedDicomFile& instance);
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
172 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
794
04f518ebd132 LoaderStateMachine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 792
diff changeset
174 size_t GetStructuresCount() const
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 return structures_.size();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 Vector GetStructureCenter(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 const std::string& GetStructureName(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 const std::string& GetStructureInterpretation(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
185 Color GetStructureColor(size_t index) const;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
186
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
187 // TODO - remove
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 void GetStructureColor(uint8_t& red,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 uint8_t& green,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 uint8_t& blue,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
193 void GetReferencedInstances(std::set<std::string>& instances);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
194
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
195 void AddReferencedSlice(const std::string& sopInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
196 const std::string& seriesInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
197 const CoordinateSystem3D& geometry,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
198 double thickness);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
199
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
200 void AddReferencedSlice(const Orthanc::DicomMap& dataset);
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 CheckReferencedSlices();
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
204 Vector GetNormal() const;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
205
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
206 #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
207 bool ProjectStructure(std::vector< std::vector<Point2D> >& polygons,
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
208 size_t index,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
209 const CoordinateSystem3D& slice) const
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
125
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
211 return ProjectStructure(polygons, GetStructure(index), slice);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
213 #else
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
214 bool ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments,
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
215 size_t index,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
216 const CoordinateSystem3D& slice) const
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
217 {
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
218 return ProjectStructure(segments, GetStructure(index), slice);
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
219 }
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
220 #endif
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
221
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
222 void ProjectOntoLayer(PolylineSceneLayer& layer,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
223 const CoordinateSystem3D& plane,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
224 size_t structureIndex,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
225 const Color& color) const;
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
226
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
227 void ProjectOntoLayer(PolylineSceneLayer& layer,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
228 const CoordinateSystem3D& plane,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
229 size_t structureIndex) const
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
230 {
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
231 ProjectOntoLayer(layer, plane, structureIndex, GetStructureColor(structureIndex));
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
232 }
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 }