Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/DicomInstanceParameters.h @ 746:d716bfb3e07c
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 22 May 2019 12:48:57 +0200 |
parents | |
children | 55411e7da2f7 |
comparison
equal
deleted
inserted
replaced
745:c44c1d2d3598 | 746:d716bfb3e07c |
---|---|
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/TextureBaseSceneLayer.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 Data data_; | |
76 | |
77 | |
78 public: | |
79 DicomInstanceParameters(const DicomInstanceParameters& other) : | |
80 data_(other.data_) | |
81 { | |
82 } | |
83 | |
84 DicomInstanceParameters(const Orthanc::DicomMap& dicom) : | |
85 data_(dicom) | |
86 { | |
87 } | |
88 | |
89 void SetOrthancInstanceIdentifier(const std::string& id) | |
90 { | |
91 data_.orthancInstanceId_ = id; | |
92 } | |
93 | |
94 const std::string& GetOrthancInstanceIdentifier() const | |
95 { | |
96 return data_.orthancInstanceId_; | |
97 } | |
98 | |
99 const Orthanc::DicomImageInformation& GetImageInformation() const | |
100 { | |
101 return data_.imageInformation_; | |
102 } | |
103 | |
104 const std::string& GetStudyInstanceUid() const | |
105 { | |
106 return data_.studyInstanceUid_; | |
107 } | |
108 | |
109 const std::string& GetSeriesInstanceUid() const | |
110 { | |
111 return data_.seriesInstanceUid_; | |
112 } | |
113 | |
114 const std::string& GetSopInstanceUid() const | |
115 { | |
116 return data_.sopInstanceUid_; | |
117 } | |
118 | |
119 SopClassUid GetSopClassUid() const | |
120 { | |
121 return data_.sopClassUid_; | |
122 } | |
123 | |
124 double GetThickness() const | |
125 { | |
126 return data_.thickness_; | |
127 } | |
128 | |
129 double GetPixelSpacingX() const | |
130 { | |
131 return data_.pixelSpacingX_; | |
132 } | |
133 | |
134 double GetPixelSpacingY() const | |
135 { | |
136 return data_.pixelSpacingY_; | |
137 } | |
138 | |
139 const CoordinateSystem3D& GetGeometry() const | |
140 { | |
141 return data_.geometry_; | |
142 } | |
143 | |
144 CoordinateSystem3D GetFrameGeometry(unsigned int frame) const | |
145 { | |
146 return data_.GetFrameGeometry(frame); | |
147 } | |
148 | |
149 bool IsPlaneWithinSlice(unsigned int frame, | |
150 const CoordinateSystem3D& plane) const | |
151 { | |
152 return data_.IsPlaneWithinSlice(frame, plane); | |
153 } | |
154 | |
155 bool IsColor() const | |
156 { | |
157 return data_.isColor_; | |
158 } | |
159 | |
160 bool HasRescale() const | |
161 { | |
162 return data_.hasRescale_; | |
163 } | |
164 | |
165 double GetRescaleIntercept() const; | |
166 | |
167 double GetRescaleSlope() const; | |
168 | |
169 bool HasDefaultWindowing() const | |
170 { | |
171 return data_.hasDefaultWindowing_; | |
172 } | |
173 | |
174 float GetDefaultWindowingCenter() const; | |
175 | |
176 float GetDefaultWindowingWidth() const; | |
177 | |
178 Orthanc::PixelFormat GetExpectedPixelFormat() const | |
179 { | |
180 return data_.expectedPixelFormat_; | |
181 } | |
182 | |
183 TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; | |
184 }; | |
185 } |