ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkRigid3DPerspectiveTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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 #ifndef __itkRigid3DPerspectiveTransform_h
19 #define __itkRigid3DPerspectiveTransform_h
20 
21 #include "itkMacro.h"
22 #include "vnl/vnl_quaternion.h"
23 #include <iostream>
24 #include "itkTransform.h"
25 #include "itkVersor.h"
26 
27 namespace itk
28 {
37 template <
38  class TScalarType = double>
39 // Data type for scalars (float or double)
40 class ITK_EXPORT Rigid3DPerspectiveTransform :
41  public Transform<TScalarType, 3, 2>
42 {
43 public:
45  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
46  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
48 
50  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
51  itkStaticConstMacro(ParametersDimension, unsigned int, 6);
53 
56  typedef Transform<TScalarType,
57  itkGetStaticConstMacro(InputSpaceDimension),
58  itkGetStaticConstMacro(OutputSpaceDimension)> Superclass;
60 
63 
66 
68  itkNewMacro(Self);
69 
71  typedef typename Superclass::ScalarType ScalarType;
72 
74  typedef typename Superclass::ParametersType ParametersType;
75  typedef typename ParametersType::ValueType ParameterValueType;
76 
78  typedef typename Superclass::JacobianType JacobianType;
79 
81  typedef Matrix<TScalarType, itkGetStaticConstMacro(InputSpaceDimension),
82  itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
83 
87 
92 
94  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
95  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
96 
101 
103  typedef vnl_quaternion<TScalarType> VnlQuaternionType;
104 
106  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
107  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
108 
114 
118  const OffsetType & GetOffset() const
119  {
120  return m_Offset;
121  }
122 
126  const VersorType & GetRotation() const
127  {
128  return m_Versor;
129  }
130 
135  void SetParameters(const ParametersType & parameters);
136 
137  const ParametersType & GetParameters() const;
138 
142  virtual void SetFixedParameters(const ParametersType &)
143  {
144  }
145 
148  void SetOffset(const OffsetType & offset)
149  {
150  m_Offset = offset; return;
151  }
152 
155  void SetRotation(const VersorType & rotation);
156 
161  void SetRotation(const Vector<TScalarType, 3> & axis, double angle);
162 
166  void SetFocalDistance(TScalarType focalDistance)
167  {
168  m_FocalDistance = focalDistance;
169  }
170 
172  double GetFocalDistance(void) const
173  {
174  return m_FocalDistance;
175  }
176 
180  OutputPointType TransformPoint(const InputPointType & point) const;
181 
183  using Superclass::TransformVector;
184 
185  virtual OutputVectorType TransformVector(const InputVectorType &) const
186  {
187  itkExceptionMacro(
188  << "TransformVector(const InputVectorType &) is not implemented for Rigid3DPerspectiveTransform");
189  }
190 
191  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
192  {
193  itkExceptionMacro(
194  << "TransformVector(const InputVnlVectorType &) is not implemented for Rigid3DPerspectiveTransform");
195  }
196 
197  using Superclass::TransformCovariantVector;
198 
199  virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
200  {
201  itkExceptionMacro(
202  <<
203  "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for Rigid3DPerspectiveTransform");
204  }
205 
207  const MatrixType & GetRotationMatrix() const
208  {
209  return m_RotationMatrix;
210  }
211 
213  void ComputeMatrix(void);
214 
217  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const;
218 
219  virtual void ComputeJacobianWithRespectToPosition(const InputPointType &,
220  JacobianType &) const
221  {
222  itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented "
223  "for " << this->GetNameOfClass() );
224  }
225 
227  itkGetConstReferenceMacro(FixedOffset, OffsetType);
228  itkSetMacro(FixedOffset, OffsetType);
230 
232  itkSetMacro(CenterOfRotation, InputPointType);
233  itkGetConstReferenceMacro(CenterOfRotation, InputPointType);
235 
236 protected:
239  void PrintSelf(std::ostream & os, Indent indent) const;
240 
241 private:
242  Rigid3DPerspectiveTransform(const Self &); // purposely not implemented
243  void operator=(const Self &); // purposely not implemented
244 
247 
250 
252  TScalarType m_FocalDistance;
253 
256 
259 
262 }; // class Rigid3DPerspectiveTransform:
263 } // namespace itk
264 
265 #ifndef ITK_MANUAL_INSTANTIATION
266 #include "itkRigid3DPerspectiveTransform.hxx"
267 #endif
268 
269 #endif /* __itkRigid3DPerspectiveTransform_h */
270