Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/DicomInstanceParameters.h @ 1353:af65bce18951 broker
Dummy commented debug block
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 15 Apr 2020 12:58:14 +0200 |
parents | 7ec8fea061b9 |
children | 30deba7bc8e2 |
rev | line source |
---|---|
746 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
746 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../StoneEnumerations.h" | |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
25 #include "../Scene2D/LookupTableTextureSceneLayer.h" |
746 | 26 #include "../Toolbox/CoordinateSystem3D.h" |
27 | |
28 #include <Core/IDynamicObject.h> | |
29 #include <Core/DicomFormat/DicomImageInformation.h> | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 class DicomInstanceParameters : | |
34 public Orthanc::IDynamicObject /* to be used as a payload to SlicesSorter */ | |
35 { | |
36 // This class supersedes the deprecated "DicomFrameConverter" | |
37 | |
38 private: | |
39 struct Data // Struct to ease the copy constructor | |
40 { | |
41 std::string orthancInstanceId_; | |
42 std::string studyInstanceUid_; | |
43 std::string seriesInstanceUid_; | |
44 std::string sopInstanceUid_; | |
45 Orthanc::DicomImageInformation imageInformation_; | |
46 SopClassUid sopClassUid_; | |
47 double thickness_; | |
48 double pixelSpacingX_; | |
49 double pixelSpacingY_; | |
50 CoordinateSystem3D geometry_; | |
51 Vector frameOffsets_; | |
52 bool isColor_; | |
53 bool hasRescale_; | |
54 double rescaleIntercept_; | |
55 double rescaleSlope_; | |
56 bool hasDefaultWindowing_; | |
57 float defaultWindowingCenter_; | |
58 float defaultWindowingWidth_; | |
59 Orthanc::PixelFormat expectedPixelFormat_; | |
980
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
60 bool hasIndexInSeries_; |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
61 unsigned int indexInSeries_; |
1091
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
62 std::string doseUnits_; |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
63 double doseGridScaling_; |
746 | 64 |
65 void ComputeDoseOffsets(const Orthanc::DicomMap& dicom); | |
66 | |
67 Data(const Orthanc::DicomMap& dicom); | |
68 | |
69 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const; | |
70 | |
71 bool IsPlaneWithinSlice(unsigned int frame, | |
72 const CoordinateSystem3D& plane) const; | |
73 | |
1159
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
74 void ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
75 bool useDouble) const; |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
76 |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
77 double ApplyRescale(double value) const; |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
78 |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
79 bool ComputeRegularSpacing(double& target) const; |
746 | 80 }; |
81 | |
82 | |
83 Data data_; | |
84 | |
85 | |
86 public: | |
87 DicomInstanceParameters(const DicomInstanceParameters& other) : | |
88 data_(other.data_) | |
89 { | |
90 } | |
91 | |
92 DicomInstanceParameters(const Orthanc::DicomMap& dicom) : | |
93 data_(dicom) | |
94 { | |
95 } | |
96 | |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
97 DicomInstanceParameters* Clone() const |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
98 { |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
99 return new DicomInstanceParameters(*this); |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
100 } |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
101 |
746 | 102 void SetOrthancInstanceIdentifier(const std::string& id) |
103 { | |
104 data_.orthancInstanceId_ = id; | |
105 } | |
106 | |
107 const std::string& GetOrthancInstanceIdentifier() const | |
108 { | |
109 return data_.orthancInstanceId_; | |
110 } | |
111 | |
112 const Orthanc::DicomImageInformation& GetImageInformation() const | |
113 { | |
114 return data_.imageInformation_; | |
115 } | |
116 | |
117 const std::string& GetStudyInstanceUid() const | |
118 { | |
119 return data_.studyInstanceUid_; | |
120 } | |
121 | |
122 const std::string& GetSeriesInstanceUid() const | |
123 { | |
124 return data_.seriesInstanceUid_; | |
125 } | |
126 | |
127 const std::string& GetSopInstanceUid() const | |
128 { | |
129 return data_.sopInstanceUid_; | |
130 } | |
131 | |
132 SopClassUid GetSopClassUid() const | |
133 { | |
134 return data_.sopClassUid_; | |
135 } | |
136 | |
137 double GetThickness() const | |
138 { | |
139 return data_.thickness_; | |
140 } | |
141 | |
142 double GetPixelSpacingX() const | |
143 { | |
144 return data_.pixelSpacingX_; | |
145 } | |
146 | |
147 double GetPixelSpacingY() const | |
148 { | |
149 return data_.pixelSpacingY_; | |
150 } | |
151 | |
152 const CoordinateSystem3D& GetGeometry() const | |
153 { | |
154 return data_.geometry_; | |
155 } | |
156 | |
157 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const | |
158 { | |
159 return data_.GetFrameGeometry(frame); | |
160 } | |
161 | |
162 bool IsPlaneWithinSlice(unsigned int frame, | |
163 const CoordinateSystem3D& plane) const | |
164 { | |
165 return data_.IsPlaneWithinSlice(frame, plane); | |
166 } | |
167 | |
168 bool IsColor() const | |
169 { | |
170 return data_.isColor_; | |
171 } | |
172 | |
173 bool HasRescale() const | |
174 { | |
175 return data_.hasRescale_; | |
176 } | |
177 | |
178 double GetRescaleIntercept() const; | |
179 | |
180 double GetRescaleSlope() const; | |
181 | |
182 bool HasDefaultWindowing() const | |
183 { | |
184 return data_.hasDefaultWindowing_; | |
185 } | |
186 | |
187 float GetDefaultWindowingCenter() const; | |
188 | |
189 float GetDefaultWindowingWidth() const; | |
190 | |
191 Orthanc::PixelFormat GetExpectedPixelFormat() const | |
192 { | |
193 return data_.expectedPixelFormat_; | |
194 } | |
195 | |
1016
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
196 Orthanc::ImageAccessor* ConvertToFloat(const Orthanc::ImageAccessor& pixelData) const; |
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
197 |
746 | 198 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
199 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
200 LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const; |
980
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
201 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
202 bool HasIndexInSeries() const |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
203 { |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
204 return data_.hasIndexInSeries_; |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
205 } |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
206 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
207 unsigned int GetIndexInSeries() const; |
1091
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
208 |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
209 const std::string& GetDoseUnits() const |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
210 { |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
211 return data_.doseUnits_; |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
212 } |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
213 |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
214 void SetDoseGridScaling(double value) |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
215 { |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
216 data_.doseGridScaling_ = value; |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
217 } |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
218 |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
219 double GetDoseGridScaling() const |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
220 { |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
221 return data_.doseGridScaling_; |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
222 } |
1159
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
223 |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
224 double ApplyRescale(double value) const |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
225 { |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
226 return data_.ApplyRescale(value); |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
227 } |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
228 |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
229 // Required for RT-DOSE |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
230 bool ComputeRegularSpacing(double& target) const |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
231 { |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
232 return data_.ComputeRegularSpacing(target); |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
233 } |
746 | 234 }; |
235 } |