Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/DicomInstanceParameters.h @ 1615:f5d4bd7b5593
new class: OsiriXLayerFactory
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Oct 2020 17:26:44 +0100 |
parents | 8563ea5d8ae4 |
children | a4418a489e86 |
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 | |
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
|
8 * modify it under the terms of the GNU Lesser General Public License |
746 | 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 | |
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
|
14 * 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
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
16 * |
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
|
17 * 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
|
18 * 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
|
19 * <http://www.gnu.org/licenses/>. |
746 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../StoneEnumerations.h" | |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
26 #include "../Scene2D/LookupTableTextureSceneLayer.h" |
746 | 27 #include "../Toolbox/CoordinateSystem3D.h" |
28 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
29 #include <IDynamicObject.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
30 #include <DicomFormat/DicomImageInformation.h> |
746 | 31 |
32 namespace OrthancStone | |
33 { | |
34 class DicomInstanceParameters : | |
35 public Orthanc::IDynamicObject /* to be used as a payload to SlicesSorter */ | |
36 { | |
37 // This class supersedes the deprecated "DicomFrameConverter" | |
38 | |
39 private: | |
40 struct Data // Struct to ease the copy constructor | |
41 { | |
42 std::string orthancInstanceId_; | |
43 std::string studyInstanceUid_; | |
44 std::string seriesInstanceUid_; | |
45 std::string sopInstanceUid_; | |
46 Orthanc::DicomImageInformation imageInformation_; | |
47 SopClassUid sopClassUid_; | |
48 double thickness_; | |
49 double pixelSpacingX_; | |
50 double pixelSpacingY_; | |
51 CoordinateSystem3D geometry_; | |
52 Vector frameOffsets_; | |
53 bool isColor_; | |
54 bool hasRescale_; | |
55 double rescaleIntercept_; | |
56 double rescaleSlope_; | |
57 bool hasDefaultWindowing_; | |
58 float defaultWindowingCenter_; | |
59 float defaultWindowingWidth_; | |
60 Orthanc::PixelFormat expectedPixelFormat_; | |
980
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
61 bool hasIndexInSeries_; |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
62 unsigned int indexInSeries_; |
1091
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
63 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
|
64 double doseGridScaling_; |
746 | 65 |
66 void ComputeDoseOffsets(const Orthanc::DicomMap& dicom); | |
67 | |
1571 | 68 explicit Data(const Orthanc::DicomMap& dicom); |
746 | 69 |
70 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const; | |
71 | |
72 bool IsPlaneWithinSlice(unsigned int frame, | |
73 const CoordinateSystem3D& plane) const; | |
74 | |
1159
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
75 void ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
76 bool useDouble) const; |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
77 |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
78 double ApplyRescale(double value) const; |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
79 |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
80 bool ComputeRegularSpacing(double& target) const; |
746 | 81 }; |
82 | |
83 | |
84 Data data_; | |
85 | |
86 | |
87 public: | |
1571 | 88 explicit DicomInstanceParameters(const DicomInstanceParameters& other) : |
89 data_(other.data_) | |
746 | 90 { |
91 } | |
92 | |
1571 | 93 explicit DicomInstanceParameters(const Orthanc::DicomMap& dicom) : |
746 | 94 data_(dicom) |
95 { | |
96 } | |
97 | |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
98 DicomInstanceParameters* Clone() const |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
99 { |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
100 return new DicomInstanceParameters(*this); |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
101 } |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
102 |
746 | 103 void SetOrthancInstanceIdentifier(const std::string& id) |
104 { | |
105 data_.orthancInstanceId_ = id; | |
106 } | |
107 | |
108 const std::string& GetOrthancInstanceIdentifier() const | |
109 { | |
110 return data_.orthancInstanceId_; | |
111 } | |
112 | |
113 const Orthanc::DicomImageInformation& GetImageInformation() const | |
114 { | |
115 return data_.imageInformation_; | |
116 } | |
117 | |
118 const std::string& GetStudyInstanceUid() const | |
119 { | |
120 return data_.studyInstanceUid_; | |
121 } | |
122 | |
123 const std::string& GetSeriesInstanceUid() const | |
124 { | |
125 return data_.seriesInstanceUid_; | |
126 } | |
127 | |
128 const std::string& GetSopInstanceUid() const | |
129 { | |
130 return data_.sopInstanceUid_; | |
131 } | |
132 | |
133 SopClassUid GetSopClassUid() const | |
134 { | |
135 return data_.sopClassUid_; | |
136 } | |
137 | |
138 double GetThickness() const | |
139 { | |
140 return data_.thickness_; | |
141 } | |
142 | |
143 double GetPixelSpacingX() const | |
144 { | |
145 return data_.pixelSpacingX_; | |
146 } | |
147 | |
148 double GetPixelSpacingY() const | |
149 { | |
150 return data_.pixelSpacingY_; | |
151 } | |
152 | |
153 const CoordinateSystem3D& GetGeometry() const | |
154 { | |
155 return data_.geometry_; | |
156 } | |
157 | |
158 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const | |
159 { | |
160 return data_.GetFrameGeometry(frame); | |
161 } | |
162 | |
163 bool IsPlaneWithinSlice(unsigned int frame, | |
164 const CoordinateSystem3D& plane) const | |
165 { | |
166 return data_.IsPlaneWithinSlice(frame, plane); | |
167 } | |
168 | |
169 bool IsColor() const | |
170 { | |
171 return data_.isColor_; | |
172 } | |
173 | |
174 bool HasRescale() const | |
175 { | |
176 return data_.hasRescale_; | |
177 } | |
178 | |
179 double GetRescaleIntercept() const; | |
180 | |
181 double GetRescaleSlope() const; | |
182 | |
183 bool HasDefaultWindowing() const | |
184 { | |
185 return data_.hasDefaultWindowing_; | |
186 } | |
187 | |
188 float GetDefaultWindowingCenter() const; | |
189 | |
190 float GetDefaultWindowingWidth() const; | |
191 | |
192 Orthanc::PixelFormat GetExpectedPixelFormat() const | |
193 { | |
194 return data_.expectedPixelFormat_; | |
195 } | |
196 | |
1016
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
197 Orthanc::ImageAccessor* ConvertToFloat(const Orthanc::ImageAccessor& pixelData) const; |
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
198 |
746 | 199 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
200 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
201 LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const; |
980
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
202 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
203 bool HasIndexInSeries() const |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
204 { |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
205 return data_.hasIndexInSeries_; |
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 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
208 unsigned int GetIndexInSeries() const; |
1091
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
209 |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
210 const std::string& GetDoseUnits() const |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
211 { |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
212 return data_.doseUnits_; |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
213 } |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
214 |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
215 void SetDoseGridScaling(double value) |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
216 { |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
217 data_.doseGridScaling_ = value; |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
218 } |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
219 |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
220 double GetDoseGridScaling() const |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
221 { |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
222 return data_.doseGridScaling_; |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
223 } |
1159
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
224 |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
225 double ApplyRescale(double value) const |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
226 { |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
227 return data_.ApplyRescale(value); |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
228 } |
1161
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
229 |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
230 // Required for RT-DOSE |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
231 bool ComputeRegularSpacing(double& target) const |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
232 { |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
233 return data_.ComputeRegularSpacing(target); |
19b1c8caade4
fix sagittal geometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1159
diff
changeset
|
234 } |
746 | 235 }; |
236 } |