go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedCombinationTransform.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 #ifndef __itkAdvancedCombinationTransform_h
00016 #define __itkAdvancedCombinationTransform_h
00017 
00018 #include "itkAdvancedTransform.h"
00019 #include "itkExceptionObject.h"
00020 
00021 
00022 namespace itk
00023 {
00024 
00053 template < typename TScalarType, unsigned int NDimensions = 3 >
00054 class AdvancedCombinationTransform :
00055   public AdvancedTransform<TScalarType, NDimensions, NDimensions>
00056 {
00057 public:
00059   typedef AdvancedCombinationTransform        Self;
00060   typedef AdvancedTransform< TScalarType,
00061     NDimensions, NDimensions >                Superclass;
00062   typedef SmartPointer< Self >                Pointer;
00063   typedef SmartPointer< const Self >          ConstPointer;
00064 
00066   itkNewMacro( Self );
00067 
00069   itkTypeMacro( AdvancedCombinationTransform, AdvancedTransform );
00070 
00072   itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
00073 
00075   typedef typename Superclass::ScalarType                 ScalarType;
00076   typedef typename Superclass::ParametersType             ParametersType;
00077   typedef typename Superclass::JacobianType               JacobianType;
00078   typedef typename Superclass::InputVectorType            InputVectorType;
00079   typedef typename Superclass::OutputVectorType           OutputVectorType;
00080   typedef typename Superclass::InputCovariantVectorType   InputCovariantVectorType;
00081   typedef typename Superclass::OutputCovariantVectorType  OutputCovariantVectorType;
00082   typedef typename Superclass::InputVnlVectorType         InputVnlVectorType;
00083   typedef typename Superclass::OutputVnlVectorType        OutputVnlVectorType;
00084   typedef typename Superclass::InputPointType             InputPointType;
00085   typedef typename Superclass::OutputPointType            OutputPointType;
00086   typedef typename Superclass::NonZeroJacobianIndicesType     NonZeroJacobianIndicesType;
00087   typedef typename Superclass::SpatialJacobianType            SpatialJacobianType;
00088   typedef typename Superclass::JacobianOfSpatialJacobianType  JacobianOfSpatialJacobianType;
00089   typedef typename Superclass::SpatialHessianType             SpatialHessianType;
00090   typedef typename Superclass::JacobianOfSpatialHessianType   JacobianOfSpatialHessianType;
00091   typedef typename Superclass::InternalMatrixType             InternalMatrixType;
00092 
00094   typedef Superclass                                      InitialTransformType;
00095   typedef typename InitialTransformType::Pointer          InitialTransformPointer;
00096   typedef typename InitialTransformType::ConstPointer     InitialTransformConstPointer;
00097 
00099   typedef Superclass                                      CurrentTransformType;
00100   typedef typename CurrentTransformType::Pointer          CurrentTransformPointer;
00101 
00103   virtual void SetInitialTransform( const InitialTransformType * _arg );
00104   itkGetConstObjectMacro( InitialTransform, InitialTransformType );
00105 
00110   virtual void SetCurrentTransform( CurrentTransformType * _arg );
00111   itkGetObjectMacro( CurrentTransform, CurrentTransformType );
00112 
00114   virtual void SetUseComposition( bool _arg );
00115   itkGetConstMacro( UseComposition, bool );
00116 
00118   virtual void SetUseAddition( bool _arg );
00119   itkGetConstMacro( UseAddition, bool );
00120 
00122   virtual OutputPointType TransformPoint( const InputPointType  & point ) const;
00123 
00125   virtual unsigned int GetNumberOfParameters( void ) const;
00126 
00128   virtual unsigned long GetNumberOfNonZeroJacobianIndices( void ) const;
00129 
00131   virtual const ParametersType & GetParameters( void ) const;
00132 
00134   virtual const ParametersType & GetFixedParameters( void ) const;
00135 
00137   virtual void SetParameters( const ParametersType & param );
00138 
00142   virtual void SetParametersByValue( const ParametersType & param );
00143 
00145   virtual void SetFixedParameters( const ParametersType & fixedParam );
00146 
00157   virtual bool GetInverse( Self* inverse ) const;
00158 
00161   virtual bool IsLinear( void ) const;
00162 
00164   virtual bool GetHasNonZeroSpatialHessian( void ) const;
00165   virtual bool HasNonZeroJacobianOfSpatialHessian( void ) const;
00166 
00168   virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
00169 
00171   virtual void GetJacobian(
00172     const InputPointType & ipp,
00173     JacobianType & j,
00174     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00175 
00177   virtual void GetSpatialJacobian(
00178     const InputPointType & ipp,
00179     SpatialJacobianType & sj ) const;
00180 
00182   virtual void GetSpatialHessian(
00183     const InputPointType & ipp,
00184     SpatialHessianType & sh ) const;
00185 
00187   virtual void GetJacobianOfSpatialJacobian(
00188     const InputPointType & ipp,
00189     JacobianOfSpatialJacobianType & jsj,
00190     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00191 
00195   virtual void GetJacobianOfSpatialJacobian(
00196     const InputPointType & ipp,
00197     SpatialJacobianType & sj,
00198     JacobianOfSpatialJacobianType & jsj,
00199     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00200 
00202   virtual void GetJacobianOfSpatialHessian(
00203     const InputPointType & ipp,
00204     JacobianOfSpatialHessianType & jsh,
00205     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00206 
00210   virtual void GetJacobianOfSpatialHessian(
00211     const InputPointType & ipp,
00212     SpatialHessianType & sh,
00213     JacobianOfSpatialHessianType & jsh,
00214     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00215 
00217   typedef OutputPointType (Self::*TransformPointFunctionPointer)( const InputPointType & ) const;
00218   typedef const JacobianType & (Self::*GetJacobianFunctionPointer)( const InputPointType & ) const;
00219   typedef void (Self::*GetSparseJacobianFunctionPointer)(
00220     const InputPointType &,
00221     JacobianType &,
00222     NonZeroJacobianIndicesType & ) const;
00223   typedef void (Self::*GetSpatialJacobianFunctionPointer)(
00224     const InputPointType &,
00225     SpatialJacobianType & ) const;
00226   typedef void (Self::*GetSpatialHessianFunctionPointer)(
00227     const InputPointType &,
00228     SpatialHessianType & ) const;
00229   typedef void (Self::*GetJacobianOfSpatialJacobianFunctionPointer)(
00230     const InputPointType &,
00231     JacobianOfSpatialJacobianType &,
00232     NonZeroJacobianIndicesType & ) const;
00233   typedef void (Self::*GetJacobianOfSpatialJacobianFunctionPointer2)(
00234     const InputPointType &,
00235     SpatialJacobianType &,
00236     JacobianOfSpatialJacobianType &,
00237     NonZeroJacobianIndicesType & ) const;
00238   typedef void (Self::*GetJacobianOfSpatialHessianFunctionPointer)(
00239     const InputPointType &,
00240     JacobianOfSpatialHessianType &,
00241     NonZeroJacobianIndicesType & ) const;
00242   typedef void (Self::*GetJacobianOfSpatialHessianFunctionPointer2)(
00243     const InputPointType &,
00244     SpatialHessianType &,
00245     JacobianOfSpatialHessianType &,
00246     NonZeroJacobianIndicesType & ) const;
00247 
00248 protected:
00249 
00251   AdvancedCombinationTransform();
00252 
00254   virtual ~AdvancedCombinationTransform(){};
00255 
00257   InitialTransformConstPointer  m_InitialTransform;
00258   CurrentTransformPointer       m_CurrentTransform;
00259 
00263   virtual void UpdateCombinationMethod( void );
00264 
00266   virtual void NoCurrentTransformSet( void ) const throw (ExceptionObject);
00267 
00274   TransformPointFunctionPointer m_SelectedTransformPointFunction;
00275 
00282   GetJacobianFunctionPointer m_SelectedGetJacobianFunction;
00283 
00285   GetSparseJacobianFunctionPointer    m_SelectedGetSparseJacobianFunction;
00286   GetSpatialJacobianFunctionPointer   m_SelectedGetSpatialJacobianFunction;
00287   GetSpatialHessianFunctionPointer    m_SelectedGetSpatialHessianFunction;
00288   GetJacobianOfSpatialJacobianFunctionPointer   m_SelectedGetJacobianOfSpatialJacobianFunction;
00289   GetJacobianOfSpatialJacobianFunctionPointer2  m_SelectedGetJacobianOfSpatialJacobianFunction2;
00290   GetJacobianOfSpatialHessianFunctionPointer    m_SelectedGetJacobianOfSpatialHessianFunction;
00291   GetJacobianOfSpatialHessianFunctionPointer2   m_SelectedGetJacobianOfSpatialHessianFunction2;
00292 
00298   inline OutputPointType TransformPointUseAddition(
00299     const InputPointType & point ) const;
00300 
00304   inline OutputPointType TransformPointUseComposition(
00305     const InputPointType & point ) const;
00306 
00308   inline OutputPointType TransformPointNoInitialTransform(
00309     const InputPointType & point ) const;
00310 
00312   inline OutputPointType TransformPointNoCurrentTransform(
00313     const InputPointType & point ) const;
00314 
00320   inline const JacobianType & GetJacobianUseAddition(
00321     const InputPointType & point ) const;
00322 
00326   inline const JacobianType & GetJacobianUseComposition(
00327     const InputPointType & point ) const;
00328 
00330   inline const JacobianType & GetJacobianNoInitialTransform(
00331     const InputPointType & point ) const;
00332 
00334   inline const JacobianType & GetJacobianNoCurrentTransform(
00335     const InputPointType & point ) const;
00336 
00342   inline void GetJacobianUseAddition(
00343     const InputPointType &,
00344     JacobianType &,
00345     NonZeroJacobianIndicesType & ) const;
00346 
00350   inline void GetJacobianUseComposition(
00351     const InputPointType &,
00352     JacobianType &,
00353     NonZeroJacobianIndicesType & ) const;
00354 
00356   inline void GetJacobianNoInitialTransform(
00357     const InputPointType &,
00358     JacobianType &,
00359     NonZeroJacobianIndicesType & ) const;
00360 
00362   inline void GetJacobianNoCurrentTransform(
00363     const InputPointType &,
00364     JacobianType &,
00365     NonZeroJacobianIndicesType & ) const;
00366 
00372   inline void GetSpatialJacobianUseAddition(
00373     const InputPointType & ipp,
00374     SpatialJacobianType & sj ) const;
00375 
00379   inline void GetSpatialJacobianUseComposition(
00380     const InputPointType & ipp,
00381     SpatialJacobianType & sj ) const;
00382 
00384   inline void GetSpatialJacobianNoInitialTransform(
00385     const InputPointType & ipp,
00386     SpatialJacobianType & sj ) const;
00387 
00389   inline void GetSpatialJacobianNoCurrentTransform(
00390     const InputPointType & ipp,
00391     SpatialJacobianType & sj ) const;
00392 
00398   inline void GetSpatialHessianUseAddition(
00399     const InputPointType & ipp,
00400     SpatialHessianType & sh ) const;
00401 
00405   inline void GetSpatialHessianUseComposition(
00406     const InputPointType & ipp,
00407     SpatialHessianType & sh ) const;
00408 
00410   inline void GetSpatialHessianNoInitialTransform(
00411     const InputPointType & ipp,
00412     SpatialHessianType & sh ) const;
00413 
00415   inline void GetSpatialHessianNoCurrentTransform(
00416     const InputPointType & ipp,
00417     SpatialHessianType & sh ) const;
00418 
00424   inline void GetJacobianOfSpatialJacobianUseAddition(
00425     const InputPointType & ipp,
00426     JacobianOfSpatialJacobianType & jsj,
00427     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00428 
00429   inline void GetJacobianOfSpatialJacobianUseAddition(
00430     const InputPointType & ipp,
00431     SpatialJacobianType & sj,
00432     JacobianOfSpatialJacobianType & jsj,
00433     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00434 
00438   inline void GetJacobianOfSpatialJacobianUseComposition(
00439     const InputPointType & ipp,
00440     JacobianOfSpatialJacobianType & jsj,
00441     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00442 
00443   inline void GetJacobianOfSpatialJacobianUseComposition(
00444     const InputPointType & ipp,
00445     SpatialJacobianType & sj,
00446     JacobianOfSpatialJacobianType & jsj,
00447     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00448 
00450   inline void GetJacobianOfSpatialJacobianNoInitialTransform(
00451     const InputPointType & ipp,
00452     JacobianOfSpatialJacobianType & jsj,
00453     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00454 
00455   inline void GetJacobianOfSpatialJacobianNoInitialTransform(
00456     const InputPointType & ipp,
00457     SpatialJacobianType & sj,
00458     JacobianOfSpatialJacobianType & jsj,
00459     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00460 
00462   inline void GetJacobianOfSpatialJacobianNoCurrentTransform(
00463     const InputPointType & ipp,
00464     JacobianOfSpatialJacobianType & jsj,
00465     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00466 
00467   inline void GetJacobianOfSpatialJacobianNoCurrentTransform(
00468     const InputPointType & ipp,
00469     SpatialJacobianType & sj,
00470     JacobianOfSpatialJacobianType & jsj,
00471     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00472 
00478   inline void GetJacobianOfSpatialHessianUseAddition(
00479     const InputPointType & ipp,
00480     JacobianOfSpatialHessianType & jsh,
00481     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00482 
00483   inline void GetJacobianOfSpatialHessianUseAddition(
00484     const InputPointType & ipp,
00485     SpatialHessianType & sh,
00486     JacobianOfSpatialHessianType & jsh,
00487     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00488 
00492   inline void GetJacobianOfSpatialHessianUseComposition(
00493     const InputPointType & ipp,
00494     JacobianOfSpatialHessianType & jsh,
00495     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00496 
00497   virtual inline void GetJacobianOfSpatialHessianUseComposition(
00498     const InputPointType & ipp,
00499     SpatialHessianType & sh,
00500     JacobianOfSpatialHessianType & jsh,
00501     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00502 
00504   inline void GetJacobianOfSpatialHessianNoInitialTransform(
00505     const InputPointType & ipp,
00506     JacobianOfSpatialHessianType & jsh,
00507     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00508 
00509   inline void GetJacobianOfSpatialHessianNoInitialTransform(
00510     const InputPointType & ipp,
00511     SpatialHessianType & sh,
00512     JacobianOfSpatialHessianType & jsh,
00513     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00514 
00516   inline void GetJacobianOfSpatialHessianNoCurrentTransform(
00517     const InputPointType & ipp,
00518     JacobianOfSpatialHessianType & jsh,
00519     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00520 
00521   inline void GetJacobianOfSpatialHessianNoCurrentTransform(
00522     const InputPointType & ipp,
00523     SpatialHessianType & sh,
00524     JacobianOfSpatialHessianType & jsh,
00525     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00526 
00528   bool m_UseAddition;
00529   bool m_UseComposition;
00530 
00531 private:
00532 
00533   AdvancedCombinationTransform( const Self& );  // purposely not implemented
00534   void operator=( const Self& );        // purposely not implemented
00535 
00536 }; // end class AdvancedCombinationTransform
00537 
00538 
00539 } // end namespace itk
00540 
00541 
00542 #ifndef ITK_MANUAL_INSTANTIATION
00543 #include "itkAdvancedCombinationTransform.hxx"
00544 #endif
00545 
00546 
00547 #endif // end #ifndef __itkAdvancedCombinationTransform_h
00548 


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo