RTK  1.4.0
Reconstruction Toolkit
rtkThreeDCircularProjectionGeometry.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  * http://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 rtkThreeDCircularProjectionGeometry_h
20 #define rtkThreeDCircularProjectionGeometry_h
21 
22 #include "rtkWin32Header.h"
23 #include "rtkProjectionGeometry.h"
24 
25 namespace rtk
26 {
51 {
52 public:
57 
65 
67  itkNewMacro( Self );
68 
73  void AddProjection(const double sid, const double sdd, const double gantryAngle,
74  const double projOffsetX=0., const double projOffsetY=0.,
75  const double outOfPlaneAngle=0., const double inPlaneAngle=0.,
76  const double sourceOffsetX=0., const double sourceOffsetY=0.);
77 
79  virtual void AddProjectionInRadians(const double sid, const double sdd, const double gantryAngle,
80  const double projOffsetX=0., const double projOffsetY=0.,
81  const double outOfPlaneAngle=0., const double inPlaneAngle=0.,
82  const double sourceOffsetX=0., const double sourceOffsetY=0.);
83 
94  bool AddProjection(const PointType &sourcePosition,
95  const PointType &detectorPosition,
96  const VectorType &detectorRowVector,
97  const VectorType &detectorColumnVector);
98 
99 
104  bool AddProjection(const HomogeneousProjectionMatrixType &pMat);
105 
107  void Clear() ITK_OVERRIDE;
108 
111  const std::vector<double> &GetGantryAngles() const {
112  return this->m_GantryAngles;
113  }
114  const std::vector<double> &GetOutOfPlaneAngles() const {
115  return this->m_OutOfPlaneAngles;
116  }
117  const std::vector<double> &GetInPlaneAngles() const {
118  return this->m_InPlaneAngles;
119  }
120  const std::vector<double> &GetSourceToIsocenterDistances() const {
121  return this->m_SourceToIsocenterDistances;
122  }
123  const std::vector<double> &GetSourceOffsetsX() const {
124  return this->m_SourceOffsetsX;
125  }
126  const std::vector<double> &GetSourceOffsetsY() const {
127  return this->m_SourceOffsetsY;
128  }
129  const std::vector<double> &GetSourceToDetectorDistances() const {
130  return this->m_SourceToDetectorDistances;
131  }
132  const std::vector<double> &GetProjectionOffsetsX() const {
133  return this->m_ProjectionOffsetsX;
134  }
135  const std::vector<double> &GetProjectionOffsetsY() const {
136  return this->m_ProjectionOffsetsY;
137  }
139 
143  const std::vector<double> &GetSourceAngles() const {
144  return this->m_SourceAngles;
145  }
146 
149  const std::vector<double> GetTiltAngles();
150 
153  const std::multimap<double,unsigned int> GetSortedAngles(const std::vector<double> &angles) const;
154 
157  const std::map<double,unsigned int> GetUniqueSortedAngles(const std::vector<double> &angles) const;
158 
160  const std::vector<double> GetAngularGapsWithNext(const std::vector<double> &angles) const;
161 
164  const std::vector<double> GetAngularGaps(const std::vector<double> &angles);
165 
168  static ThreeDHomogeneousMatrixType
169  ComputeRotationHomogeneousMatrix(double angleX,
170  double angleY,
171  double angleZ);
172 
174  static TwoDHomogeneousMatrixType
175  ComputeTranslationHomogeneousMatrix(double transX,
176  double transY);
177  static ThreeDHomogeneousMatrixType
178  ComputeTranslationHomogeneousMatrix(double transX,
179  double transY,
180  double transZ);
182 
185  static Superclass::MatrixType ComputeProjectionMagnificationMatrix(double sdd,
186  double sid);
187 
190  const std::vector<TwoDHomogeneousMatrixType> &GetProjectionTranslationMatrices() const {
191  return this->m_ProjectionTranslationMatrices;
192  }
193  const std::vector<ThreeDHomogeneousMatrixType> &GetRotationMatrices() const {
194  return this->m_RotationMatrices;
195  }
196  const std::vector<ThreeDHomogeneousMatrixType> &GetSourceTranslationMatrices() const {
197  return this->m_SourceTranslationMatrices;
198  }
199  const std::vector<Superclass::MatrixType> &GetMagnificationMatrices() const {
200  return this->m_MagnificationMatrices;
201  }
203 
205  const std::vector<double> &GetCollimationUInf() const {
206  return this->m_CollimationUInf;
207  }
208  const std::vector<double> &GetCollimationUSup() const {
209  return this->m_CollimationUSup;
210  }
211  const std::vector<double> &GetCollimationVInf() const {
212  return this->m_CollimationVInf;
213  }
214  const std::vector<double> &GetCollimationVSup() const {
215  return this->m_CollimationVSup;
216  }
218 
221  void SetCollimationOfLastProjection(const double uinf,
222  const double usup,
223  const double vinf,
224  const double vsup);
225 
228  const HomogeneousVectorType GetSourcePosition(const unsigned int i) const;
229 
235  const ThreeDHomogeneousMatrixType GetProjectionCoordinatesToDetectorSystemMatrix(const unsigned int i) const;
236 
242  const ThreeDHomogeneousMatrixType GetProjectionCoordinatesToFixedSystemMatrix(const unsigned int i) const;
243 
245  static double ConvertAngleBetween0And360Degrees(const double a);
246 
248  static double ConvertAngleBetween0And2PIRadians(const double a);
249 
251  static double ConvertAngleBetweenMinusAndPlusPIRadians(const double a);
252 
257  double ToUntiltedCoordinateAtIsocenter(const unsigned int noProj,
258  const double tiltedCoord) const;
259 
262  itkGetConstMacro(RadiusCylindricalDetector, double)
263  itkSetMacro(RadiusCylindricalDetector, double)
264 
265 protected:
267  virtual ~ThreeDCircularProjectionGeometry() ITK_OVERRIDE {}
268 
269  virtual void AddProjectionTranslationMatrix(const TwoDHomogeneousMatrixType &m){
270  this->m_ProjectionTranslationMatrices.push_back(m);
271  this->Modified();
272  }
273  virtual void AddRotationMatrix(const ThreeDHomogeneousMatrixType &m){
274  this->m_RotationMatrices.push_back(m);
275  this->Modified();
276  }
277  virtual void AddSourceTranslationMatrix(const ThreeDHomogeneousMatrixType &m){
278  this->m_SourceTranslationMatrices.push_back(m);
279  this->Modified();
280  }
282  this->m_MagnificationMatrices.push_back(m);
283  this->Modified();
284  }
285 
302  bool VerifyAngles(const double outOfPlaneAngleRAD, const double gantryAngleRAD,
303  const double inPlaneAngleRAD,
304  const Matrix3x3Type &referenceMatrix) const;
306 
325  bool FixAngles(double &outOfPlaneAngleRAD, double &gantryAngleRAD,
326  double &inPlaneAngleRAD,
327  const Matrix3x3Type &referenceMatrix) const;
329 
331  itk::LightObject::Pointer InternalClone() const ITK_OVERRIDE;
332 
335  std::vector<double> m_GantryAngles;
336  std::vector<double> m_OutOfPlaneAngles;
337  std::vector<double> m_InPlaneAngles;
338  std::vector<double> m_SourceAngles;
339  std::vector<double> m_SourceToIsocenterDistances;
340  std::vector<double> m_SourceOffsetsX;
341  std::vector<double> m_SourceOffsetsY;
342  std::vector<double> m_SourceToDetectorDistances;
343  std::vector<double> m_ProjectionOffsetsX;
344  std::vector<double> m_ProjectionOffsetsY;
345 
348 
356  std::vector<double> m_CollimationUInf;
357  std::vector<double> m_CollimationUSup;
358  std::vector<double> m_CollimationVInf;
359  std::vector<double> m_CollimationVSup;
360 
362  std::vector<TwoDHomogeneousMatrixType> m_ProjectionTranslationMatrices;
363  std::vector<Superclass::MatrixType> m_MagnificationMatrices;
364  std::vector<ThreeDHomogeneousMatrixType> m_RotationMatrices;
365  std::vector<ThreeDHomogeneousMatrixType> m_SourceTranslationMatrices;
366 
367 private:
368  ThreeDCircularProjectionGeometry(const Self&); //purposely not implemented
369  void operator=(const Self&); //purposely not implemented
370 };
371 }
372 
373 
374 #endif // __rtkThreeDCircularProjectionGeometry_h
const std::vector< double > & GetOutOfPlaneAngles() const
const std::vector< double > & GetCollimationUSup() const
const std::vector< double > & GetCollimationVInf() const
std::vector< ThreeDHomogeneousMatrixType > m_SourceTranslationMatrices
const std::vector< double > & GetSourceToDetectorDistances() const
virtual void AddProjectionTranslationMatrix(const TwoDHomogeneousMatrixType &m)
const std::vector< Superclass::MatrixType > & GetMagnificationMatrices() const
const std::vector< double > & GetSourceToIsocenterDistances() const
STL namespace.
std::vector< ThreeDHomogeneousMatrixType > m_RotationMatrices
virtual void AddMagnificationMatrix(const Superclass::MatrixType &m)
const std::vector< TwoDHomogeneousMatrixType > & GetProjectionTranslationMatrices() const
Projection geometry for a source and a 2-D flat panel.
virtual void AddRotationMatrix(const ThreeDHomogeneousMatrixType &m)
A templated class holding a vector of M x (M+1) matrices.
const std::vector< double > & GetCollimationVSup() const
const std::vector< double > & GetSourceOffsetsX() const
const std::vector< double > & GetSourceAngles() const
#define RTK_EXPORT
virtual void AddSourceTranslationMatrix(const ThreeDHomogeneousMatrixType &m)
const std::vector< double > & GetCollimationUInf() const
const std::vector< double > & GetSourceOffsetsY() const
const std::vector< double > & GetProjectionOffsetsX() const
std::vector< TwoDHomogeneousMatrixType > m_ProjectionTranslationMatrices
const std::vector< ThreeDHomogeneousMatrixType > & GetRotationMatrices() const
const std::vector< ThreeDHomogeneousMatrixType > & GetSourceTranslationMatrices() const
const std::vector< double > & GetInPlaneAngles() const
std::vector< Superclass::MatrixType > m_MagnificationMatrices
const std::vector< double > & GetProjectionOffsetsY() const
#define itkSetMacro(name, type)