Orfeo Toolbox  3.16
itkMatrixOffsetTransformBase.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkMatrixOffsetTransformBase.h,v $
5  Language: C++
6  Date: $Date: 2009-11-28 15:58:04 $
7  Version: $Revision: 1.25 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkMatrixOffsetTransformBase_h
18 #define __itkMatrixOffsetTransformBase_h
19 
20 #include <iostream>
21 
22 #include "itkMatrix.h"
23 #include "itkTransform.h"
24 #include "itkExceptionObject.h"
25 #include "itkMacro.h"
26 
27 namespace itk
28 {
29 
30 
75 template <
76  class TScalarType=double, // Data type for scalars
77  unsigned int NInputDimensions=3, // Number of dimensions in the input space
78  unsigned int NOutputDimensions=3> // Number of dimensions in the output space
80  : public Transform< TScalarType, NInputDimensions, NOutputDimensions >
81 {
82 public:
85  typedef Transform< TScalarType,
86  NInputDimensions,
87  NOutputDimensions > Superclass;
90 
92  itkTypeMacro( MatrixOffsetTransformBase, Transform );
93 
95  itkNewMacro( Self );
96 
98  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
99  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
100  itkStaticConstMacro(ParametersDimension, unsigned int,
101  NOutputDimensions*(NInputDimensions+1));
102 
103 
107 
110 
113 
115  typedef Vector<TScalarType,
116  itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
117  typedef Vector<TScalarType,
118  itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
120 
122  typedef CovariantVector<TScalarType,
123  itkGetStaticConstMacro(InputSpaceDimension)>
125  typedef CovariantVector<TScalarType,
126  itkGetStaticConstMacro(OutputSpaceDimension)>
128 
130  typedef vnl_vector_fixed<TScalarType,
131  itkGetStaticConstMacro(InputSpaceDimension)>
133  typedef vnl_vector_fixed<TScalarType,
134  itkGetStaticConstMacro(OutputSpaceDimension)>
136 
138  typedef Point<TScalarType,
139  itkGetStaticConstMacro(InputSpaceDimension)>
142  typedef Point<TScalarType,
143  itkGetStaticConstMacro(OutputSpaceDimension)>
146 
148  typedef Matrix<TScalarType, itkGetStaticConstMacro(OutputSpaceDimension),
149  itkGetStaticConstMacro(InputSpaceDimension)>
152 
154  typedef Matrix<TScalarType, itkGetStaticConstMacro(InputSpaceDimension),
155  itkGetStaticConstMacro(OutputSpaceDimension)>
157 
159 
162 
164 
166 
171 
175  virtual void SetIdentity( void );
176 
188  virtual void SetMatrix(const MatrixType &matrix)
189  {
190  m_Matrix = matrix; this->ComputeOffset();
191  this->ComputeMatrixParameters();
192  m_MatrixMTime.Modified(); this->Modified(); return;
193  }
194 
201  const MatrixType & GetMatrix() const
202  { return m_Matrix; }
203 
212  void SetOffset(const OutputVectorType &offset)
213  {
214  m_Offset = offset; this->ComputeTranslation();
215  this->Modified(); return;
216  }
217 
223  const OutputVectorType & GetOffset(void) const
224  { return m_Offset; }
225 
248  void SetCenter(const InputPointType & center)
249  {
250  m_Center = center; this->ComputeOffset();
251  this->Modified(); return;
252  }
253 
260  const InputPointType & GetCenter() const
261  { return m_Center; }
262 
269  void SetTranslation(const OutputVectorType & translation)
270  {
271  m_Translation = translation; this->ComputeOffset();
272  this->Modified(); return;
273  }
274 
281  const OutputVectorType & GetTranslation(void) const
282  {
283  return m_Translation;
284  }
285 
290  void SetParameters( const ParametersType & parameters );
291 
293  const ParametersType& GetParameters(void) const;
294 
296  virtual void SetFixedParameters( const ParametersType & );
297 
299  virtual const ParametersType& GetFixedParameters(void) const;
300 
301 
313  void Compose(const Self * other, bool pre=0);
314 
322  OutputPointType TransformPoint(const InputPointType & point) const;
323  OutputVectorType TransformVector(const InputVectorType & vector) const;
326  const InputCovariantVectorType &vector) const;
327 
334  const JacobianType & GetJacobian(const InputPointType & point ) const;
335 
354  bool GetInverse(Self * inverse) const;
355 
358 
362  const InverseMatrixType & GetInverseMatrix( void ) const;
363 
369  virtual bool IsLinear() const { return true; }
370 
371 protected:
380  const OutputVectorType &offset);
381  MatrixOffsetTransformBase(unsigned int outputDims,
382  unsigned int paramDims);
384 
386  virtual ~MatrixOffsetTransformBase();
387 
389  void PrintSelf(std::ostream &s, Indent indent) const;
390 
392  { return m_InverseMatrix; }
393  void SetVarInverseMatrix(const InverseMatrixType & matrix) const
395  bool InverseMatrixIsOld(void) const
396  {
398  {
399  return true;
400  }
401  else
402  {
403  return false;
404  }
405  }
406 
407  virtual void ComputeMatrixParameters(void);
408 
409  virtual void ComputeMatrix(void);
410  void SetVarMatrix(const MatrixType & matrix)
411  { m_Matrix = matrix; m_MatrixMTime.Modified(); }
412 
413  virtual void ComputeTranslation(void);
414  void SetVarTranslation(const OutputVectorType & translation)
415  { m_Translation = translation; }
416 
417  virtual void ComputeOffset(void);
418  void SetVarOffset(const OutputVectorType & offset)
419  { m_Offset = offset; }
420 
421  void SetVarCenter(const InputPointType & center)
422  { m_Center = center; }
423 
424 private:
425 
426  MatrixOffsetTransformBase(const Self & other);
427  const Self & operator=( const Self & );
428 
429 
430  MatrixType m_Matrix; // Matrix of the transformation
431  OutputVectorType m_Offset; // Offset of the transformation
432  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
433  mutable bool m_Singular; // Is m_Inverse singular?
434 
437 
441 
442 }; //class MatrixOffsetTransformBase
443 
444 } // namespace itk
445 
446 // Define instantiation macro for this template.
447 #define ITK_TEMPLATE_MatrixOffsetTransformBase(_, EXPORT, x, y) namespace itk { \
448  _(3(class EXPORT MatrixOffsetTransformBase< ITK_TEMPLATE_3 x >)) \
449  namespace Templates { typedef MatrixOffsetTransformBase< ITK_TEMPLATE_3 x > MatrixOffsetTransformBase##y; } \
450  }
451 
452 #if ITK_TEMPLATE_EXPLICIT
453 # include "Templates/itkMatrixOffsetTransformBase+-.h"
454 #endif
455 
456 #if ITK_TEMPLATE_TXX
458 #endif
459 
460 #endif /* __itkMatrixOffsetTransformBase_h */

Generated at Sat Feb 2 2013 23:51:49 for Orfeo Toolbox with doxygen 1.8.1.1