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 "RTKExport.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  TwoDHomogeneousMatrixType GetProjectionTranslationMatrix(const unsigned int i) const {
194  return this->m_ProjectionTranslationMatrices[i];
195  }
197 
198  const std::vector<ThreeDHomogeneousMatrixType> &GetRotationMatrices() const {
199  return this->m_RotationMatrices;
200  }
201  ThreeDHomogeneousMatrixType GetRotationMatrix(const unsigned int i) const {
202  return this->m_RotationMatrices[i];
203  }
204 
205  const std::vector<ThreeDHomogeneousMatrixType> &GetSourceTranslationMatrices() const {
206  return this->m_SourceTranslationMatrices;
207  }
208  ThreeDHomogeneousMatrixType GetSourceTranslationMatrices(const unsigned int i) const {
209  return this->m_SourceTranslationMatrices[i];
210  }
211 
212  const std::vector<Superclass::MatrixType> &GetMagnificationMatrices() const {
213  return this->m_MagnificationMatrices;
214  }
215  Superclass::MatrixType GetMagnificationMatrices(const unsigned int i) const {
216  return this->m_MagnificationMatrices[i];
217  }
218 
219 
221  const std::vector<double> &GetCollimationUInf() const {
222  return this->m_CollimationUInf;
223  }
224  const std::vector<double> &GetCollimationUSup() const {
225  return this->m_CollimationUSup;
226  }
227  const std::vector<double> &GetCollimationVInf() const {
228  return this->m_CollimationVInf;
229  }
230  const std::vector<double> &GetCollimationVSup() const {
231  return this->m_CollimationVSup;
232  }
234 
237  void SetCollimationOfLastProjection(const double uinf,
238  const double usup,
239  const double vinf,
240  const double vsup);
241 
244  const HomogeneousVectorType GetSourcePosition(const unsigned int i) const;
245 
251  const ThreeDHomogeneousMatrixType GetProjectionCoordinatesToDetectorSystemMatrix(const unsigned int i) const;
252 
258  const ThreeDHomogeneousMatrixType GetProjectionCoordinatesToFixedSystemMatrix(const unsigned int i) const;
259 
261  static double ConvertAngleBetween0And360Degrees(const double a);
262 
264  static double ConvertAngleBetween0And2PIRadians(const double a);
265 
267  static double ConvertAngleBetweenMinusAndPlusPIRadians(const double a);
268 
273  double ToUntiltedCoordinateAtIsocenter(const unsigned int noProj,
274  const double tiltedCoord) const;
275 
278  itkGetConstMacro(RadiusCylindricalDetector, double)
279  itkSetMacro(RadiusCylindricalDetector, double)
280 
281 protected:
283  virtual ~ThreeDCircularProjectionGeometry() ITK_OVERRIDE {}
284 
285  virtual void AddProjectionTranslationMatrix(const TwoDHomogeneousMatrixType &m){
286  this->m_ProjectionTranslationMatrices.push_back(m);
287  this->Modified();
288  }
289  virtual void AddRotationMatrix(const ThreeDHomogeneousMatrixType &m){
290  this->m_RotationMatrices.push_back(m);
291  this->Modified();
292  }
293  virtual void AddSourceTranslationMatrix(const ThreeDHomogeneousMatrixType &m){
294  this->m_SourceTranslationMatrices.push_back(m);
295  this->Modified();
296  }
298  this->m_MagnificationMatrices.push_back(m);
299  this->Modified();
300  }
301 
318  bool VerifyAngles(const double outOfPlaneAngleRAD, const double gantryAngleRAD,
319  const double inPlaneAngleRAD,
320  const Matrix3x3Type &referenceMatrix) const;
322 
341  bool FixAngles(double &outOfPlaneAngleRAD, double &gantryAngleRAD,
342  double &inPlaneAngleRAD,
343  const Matrix3x3Type &referenceMatrix) const;
345 
347  itk::LightObject::Pointer InternalClone() const ITK_OVERRIDE;
348 
351  std::vector<double> m_GantryAngles;
352  std::vector<double> m_OutOfPlaneAngles;
353  std::vector<double> m_InPlaneAngles;
354  std::vector<double> m_SourceAngles;
355  std::vector<double> m_SourceToIsocenterDistances;
356  std::vector<double> m_SourceOffsetsX;
357  std::vector<double> m_SourceOffsetsY;
358  std::vector<double> m_SourceToDetectorDistances;
359  std::vector<double> m_ProjectionOffsetsX;
360  std::vector<double> m_ProjectionOffsetsY;
361 
364 
372  std::vector<double> m_CollimationUInf;
373  std::vector<double> m_CollimationUSup;
374  std::vector<double> m_CollimationVInf;
375  std::vector<double> m_CollimationVSup;
376 
378  std::vector<TwoDHomogeneousMatrixType> m_ProjectionTranslationMatrices;
379  std::vector<Superclass::MatrixType> m_MagnificationMatrices;
380  std::vector<ThreeDHomogeneousMatrixType> m_RotationMatrices;
381  std::vector<ThreeDHomogeneousMatrixType> m_SourceTranslationMatrices;
382 
383 private:
384  ThreeDCircularProjectionGeometry(const Self&); //purposely not implemented
385  void operator=(const Self&); //purposely not implemented
386 };
387 }
388 
389 
390 #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)
ThreeDHomogeneousMatrixType GetRotationMatrix(const unsigned int i) const
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.
ThreeDHomogeneousMatrixType GetSourceTranslationMatrices(const unsigned int i) const
const std::vector< double > & GetCollimationVSup() const
Superclass::MatrixType GetMagnificationMatrices(const unsigned int i) const
const std::vector< double > & GetSourceOffsetsX() const
const std::vector< double > & GetSourceAngles() const
virtual void AddSourceTranslationMatrix(const ThreeDHomogeneousMatrixType &m)
const std::vector< double > & GetCollimationUInf() const
const std::vector< double > & GetSourceOffsetsY() const
TwoDHomogeneousMatrixType GetProjectionTranslationMatrix(const unsigned int i) 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)