comparison Framework/Toolbox/DicomInstanceParameters.h @ 860:238693c3bc51 am-dev

merge default -> am-dev
author Alain Mazy <alain@mazy.be>
date Mon, 24 Jun 2019 14:35:00 +0200
parents b24c208fa953
children 8e497a4e3d96
comparison
equal deleted inserted replaced
856:a6e17a5a39e7 860:238693c3bc51
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"
25 #include "../Scene2D/LookupTableTextureSceneLayer.h"
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_;
60
61 void ComputeDoseOffsets(const Orthanc::DicomMap& dicom);
62
63 Data(const Orthanc::DicomMap& dicom);
64
65 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const;
66
67 bool IsPlaneWithinSlice(unsigned int frame,
68 const CoordinateSystem3D& plane) const;
69
70 void ApplyRescale(Orthanc::ImageAccessor& image,
71 bool useDouble) const;
72 };
73
74
75 Orthanc::ImageAccessor* ConvertToFloat(const Orthanc::ImageAccessor& pixelData) const;
76
77
78 Data data_;
79
80
81 public:
82 DicomInstanceParameters(const DicomInstanceParameters& other) :
83 data_(other.data_)
84 {
85 }
86
87 DicomInstanceParameters(const Orthanc::DicomMap& dicom) :
88 data_(dicom)
89 {
90 }
91
92 DicomInstanceParameters* Clone() const
93 {
94 return new DicomInstanceParameters(*this);
95 }
96
97 void SetOrthancInstanceIdentifier(const std::string& id)
98 {
99 data_.orthancInstanceId_ = id;
100 }
101
102 const std::string& GetOrthancInstanceIdentifier() const
103 {
104 return data_.orthancInstanceId_;
105 }
106
107 const Orthanc::DicomImageInformation& GetImageInformation() const
108 {
109 return data_.imageInformation_;
110 }
111
112 const std::string& GetStudyInstanceUid() const
113 {
114 return data_.studyInstanceUid_;
115 }
116
117 const std::string& GetSeriesInstanceUid() const
118 {
119 return data_.seriesInstanceUid_;
120 }
121
122 const std::string& GetSopInstanceUid() const
123 {
124 return data_.sopInstanceUid_;
125 }
126
127 SopClassUid GetSopClassUid() const
128 {
129 return data_.sopClassUid_;
130 }
131
132 double GetThickness() const
133 {
134 return data_.thickness_;
135 }
136
137 double GetPixelSpacingX() const
138 {
139 return data_.pixelSpacingX_;
140 }
141
142 double GetPixelSpacingY() const
143 {
144 return data_.pixelSpacingY_;
145 }
146
147 const CoordinateSystem3D& GetGeometry() const
148 {
149 return data_.geometry_;
150 }
151
152 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const
153 {
154 return data_.GetFrameGeometry(frame);
155 }
156
157 bool IsPlaneWithinSlice(unsigned int frame,
158 const CoordinateSystem3D& plane) const
159 {
160 return data_.IsPlaneWithinSlice(frame, plane);
161 }
162
163 bool IsColor() const
164 {
165 return data_.isColor_;
166 }
167
168 bool HasRescale() const
169 {
170 return data_.hasRescale_;
171 }
172
173 double GetRescaleIntercept() const;
174
175 double GetRescaleSlope() const;
176
177 bool HasDefaultWindowing() const
178 {
179 return data_.hasDefaultWindowing_;
180 }
181
182 float GetDefaultWindowingCenter() const;
183
184 float GetDefaultWindowingWidth() const;
185
186 Orthanc::PixelFormat GetExpectedPixelFormat() const
187 {
188 return data_.expectedPixelFormat_;
189 }
190
191 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const;
192
193 LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const;
194 };
195 }