annotate OrthancStone/Sources/Toolbox/DicomStructureSet.h @ 1964:2034ae383cfd deep-learning

integration default->deep-learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 07:47:55 +0200
parents 98952be6fb97
children 07964689cb0b
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
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
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
11 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
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
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
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
32 #include "CoordinateSystem3D.h"
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
33 #include "Extent2D.h"
1504
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
34 #include "OrthancDatasets/FullOrthancDataset.h"
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
35 #include "../Scene2D/Color.h"
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
36 #include "../Scene2D/PolylineSceneLayer.h"
1885
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
37 #include "../Scene2D/ScenePoint2D.h"
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
1180
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
39 #if ORTHANC_ENABLE_DCMTK == 1
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
40 # 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
41 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
201
e9c7a78a3e77 removed absolute paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 196
diff changeset
43
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #include <list>
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 namespace OrthancStone
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 class DicomStructureSet : public boost::noncopyable
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 private:
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
51 struct ReferencedSlice
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
52 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
53 std::string seriesInstanceUid_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
54 CoordinateSystem3D geometry_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
55 double thickness_;
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 ReferencedSlice()
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 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
60
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
61 ReferencedSlice(const std::string& seriesInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
62 const CoordinateSystem3D& geometry,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
63 double thickness) :
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
64 seriesInstanceUid_(seriesInstanceUid),
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
65 geometry_(geometry),
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
66 thickness_(thickness)
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 };
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 typedef std::map<std::string, ReferencedSlice> ReferencedSlices;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
72
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
73 typedef std::vector<Vector> Points;
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 class Polygon
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
77 private:
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
78 std::string sopInstanceUid_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
79 bool hasSlice_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
80 CoordinateSystem3D geometry_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
81 double projectionAlongNormal_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
82 double sliceThickness_; // In millimeters
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
83 Points points_;
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
84 Extent2D extent_;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
988
4c9b4c4de814 Fixed bug in DicomStructureSet that prevented points from being added to polygons
Benjamin Golinvaux <bgo@osimis.io>
parents: 981
diff changeset
86 bool IsPointOnSliceIfAny(const Vector& v) const;
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
87
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
88 public:
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
89 explicit Polygon(const std::string& sopInstanceUid) :
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
90 sopInstanceUid_(sopInstanceUid),
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
91 hasSlice_(false),
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
92 projectionAlongNormal_(0),
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
93 sliceThickness_(0)
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
94 {
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
95 }
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
96
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
97 void Reserve(size_t n)
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
98 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
99 points_.reserve(n);
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
100 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
101
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
102 void AddPoint(const Vector& v);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
103
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
104 bool UpdateReferencedSlice(const ReferencedSlices& slices);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
105
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
106 bool IsOnSlice(const CoordinateSystem3D& cuttingPlane,
1904
738814c24574 speed up rendering of axial slices of RT-STRUCT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
107 const Vector& estimatedNormal,
738814c24574 speed up rendering of axial slices of RT-STRUCT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
108 double estimatedSliceThickness) const;
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
109
1000
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
110 const Vector& GetGeometryOrigin() const
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
111 {
50e5acf5553b changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents: 988
diff changeset
112 return geometry_.GetOrigin();
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
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
115 const std::string& GetSopInstanceUid() 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 sopInstanceUid_;
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
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
120 const Points& GetPoints() const
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 return points_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
123 }
126
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
124
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
125 double GetSliceThickness() const
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 return sliceThickness_;
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
128 }
131
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
129
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
130 bool Project(double& x1,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
131 double& y1,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
132 double& x2,
3e6163a53b16 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
133 double& y2,
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
134 const CoordinateSystem3D& cuttingPlane,
1904
738814c24574 speed up rendering of axial slices of RT-STRUCT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
135 const Vector& estimatedNormal,
738814c24574 speed up rendering of axial slices of RT-STRUCT
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
136 double estimatedSliceThickness) const;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 typedef std::list<Polygon> Polygons;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 struct Structure
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 std::string name_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 std::string interpretation_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 Polygons polygons_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 uint8_t red_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 uint8_t green_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 uint8_t blue_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
1945
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
151 typedef std::vector<Structure> Structures;
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
152 typedef std::map<std::string, size_t> StructureNamesIndex;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
154 Structures structures_;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
155 ReferencedSlices referencedSlices_;
1892
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
156 Vector estimatedNormal_;
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
157 double estimatedSliceThickness_;
1945
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
158 StructureNamesIndex structureNamesIndex_;
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
159
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
1504
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1471
diff changeset
161 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
162
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 const Structure& GetStructure(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
125
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
165 Structure& GetStructure(size_t index);
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
166
1896
b3c08e607d9f simplified signature of DicomStructureSet::ProjectStructure()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1895
diff changeset
167 bool ProjectStructure(std::vector< std::vector<ScenePoint2D> >& chains,
b3c08e607d9f simplified signature of DicomStructureSet::ProjectStructure()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1895
diff changeset
168 const Structure& structure,
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
169 const CoordinateSystem3D& cuttingPlane) const;
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
170
1892
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
171 void EstimateGeometry();
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
172
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 public:
1546
94750ef63ad5 support of Orthanc framework shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
174 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
175 {
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
176 Setup(instance);
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
177 }
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
178
9c8f557ea799 ParsedDicomDataset to speed up loading RT-STRUCT from parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1178
diff changeset
179 #if ORTHANC_ENABLE_DCMTK == 1
1546
94750ef63ad5 support of Orthanc framework shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
180 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
181 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
794
04f518ebd132 LoaderStateMachine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 792
diff changeset
183 size_t GetStructuresCount() const
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 return structures_.size();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 Vector GetStructureCenter(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 const std::string& GetStructureName(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 const std::string& GetStructureInterpretation(size_t index) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
194 Color GetStructureColor(size_t index) const;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 794
diff changeset
195
1885
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
196 void GetReferencedInstances(std::set<std::string>& instances) const;
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
197
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
198 void AddReferencedSlice(const std::string& sopInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
199 const std::string& seriesInstanceUid,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
200 const CoordinateSystem3D& geometry,
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
201 double thickness);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
202
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
203 void AddReferencedSlice(const Orthanc::DicomMap& dataset);
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
204
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
205 void CheckReferencedSlices();
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
207 Vector GetNormal() const;
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
208
1896
b3c08e607d9f simplified signature of DicomStructureSet::ProjectStructure()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1895
diff changeset
209 bool ProjectStructure(std::vector< std::vector<ScenePoint2D> >& chains,
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
210 size_t index,
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
211 const CoordinateSystem3D& cuttingPlane) const
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 {
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
213 return ProjectStructure(chains, GetStructure(index), cuttingPlane);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 }
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
215
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
216 void ProjectOntoLayer(PolylineSceneLayer& layer,
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
217 const CoordinateSystem3D& cuttingPlane,
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
218 size_t structureIndex,
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
219 const Color& color) const;
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
220
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
221 void ProjectOntoLayer(PolylineSceneLayer& layer,
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
222 const CoordinateSystem3D& cuttingPlane,
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
223 size_t structureIndex) const
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
224 {
1909
782ba9eb6f22 improved variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1904
diff changeset
225 ProjectOntoLayer(layer, cuttingPlane, structureIndex, GetStructureColor(structureIndex));
1178
3c7cdbf32e2a DicomStructureSet::ProjectOntoLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1170
diff changeset
226 }
1885
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
227
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
228 void GetStructurePoints(std::list< std::vector<Vector> >& target,
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
229 size_t structureIndex,
ddaee6b96501 retrieving rt-struct info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
230 const std::string& sopInstanceUid) const;
1890
6ce81914f7e4 added classes BucketAccumulator1D/2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1885
diff changeset
231
1892
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
232 const Vector& GetEstimatedNormal() const
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
233 {
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
234 return estimatedNormal_;
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
235 }
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
236
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
237 const double GetEstimatedSliceThickness() const
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
238 {
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
239 return estimatedSliceThickness_;
cdf91ad891a5 estimated geometry of rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1890
diff changeset
240 }
1945
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
241
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
242 bool LookupStructureName(size_t& structureIndex /* out */,
98952be6fb97 rendering plugin: rendering of multiple structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1909
diff changeset
243 const std::string& name) const;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 }