Orfeo Toolbox  4.0
itkRigid2DTransform.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 __itkRigid2DTransform_h
19 #define __itkRigid2DTransform_h
20 
21 #include <iostream>
23 
24 namespace itk
25 {
56 template< typename TScalar = double >
57 // Data type for scalars (float or double)
59  public MatrixOffsetTransformBase< TScalar, 2, 2 > // Dimensions of
60  // input and output
61  // spaces
62 {
63 public:
69 
72 
74  itkNewMacro(Self);
75 
77  itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
78  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
79  itkStaticConstMacro(ParametersDimension, unsigned int, 3);
80 
83 
87 
90 
91  // / Standard matrix type for this class
94 
95  // / Standard vector type for this class
98 
99  // / Standard vector type for this class
103 
104  // / Standard covariant vector type for this class
107 
108  // / Standard vnl_vector type for this class
111 
112  // / Standard coordinate point type for this class
115 
120 
133  virtual void SetMatrix(const MatrixType & matrix);
134 
142  void Translate(const OffsetType & offset, bool pre = false);
143 
152  inline InputPointType BackTransform(const OutputPointType & point) const;
153 
154  inline InputVectorType BackTransform(const OutputVectorType & vector) const;
155 
156  inline InputVnlVectorType BackTransform(const OutputVnlVectorType & vector) const;
157 
159 
161  void SetAngle(TScalar angle);
162 
163  itkGetConstReferenceMacro(Angle, TScalar);
164 
166  void SetAngleInDegrees(TScalar angle);
167 
171  void SetRotation(TScalar angle)
172  {
173  this->SetAngle(angle);
174  }
175  virtual const TScalar & GetRotation() const
176  {
177  return m_Angle;
178  }
179 
188  void SetParameters(const ParametersType & parameters);
189 
198  const ParametersType & GetParameters(void) const;
199 
202  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const;
203 
208  void CloneInverseTo(Pointer & newinverse) const;
209 
211  bool GetInverse(Self *inverse) const;
212 
215 
220  void CloneTo(Pointer & clone) const;
221 
223  virtual void SetIdentity(void);
224 
225 #ifdef ITKV3_COMPATIBILITY
226 
232  itkLegacyMacro(virtual void SetRotationMatrix(const MatrixType & matrix));
233  itkLegacyMacro(const MatrixType & GetRotationMatrix() const);
234 #endif
235 
236 protected:
237  Rigid2DTransform(unsigned int outputSpaceDimension, unsigned int parametersDimension);
238  Rigid2DTransform(unsigned int parametersDimension);
240 
242 
246  void PrintSelf(std::ostream & os, Indent indent) const;
247 
251  virtual void ComputeMatrix(void);
252 
257  virtual void ComputeMatrixParameters(void);
258 
260  void SetVarAngle(TScalar angle)
261  {
262  m_Angle = angle;
263  }
264 
265 private:
266  Rigid2DTransform(const Self &); // purposely not implemented
267  void operator=(const Self &); // purposely not implemented
268 
269  TScalar m_Angle;
270 
271 }; // class Rigid2DTransform
272 
273 // Back transform a point
274 template <typename TScalar>
275 inline
278 {
279  itkWarningMacro(
280  <<
281  "BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
282  );
283  return this->GetInverseMatrix() * ( point - this->GetOffset() );
284 }
285 
286 // Back transform a vector
287 template <typename TScalar>
288 inline
291 {
292  itkWarningMacro(
293  <<
294  "BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
295  );
296  return this->GetInverseMatrix() * vect;
297 }
298 
299 // Back transform a vnl_vector
300 template <typename TScalar>
301 inline
304 {
305  itkWarningMacro(
306  <<
307  "BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
308  );
309  return this->GetInverseMatrix() * vect;
310 }
311 
312 // Back Transform a CovariantVector
313 template <typename TScalar>
314 inline
317 {
318  itkWarningMacro(
319  <<
320  "BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."
321  );
322  return this->GetMatrix() * vect;
323 }
324 
325 } // namespace itk
326 
327 #ifndef ITK_MANUAL_INSTANTIATION
328 #include "itkRigid2DTransform.hxx"
329 #endif
330 
331 #endif /* __itkRigid2DTransform_h */

Generated at Sat Mar 8 2014 15:28:24 for Orfeo Toolbox with doxygen 1.8.3.1