Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/DicomInstanceParameters.h @ 1159:acb399643945 broker
DicomInstanceParameters::ApplyRescale()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 18 Nov 2019 15:24:36 +0100 |
parents | 7681f3943748 |
children | 19b1c8caade4 |
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 | |
5 * Copyright (C) 2017-2019 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" | |
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; |
746 | 78 }; |
79 | |
80 | |
81 Data data_; | |
82 | |
83 | |
84 public: | |
85 DicomInstanceParameters(const DicomInstanceParameters& other) : | |
86 data_(other.data_) | |
87 { | |
88 } | |
89 | |
90 DicomInstanceParameters(const Orthanc::DicomMap& dicom) : | |
91 data_(dicom) | |
92 { | |
93 } | |
94 | |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
95 DicomInstanceParameters* Clone() const |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
96 { |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
97 return new DicomInstanceParameters(*this); |
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 |
746 | 100 void SetOrthancInstanceIdentifier(const std::string& id) |
101 { | |
102 data_.orthancInstanceId_ = id; | |
103 } | |
104 | |
105 const std::string& GetOrthancInstanceIdentifier() const | |
106 { | |
107 return data_.orthancInstanceId_; | |
108 } | |
109 | |
110 const Orthanc::DicomImageInformation& GetImageInformation() const | |
111 { | |
112 return data_.imageInformation_; | |
113 } | |
114 | |
115 const std::string& GetStudyInstanceUid() const | |
116 { | |
117 return data_.studyInstanceUid_; | |
118 } | |
119 | |
120 const std::string& GetSeriesInstanceUid() const | |
121 { | |
122 return data_.seriesInstanceUid_; | |
123 } | |
124 | |
125 const std::string& GetSopInstanceUid() const | |
126 { | |
127 return data_.sopInstanceUid_; | |
128 } | |
129 | |
130 SopClassUid GetSopClassUid() const | |
131 { | |
132 return data_.sopClassUid_; | |
133 } | |
134 | |
135 double GetThickness() const | |
136 { | |
137 return data_.thickness_; | |
138 } | |
139 | |
140 double GetPixelSpacingX() const | |
141 { | |
142 return data_.pixelSpacingX_; | |
143 } | |
144 | |
145 double GetPixelSpacingY() const | |
146 { | |
147 return data_.pixelSpacingY_; | |
148 } | |
149 | |
150 const CoordinateSystem3D& GetGeometry() const | |
151 { | |
152 return data_.geometry_; | |
153 } | |
154 | |
155 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const | |
156 { | |
157 return data_.GetFrameGeometry(frame); | |
158 } | |
159 | |
160 bool IsPlaneWithinSlice(unsigned int frame, | |
161 const CoordinateSystem3D& plane) const | |
162 { | |
163 return data_.IsPlaneWithinSlice(frame, plane); | |
164 } | |
165 | |
166 bool IsColor() const | |
167 { | |
168 return data_.isColor_; | |
169 } | |
170 | |
171 bool HasRescale() const | |
172 { | |
173 return data_.hasRescale_; | |
174 } | |
175 | |
176 double GetRescaleIntercept() const; | |
177 | |
178 double GetRescaleSlope() const; | |
179 | |
180 bool HasDefaultWindowing() const | |
181 { | |
182 return data_.hasDefaultWindowing_; | |
183 } | |
184 | |
185 float GetDefaultWindowingCenter() const; | |
186 | |
187 float GetDefaultWindowingWidth() const; | |
188 | |
189 Orthanc::PixelFormat GetExpectedPixelFormat() const | |
190 { | |
191 return data_.expectedPixelFormat_; | |
192 } | |
193 | |
1016
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
194 Orthanc::ImageAccessor* ConvertToFloat(const Orthanc::ImageAccessor& pixelData) const; |
78a516d5ead5
making DicomInstanceParameters::ConvertToFloat() public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
195 |
746 | 196 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
197 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
746
diff
changeset
|
198 LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const; |
980
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
199 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
200 bool HasIndexInSeries() const |
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 return data_.hasIndexInSeries_; |
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 |
8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
205 unsigned int GetIndexInSeries() const; |
1091
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
206 |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
207 const std::string& GetDoseUnits() const |
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 return data_.doseUnits_; |
5a18e6a395bc
Added DoseUnit tag retrieval to DicomInstanceParameters
Benjamin Golinvaux <bgo@osimis.io>
parents:
1016
diff
changeset
|
210 } |
1141
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
211 |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
212 double GetDoseGridScaling() const |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
213 { |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
214 return data_.doseGridScaling_; |
7681f3943748
Changed handling of DoseGridScaling: before this commit, rescaleSlope was set to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1091
diff
changeset
|
215 } |
1159
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
216 |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
217 double ApplyRescale(double value) const |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
218 { |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
219 return data_.ApplyRescale(value); |
acb399643945
DicomInstanceParameters::ApplyRescale()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1141
diff
changeset
|
220 } |
746 | 221 }; |
222 } |