ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkImagXGeometryReader.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright RTK Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef rtkImagXGeometryReader_h
20#define rtkImagXGeometryReader_h
21
24
25#include <vector>
26
27namespace rtk
28{
29
40template <typename TInputImage>
41class ITK_TEMPLATE_EXPORT ImagXGeometryReader : public itk::LightProcessObject
42{
43public:
44 ITK_DISALLOW_COPY_AND_MOVE(ImagXGeometryReader);
45
50
53
55 itkOverrideGetNameOfClassMacro(ImagXGeometryReader);
56
58 itkNewMacro(Self);
59
61 itkGetMacro(Geometry, GeometryType::Pointer);
62
64 using InputImageType = TInputImage;
65 using InputImagePointer = typename InputImageType::Pointer;
66 using InputImageRegionType = typename InputImageType::RegionType;
67 using InputImagePixelType = typename InputImageType::PixelType;
68 using FileNamesContainer = std::vector<std::string>;
69
72 itkGetMacro(CalibrationXMLFileName, std::string);
73 itkSetMacro(CalibrationXMLFileName, std::string);
74
76 itkGetMacro(RoomXMLFileName, std::string);
77 itkSetMacro(RoomXMLFileName, std::string);
78
81 void
83 {
84 if (m_ProjectionsFileNames != name)
85 {
87 this->Modified();
88 }
89 }
90 const FileNamesContainer &
92 {
94 }
95
96protected:
98 : m_Geometry(nullptr) {};
99
100 ~ImagXGeometryReader() override = default;
101
102
103private:
104 void
105 GenerateData() override;
106
107 // DICOM tag for AI versions
108 static const std::string m_AI_VERSION_1p2;
109 static const std::string m_AI_VERSION_1p5;
110 static const std::string m_AI_VERSION_2pX;
111
112 // DICOM tags depend on AI version
113 std::string
115
116 // Structure containing the flexmap (for AI versions >= 2.0)
118 {
119 bool isValid{};
120 std::string activeArcName;
121 std::string activeGeocalUID;
122 float sid{}, sdd{}, sourceToNozzleOffsetAngle{};
123 float constantDetectorOffset{}, xMinus{}, xPlus{};
124 bool isCW{};
125 std::vector<float> anglesDeg; // Gantry angles [deg]
126 std::vector<float> Px, Py, Pz, // Detector translations
127 Rx, Ry, Rz, // Detector rotations
128 Tx, Ty, Tz; // Source translations
129 };
130
133
135 {
136 int id0, id1; // indices of angles just below and above the target angle
137 float a0, a1; // weights (1/distance) to angles below and above
138 };
139
141 interpolate(const std::vector<float> & flexAngles, bool bIsCW, float angleDegree);
142
143 // Structure containing the calibration models (for AI versions < 2.0)
145 {
146 bool isValid{};
147 float sid{}, sdd{}, sourceToNozzleOffsetAngle;
148 std::vector<float> Px, Py, Pz, // Detector translations model
149 Rx, Ry, Rz, // Detector rotations model
150 Tx, Ty, Tz; // Source translations model
151
153 {
155 Px = std::vector<float>(5, 0.F);
156 Py = std::vector<float>(5, 0.F);
157 Pz = std::vector<float>(5, 0.F);
158 Rx = std::vector<float>(5, 0.F);
159 Ry = std::vector<float>(5, 0.F);
160 Rz = std::vector<float>(5, 0.F);
161 Tx = std::vector<float>(5, 0.F);
162 Ty = std::vector<float>(5, 0.F);
163 Tz = std::vector<float>(5, 0.F);
164 }
165 };
166
167 CalibrationModelType
169
172
173 bool
174 isCW(const std::vector<float> & angles);
175
176 std::vector<float>
178 const std::vector<float> & Dx,
179 const std::vector<float> & Dy,
180 const std::vector<float> & Dz);
181
182 // Evaluate the calibration models for a given angle
183 std::vector<float>
184 getDeformations(float gantryAngle,
185 const std::vector<float> & Dx,
186 const std::vector<float> & Dy,
187 const std::vector<float> & Dz);
188
189 void
190 addEntryToGeometry(float gantryAngleDegree,
191 float nozzleToRadAngleOffset,
192 float sid,
193 float sdd,
194 std::vector<float> & detTrans,
195 std::vector<float> & detRot,
196 std::vector<float> & srcTrans);
197
198 void
199 addEntryToGeometry(const FlexmapType & f, float gantryAngle);
200
201 void
202 addEntryToGeometry(const CalibrationModelType & c, float gantryAngle);
203
206 std::string m_RoomXMLFileName;
208};
209
210} // namespace rtk
211#ifndef ITK_MANUAL_INSTANTIATION
212# include "rtkImagXGeometryReader.hxx"
213#endif
214
215#endif // rtkImagXGeometryReader_h
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
virtual void Modified() const
Implements transparent reference counting.
ThreeDCircularProjectionGeometry GeometryType
std::vector< std::string > FileNamesContainer
~ImagXGeometryReader() override=default
void addEntryToGeometry(const FlexmapType &f, float gantryAngle)
typename InputImageType::RegionType InputImageRegionType
const FileNamesContainer & GetProjectionsFileNames() const
bool isCW(const std::vector< float > &angles)
CalibrationModelType GetGeometryForAI1p5FromXMLFiles()
FlexmapType GetGeometryForAI2p1()
typename InputImageType::Pointer InputImagePointer
static const std::string m_AI_VERSION_2pX
itk::SmartPointer< Self > Pointer
CalibrationModelType GetGeometryForAI1p5()
InterpResultType interpolate(const std::vector< float > &flexAngles, bool bIsCW, float angleDegree)
void addEntryToGeometry(float gantryAngleDegree, float nozzleToRadAngleOffset, float sid, float sdd, std::vector< float > &detTrans, std::vector< float > &detRot, std::vector< float > &srcTrans)
std::vector< float > getInterpolatedValue(const InterpResultType &ires, const std::vector< float > &Dx, const std::vector< float > &Dy, const std::vector< float > &Dz)
void addEntryToGeometry(const CalibrationModelType &c, float gantryAngle)
FileNamesContainer m_ProjectionsFileNames
static const std::string m_AI_VERSION_1p5
std::vector< float > getDeformations(float gantryAngle, const std::vector< float > &Dx, const std::vector< float > &Dy, const std::vector< float > &Dz)
typename InputImageType::PixelType InputImagePixelType
GeometryType::Pointer m_Geometry
static const std::string m_AI_VERSION_1p2
itk::LightProcessObject Superclass
void SetProjectionsFileNames(const FileNamesContainer &name)
void GenerateData() override
std::string getAIversion()
Projection geometry for a source and a 2-D flat panel.
#define itkSetMacro(name, type)