go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedMatrixOffsetTransformBase.h
Go to the documentation of this file.
1 /*======================================================================
2 
3 This file is part of the elastix software.
4 
5 Copyright (c) University Medical Center Utrecht. All rights reserved.
6 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7 details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 /*
16 
17  Program: Insight Segmentation & Registration Toolkit
18  Module: $RCSfile: itkAdvancedMatrixOffsetTransformBase.h,v $
19  Language: C++
20  Date: $Date: 2008-06-29 12:58:58 $
21  Version: $Revision: 1.20 $
22 
23  Copyright (c) Insight Software Consortium. All rights reserved.
24  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
25 
26  This software is distributed WITHOUT ANY WARRANTY; without even
27  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28  PURPOSE. See the above copyright notices for more information.
29 
30 =========================================================================*/
31 
32 #ifndef __itkAdvancedMatrixOffsetTransformBase_h
33 #define __itkAdvancedMatrixOffsetTransformBase_h
34 
35 #include <iostream>
36 
37 #include "itkMatrix.h"
38 #include "itkAdvancedTransform.h"
39 #include "itkExceptionObject.h"
40 #include "itkMacro.h"
41 
42 namespace itk
43 {
44 
45 
90 template <
91  class TScalarType=double, // Data type for scalars
92  unsigned int NInputDimensions=3, // Number of dimensions in the input space
93  unsigned int NOutputDimensions=3> // Number of dimensions in the output space
95  : public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
96 {
97 public:
100  typedef AdvancedTransform< TScalarType,
101  NInputDimensions, NOutputDimensions > Superclass;
102  typedef SmartPointer<Self> Pointer;
103  typedef SmartPointer<const Self> ConstPointer;
104 
107 
109  itkNewMacro( Self );
110 
112  itkStaticConstMacro( InputSpaceDimension, unsigned int, NInputDimensions );
113  itkStaticConstMacro( OutputSpaceDimension, unsigned int, NOutputDimensions );
114  itkStaticConstMacro( ParametersDimension, unsigned int,
115  NOutputDimensions * ( NInputDimensions + 1 ) );
116 
124  typedef typename Superclass
126  typedef typename Superclass
132 
133  typedef typename Superclass
136  typedef typename Superclass
139  typedef typename Superclass
142 
144  typedef Matrix< TScalarType,
145  itkGetStaticConstMacro( OutputSpaceDimension ),
146  itkGetStaticConstMacro( InputSpaceDimension )> MatrixType;
147 
149  typedef Matrix< TScalarType,
150  itkGetStaticConstMacro( InputSpaceDimension ),
151  itkGetStaticConstMacro( OutputSpaceDimension )> InverseMatrixType;
152 
157 
161  virtual void SetIdentity( void );
162 
175  virtual void SetMatrix( const MatrixType & matrix )
176  {
177  this->m_Matrix = matrix;
178  this->ComputeOffset();
179  this->ComputeMatrixParameters();
180  this->m_MatrixMTime.Modified();
181  this->Modified();
182  }
183 
191  const MatrixType & GetMatrix( void ) const
192  {
193  return this->m_Matrix;
194  }
195 
205  void SetOffset( const OutputVectorType &offset )
206  {
207  this->m_Offset = offset;
208  this->ComputeTranslation();
209  this->Modified();
210  }
211 
218  const OutputVectorType & GetOffset( void ) const
219  {
220  return this->m_Offset;
221  }
222 
246  void SetCenter( const InputPointType & center )
247  {
248  this->m_Center = center;
249  this->ComputeOffset();
250  this->Modified();
251  }
252 
260  const InputPointType & GetCenter( void ) const
261  {
262  return this->m_Center;
263  }
264 
272  void SetTranslation( const OutputVectorType & translation )
273  {
274  this->m_Translation = translation;
275  this->ComputeOffset();
276  this->Modified();
277  }
278 
286  const OutputVectorType & GetTranslation( void ) const
287  {
288  return this->m_Translation;
289  }
290 
296  void SetParameters( const ParametersType & parameters );
297 
299  const ParametersType & GetParameters( void ) const;
300 
302  virtual void SetFixedParameters( const ParametersType & );
303 
305  virtual const ParametersType & GetFixedParameters( void ) const;
306 
319  void Compose( const Self * other, bool pre = 0 );
320 
329  OutputPointType TransformPoint( const InputPointType & point ) const;
330  OutputVectorType TransformVector( const InputVectorType & vector ) const;
333  const InputCovariantVectorType & vector ) const;
334 
352  bool GetInverse( Self * inverse ) const;
353 
357  const InverseMatrixType & GetInverseMatrix( void ) const;
358 
364  virtual bool IsLinear( void ) const
365  {
366  return true;
367  }
368 
370  virtual void GetJacobian(
371  const InputPointType &,
372  JacobianType &,
373  NonZeroJacobianIndicesType & ) const;
374 
376  virtual void GetSpatialJacobian(
377  const InputPointType &,
378  SpatialJacobianType & ) const;
379 
381  virtual void GetSpatialHessian(
382  const InputPointType &,
383  SpatialHessianType & ) const;
384 
386  virtual void GetJacobianOfSpatialJacobian(
387  const InputPointType &,
389  NonZeroJacobianIndicesType & ) const;
390 
392  virtual void GetJacobianOfSpatialJacobian(
393  const InputPointType &,
396  NonZeroJacobianIndicesType & ) const;
397 
399  virtual void GetJacobianOfSpatialHessian(
400  const InputPointType &,
402  NonZeroJacobianIndicesType & ) const;
403 
406  virtual void GetJacobianOfSpatialHessian(
407  const InputPointType & ipp,
408  SpatialHessianType & sh,
410  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
411 
412 protected:
422  const OutputVectorType & offset );
423  AdvancedMatrixOffsetTransformBase( unsigned int paramDims );
425 
427  virtual void PrecomputeJacobians( unsigned int paramDims );
428 
431 
433  void PrintSelf( std::ostream &s, Indent indent ) const;
434 
436  {
437  return this->m_InverseMatrix;
438  };
439 
440  void SetVarInverseMatrix( const InverseMatrixType & matrix ) const
441  {
442  this->m_InverseMatrix = matrix;
443  this->m_InverseMatrixMTime.Modified();
444  };
445 
446  bool InverseMatrixIsOld( void ) const
447  {
448  if ( this->m_MatrixMTime != this->m_InverseMatrixMTime )
449  {
450  return true;
451  }
452  else
453  {
454  return false;
455  }
456  };
457 
458  virtual void ComputeMatrixParameters( void );
459 
460  virtual void ComputeMatrix( void );
461 
462  void SetVarMatrix( const MatrixType & matrix )
463  {
464  this->m_Matrix = matrix;
465  this->m_MatrixMTime.Modified();
466  };
467 
468  virtual void ComputeTranslation( void );
469 
470  void SetVarTranslation( const OutputVectorType & translation )
471  {
472  this->m_Translation = translation;
473  };
474 
475  virtual void ComputeOffset( void );
476 
477  void SetVarOffset( const OutputVectorType & offset )
478  {
479  this->m_Offset = offset;
480  };
481 
482  void SetVarCenter( const InputPointType & center )
483  {
484  this->m_Center = center;
485  };
486 
494 
495 private:
496 
498  const Self & operator=( const Self & );
499 
501  MatrixType m_Matrix; // Matrix of the transformation
502  OutputVectorType m_Offset; // Offset of the transformation
503  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
504  mutable bool m_Singular; // Is m_Inverse singular?
505 
508 
512 
516 
517 }; //class AdvancedMatrixOffsetTransformBase
518 
519 } // namespace itk
520 
521 // Define instantiation macro for this template.
522 #define ITK_TEMPLATE_AdvancedMatrixOffsetTransformBase(_, EXPORT, x, y) namespace itk { \
523  _(3(class EXPORT AdvancedMatrixOffsetTransformBase< ITK_TEMPLATE_3 x >)) \
524  namespace Templates { typedef AdvancedMatrixOffsetTransformBase< ITK_TEMPLATE_3 x > AdvancedMatrixOffsetTransformBase##y; } \
525  }
526 
527 #if ITK_TEMPLATE_EXPLICIT
528 # include "Templates/itkAdvancedMatrixOffsetTransformBase+-.h"
529 #endif
530 
531 #if ITK_TEMPLATE_TXX
532 # include "itkAdvancedMatrixOffsetTransformBase.txx"
533 #endif
534 
535 #endif /* __itkAdvancedMatrixOffsetTransformBase_h */
536 
const OutputVectorType & GetTranslation(void) const
void SetVarInverseMatrix(const InverseMatrixType &matrix) const
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
const Self & operator=(const Self &)
virtual void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const
std::vector< unsigned long > NonZeroJacobianIndicesType
Matrix< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
virtual void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const
const InverseMatrixType & GetInverseMatrix(void) const
Superclass::ScalarType ScalarType
SpatialJacobianType::InternalMatrixType InternalMatrixType
virtual void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const
void SetParameters(const ParametersType &parameters)
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::InputCovariantVectorType InputCovariantVectorType
void PrintSelf(std::ostream &s, Indent indent) const
Matrix< TScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension)> InverseMatrixType
Superclass::OutputVnlVectorType OutputVnlVectorType
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::ParametersType ParametersType
Transform maps points, vectors and covariant vectors from an input space to an output space...
void SetVarTranslation(const OutputVectorType &translation)
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::OutputVectorType OutputVectorType
virtual void GetSpatialHessian(const InputPointType &, SpatialHessianType &) const
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::JacobianType JacobianType
OutputPointType TransformPoint(const InputPointType &point) const
virtual const ParametersType & GetFixedParameters(void) const
bool GetInverse(Self *inverse) const
void Compose(const Self *other, bool pre=0)
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::InputPointType InputPointType
OutputVectorType TransformVector(const InputVectorType &vector) const
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::InputVectorType InputVectorType
const ParametersType & GetParameters(void) const
Superclass::OutputPointType OutputPointType
virtual void PrecomputeJacobians(unsigned int paramDims)
void SetTranslation(const OutputVectorType &translation)
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
virtual void SetFixedParameters(const ParametersType &)
Superclass::InputCovariantVectorType InputCovariantVectorType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
virtual void ComputeMatrixParameters(void)
AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
virtual void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const
const InverseMatrixType & GetVarInverseMatrix(void) const


Generated on 04-01-2014 for elastix by doxygen 1.8.5 elastix logo