ITK  4.9.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<typename TParametersValueType=double>
39  public Transform<TParametersValueType, 3, 2>
40 {
41 public:
43  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
44  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
46 
48  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
49  itkStaticConstMacro(ParametersDimension, unsigned int, 6);
51 
54  typedef Transform<TParametersValueType,
55  itkGetStaticConstMacro(InputSpaceDimension),
56  itkGetStaticConstMacro(OutputSpaceDimension)> Superclass;
58 
61 
64 
66  itkNewMacro(Self);
67 
69  typedef typename Superclass::ScalarType ScalarType;
70 
73  typedef typename FixedParametersType::ValueType FixedParametersValueType;
75  typedef typename ParametersType::ValueType ParametersValueType;
76 
79 
81  typedef Matrix<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension),
82  itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
83 
87 
92 
96 
101 
103  typedef vnl_quaternion<TParametersValueType> VnlQuaternionType;
104 
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) ITK_OVERRIDE;
136 
137  const ParametersType & GetParameters() const ITK_OVERRIDE;
138 
142  virtual void SetFixedParameters(const FixedParametersType &) ITK_OVERRIDE
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<TParametersValueType, 3> & axis, double angle);
162 
166  void SetFocalDistance(TParametersValueType 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 ITK_OVERRIDE;
181 
184 
185  virtual OutputVectorType TransformVector(const InputVectorType &) const ITK_OVERRIDE
186  {
187  itkExceptionMacro(
188  << "TransformVector(const InputVectorType &) is not implemented for Rigid3DPerspectiveTransform");
189  }
190 
191  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const ITK_OVERRIDE
192  {
193  itkExceptionMacro(
194  << "TransformVector(const InputVnlVectorType &) is not implemented for Rigid3DPerspectiveTransform");
195  }
196 
198 
200  {
201  itkExceptionMacro(
202  <<
203  "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for Rigid3DPerspectiveTransform");
204  }
205 
208  {
209  return m_RotationMatrix;
210  }
211 
213  void ComputeMatrix();
214 
217  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const ITK_OVERRIDE;
218 
220  JacobianType &) const ITK_OVERRIDE
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 ITK_OVERRIDE;
240 
241 private:
242  Rigid3DPerspectiveTransform(const Self &) ITK_DELETE_FUNCTION;
243  void operator=(const Self &) ITK_DELETE_FUNCTION;
244 
247 
250 
252  TParametersValueType 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 */
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:47
virtual OutputVectorType TransformVector(const InputVectorType &) const override
const ParametersType & GetParameters() const override
Light weight base class for most itk classes.
Superclass::ParametersType ParametersType
Definition: itkTransform.h:117
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &p, JacobianType &jacobian) const override
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
virtual OutputVectorType TransformVector(const InputVectorType &) const
Definition: itkTransform.h:193
Superclass::FixedParametersType FixedParametersType
CovariantVector< TParametersValueType, NOutputDimensions > OutputCovariantVectorType
Definition: itkTransform.h:150
vnl_vector_fixed< TParametersValueType, NOutputDimensions > OutputVnlVectorType
Definition: itkTransform.h:154
Point< TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType
Superclass::OutputCovariantVectorType OutputCovariantVectorType
void SetRotation(const VersorType &rotation)
virtual void SetFixedParameters(const FixedParametersType &) override
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
Vector< TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType
FixedParametersType::ValueType FixedParametersValueType
Transform< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension)> Superclass
Superclass::FixedParametersType FixedParametersType
Definition: itkTransform.h:115
Superclass::OutputVnlVectorType OutputVnlVectorType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
void SetFocalDistance(TParametersValueType focalDistance)
Array2D< ParametersValueType > JacobianType
Definition: itkTransform.h:125
virtual const char * GetNameOfClass() const
Vector< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType
void PrintSelf(std::ostream &os, Indent indent) const override
vnl_vector_fixed< TParametersValueType, NInputDimensions > InputVnlVectorType
Definition: itkTransform.h:153
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianType &) const override
Rigid3DTramsform of a vector space (e.g. space coordinates)
Vector< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType
ParametersValueType ScalarType
Definition: itkTransform.h:122
Superclass::InputCovariantVectorType InputCovariantVectorType
OutputPointType TransformPoint(const InputPointType &point) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Definition: itkTransform.h:239
Point< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType
Superclass::InputVnlVectorType InputVnlVectorType
Matrix< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType
void SetParameters(const ParametersType &parameters) override
CovariantVector< TParametersValueType, NInputDimensions > InputCovariantVectorType
Definition: itkTransform.h:148
vnl_quaternion< TParametersValueType > VnlQuaternionType
TParametersValueType ValueType
Definition: itkVersor.h:58