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 #ifndef __itkAdvancedMatrixOffsetTransformBase_h
32 #define __itkAdvancedMatrixOffsetTransformBase_h
33 
34 #include <iostream>
35 
36 #include "itkMatrix.h"
37 #include "itkAdvancedTransform.h"
38 #include "itkExceptionObject.h"
39 #include "itkMacro.h"
40 
41 namespace itk
42 {
43 
88 template<
89 class TScalarType = double, // Data type for scalars
90 unsigned int NInputDimensions = 3, // Number of dimensions in the input space
91 unsigned int NOutputDimensions = 3 >
92 // Number of dimensions in the output space
94  public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
95 {
96 public:
97 
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  typedef typename Superclass::TransformCategoryType TransformCategoryType;
133 
134  typedef typename Superclass
137  typedef typename Superclass
140  typedef typename Superclass
143 
145  typedef Matrix< TScalarType,
146  itkGetStaticConstMacro( OutputSpaceDimension ),
147  itkGetStaticConstMacro( InputSpaceDimension ) > MatrixType;
148 
150  typedef Matrix< TScalarType,
151  itkGetStaticConstMacro( InputSpaceDimension ),
152  itkGetStaticConstMacro( OutputSpaceDimension ) > InverseMatrixType;
153 
158 
162  virtual void SetIdentity( void );
163 
176  virtual void SetMatrix( const MatrixType & matrix )
177  {
178  this->m_Matrix = matrix;
179  this->ComputeOffset();
180  this->ComputeMatrixParameters();
181  this->m_MatrixMTime.Modified();
182  this->Modified();
183  }
184 
185 
193  const MatrixType & GetMatrix( void ) const
194  {
195  return this->m_Matrix;
196  }
197 
198 
208  void SetOffset( const OutputVectorType & offset )
209  {
210  this->m_Offset = offset;
211  this->ComputeTranslation();
212  this->Modified();
213  }
214 
215 
222  const OutputVectorType & GetOffset( void ) const
223  {
224  return this->m_Offset;
225  }
226 
227 
251  void SetCenter( const InputPointType & center )
252  {
253  this->m_Center = center;
254  this->ComputeOffset();
255  this->Modified();
256  }
257 
258 
266  const InputPointType & GetCenter( void ) const
267  {
268  return this->m_Center;
269  }
270 
271 
279  void SetTranslation( const OutputVectorType & translation )
280  {
281  this->m_Translation = translation;
282  this->ComputeOffset();
283  this->Modified();
284  }
285 
286 
294  const OutputVectorType & GetTranslation( void ) const
295  {
296  return this->m_Translation;
297  }
298 
299 
305  void SetParameters( const ParametersType & parameters );
306 
308  const ParametersType & GetParameters( void ) const;
309 
311  virtual void SetFixedParameters( const ParametersType & );
312 
314  virtual const ParametersType & GetFixedParameters( void ) const;
315 
328  void Compose( const Self * other, bool pre = 0 );
329 
338  OutputPointType TransformPoint( const InputPointType & point ) const;
339 
340  OutputVectorType TransformVector( const InputVectorType & vector ) const;
341 
343 
345  const InputCovariantVectorType & vector ) const;
346 
364  bool GetInverse( Self * inverse ) const;
365 
369  const InverseMatrixType & GetInverseMatrix( void ) const;
370 
376  virtual bool IsLinear( void ) const
377  {
378  return true;
379  }
380 
381 
386  {
387  return Self::Linear;
388  }
389 
390 
392  virtual void GetJacobian(
393  const InputPointType &,
394  JacobianType &,
395  NonZeroJacobianIndicesType & ) const;
396 
398  virtual void GetSpatialJacobian(
399  const InputPointType &,
400  SpatialJacobianType & ) const;
401 
403  virtual void GetSpatialHessian(
404  const InputPointType &,
405  SpatialHessianType & ) const;
406 
408  virtual void GetJacobianOfSpatialJacobian(
409  const InputPointType &,
411  NonZeroJacobianIndicesType & ) const;
412 
414  virtual void GetJacobianOfSpatialJacobian(
415  const InputPointType &,
418  NonZeroJacobianIndicesType & ) const;
419 
421  virtual void GetJacobianOfSpatialHessian(
422  const InputPointType &,
424  NonZeroJacobianIndicesType & ) const;
425 
428  virtual void GetJacobianOfSpatialHessian(
429  const InputPointType & ipp,
430  SpatialHessianType & sh,
432  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
433 
434 protected:
435 
445  const OutputVectorType & offset );
446  AdvancedMatrixOffsetTransformBase( unsigned int paramDims );
448 
450  virtual void PrecomputeJacobians( unsigned int paramDims );
451 
454 
456  void PrintSelf( std::ostream & s, Indent indent ) const;
457 
459  {
460  return this->m_InverseMatrix;
461  }
462 
463 
464  void SetVarInverseMatrix( const InverseMatrixType & matrix ) const
465  {
466  this->m_InverseMatrix = matrix;
467  this->m_InverseMatrixMTime.Modified();
468  }
469 
470 
471  bool InverseMatrixIsOld( void ) const
472  {
473  if( this->m_MatrixMTime != this->m_InverseMatrixMTime )
474  {
475  return true;
476  }
477  else
478  {
479  return false;
480  }
481  }
482 
483 
484  virtual void ComputeMatrixParameters( void );
485 
486  virtual void ComputeMatrix( void );
487 
488  void SetVarMatrix( const MatrixType & matrix )
489  {
490  this->m_Matrix = matrix;
491  this->m_MatrixMTime.Modified();
492  }
493 
494 
495  virtual void ComputeTranslation( void );
496 
497  void SetVarTranslation( const OutputVectorType & translation )
498  {
499  this->m_Translation = translation;
500  }
501 
502 
503  virtual void ComputeOffset( void );
504 
505  void SetVarOffset( const OutputVectorType & offset )
506  {
507  this->m_Offset = offset;
508  }
509 
510 
511  void SetVarCenter( const InputPointType & center )
512  {
513  this->m_Center = center;
514  }
515 
516 
524 
525 private:
526 
527  AdvancedMatrixOffsetTransformBase( const Self & other );
528  const Self & operator=( const Self & );
529 
531  MatrixType m_Matrix; // Matrix of the transformation
532  OutputVectorType m_Offset; // Offset of the transformation
533  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
534  mutable bool m_Singular; // Is m_Inverse singular?
535 
538 
542 
546 
547 };
548 
549 } // namespace itk
550 
551 #ifndef ITK_MANUAL_INSTANTIATION
552 #include "itkAdvancedMatrixOffsetTransformBase.hxx"
553 #endif
554 
555 #endif /* __itkAdvancedMatrixOffsetTransformBase_h */
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
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
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
Matrix< TScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension) > InverseMatrixType
OutputPointType TransformPoint(const InputPointType &point) const
virtual const ParametersType & GetFixedParameters(void) const
bool GetInverse(Self *inverse) const
virtual TransformCategoryType GetTransformCategory() 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
Matrix< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension) > MatrixType
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 27-04-2014 for elastix by doxygen 1.8.6 elastix logo