Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomInstanceParameters.h @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Framework/Toolbox/DicomInstanceParameters.h@30deba7bc8e2 |
children | 85e117739eca |
comparison
equal
deleted
inserted
replaced
1511:9dfeee74c1e6 | 1512:244ad1e4e76a |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
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" | |
25 #include "../Scene2D/LookupTableTextureSceneLayer.h" | |
26 #include "../Toolbox/CoordinateSystem3D.h" | |
27 | |
28 #include <IDynamicObject.h> | |
29 #include <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_; | |
60 bool hasIndexInSeries_; | |
61 unsigned int indexInSeries_; | |
62 std::string doseUnits_; | |
63 double doseGridScaling_; | |
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 | |
74 void ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, | |
75 bool useDouble) const; | |
76 | |
77 double ApplyRescale(double value) const; | |
78 | |
79 bool ComputeRegularSpacing(double& target) const; | |
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 | |
97 DicomInstanceParameters* Clone() const | |
98 { | |
99 return new DicomInstanceParameters(*this); | |
100 } | |
101 | |
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 | |
196 Orthanc::ImageAccessor* ConvertToFloat(const Orthanc::ImageAccessor& pixelData) const; | |
197 | |
198 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; | |
199 | |
200 LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const; | |
201 | |
202 bool HasIndexInSeries() const | |
203 { | |
204 return data_.hasIndexInSeries_; | |
205 } | |
206 | |
207 unsigned int GetIndexInSeries() const; | |
208 | |
209 const std::string& GetDoseUnits() const | |
210 { | |
211 return data_.doseUnits_; | |
212 } | |
213 | |
214 void SetDoseGridScaling(double value) | |
215 { | |
216 data_.doseGridScaling_ = value; | |
217 } | |
218 | |
219 double GetDoseGridScaling() const | |
220 { | |
221 return data_.doseGridScaling_; | |
222 } | |
223 | |
224 double ApplyRescale(double value) const | |
225 { | |
226 return data_.ApplyRescale(value); | |
227 } | |
228 | |
229 // Required for RT-DOSE | |
230 bool ComputeRegularSpacing(double& target) const | |
231 { | |
232 return data_.ComputeRegularSpacing(target); | |
233 } | |
234 }; | |
235 } |