Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMIRegistrationFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMIRegistrationFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-26 21:45:49 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkMIRegistrationFunction_h
00018 #define __itkMIRegistrationFunction_h
00019 
00020 #include "itkPDEDeformableRegistrationFunction.h"
00021 #include "itkPoint.h"
00022 #include "itkCovariantVector.h"
00023 #include "itkInterpolateImageFunction.h"
00024 #include "itkLinearInterpolateImageFunction.h"
00025 #include "itkCentralDifferenceImageFunction.h"
00026 
00027 namespace itk {
00028 
00052 template<class TFixedImage, class TMovingImage, class TDeformationField>
00053 class ITK_EXPORT MIRegistrationFunction : 
00054   public PDEDeformableRegistrationFunction< TFixedImage,
00055     TMovingImage, TDeformationField>
00056 {
00057 public:
00058 
00060   typedef MIRegistrationFunction         Self;
00061   typedef PDEDeformableRegistrationFunction< TFixedImage,
00062     TMovingImage, TDeformationField >    Superclass;
00063   typedef SmartPointer<Self>             Pointer;
00064   typedef SmartPointer<const Self>       ConstPointer;
00065 
00067   itkNewMacro(Self);
00068 
00070   itkTypeMacro( MIRegistrationFunction, 
00071     PDEDeformableRegistrationFunction );
00072 
00074   typedef typename Superclass::MovingImageType     MovingImageType;
00075   typedef typename Superclass::MovingImagePointer  MovingImagePointer;
00076 
00078   typedef typename Superclass::FixedImageType     FixedImageType;
00079   typedef typename Superclass::FixedImagePointer  FixedImagePointer;
00080   typedef typename FixedImageType::IndexType      IndexType;
00081   typedef typename FixedImageType::SizeType       SizeType;
00082   typedef typename FixedImageType::SpacingType    SpacingType;
00083 
00085   typedef typename Superclass::DeformationFieldType    DeformationFieldType;
00086   typedef typename Superclass::DeformationFieldTypePointer   
00087     DeformationFieldTypePointer;
00088 
00090   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00091 
00093   typedef typename Superclass::PixelType           PixelType;
00094   typedef typename Superclass::RadiusType          RadiusType;
00095   typedef typename Superclass::NeighborhoodType    NeighborhoodType;
00096   typedef typename Superclass::FloatOffsetType     FloatOffsetType;
00097   typedef typename Superclass::TimeStepType        TimeStepType;
00098 
00100   typedef double                                                 CoordRepType;
00101   typedef InterpolateImageFunction<MovingImageType,CoordRepType> InterpolatorType;
00102   typedef typename InterpolatorType::Pointer                     InterpolatorPointer;
00103   typedef typename InterpolatorType::PointType                   PointType;
00104   typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00105                                                                  DefaultInterpolatorType;
00106 
00108   typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00109 
00111   typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00112   typedef typename GradientCalculatorType::Pointer   GradientCalculatorPointer;
00113 
00115   void SetMovingImageInterpolator( InterpolatorType * ptr )
00116     { m_MovingImageInterpolator = ptr; }
00117 
00119   InterpolatorType * GetMovingImageInterpolator(void)
00120     { return m_MovingImageInterpolator; }
00121 
00123   virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
00124     { return m_TimeStep; }
00125 
00128   virtual void *GetGlobalDataPointer() const
00129     {
00130     GlobalDataStruct *global = new GlobalDataStruct();
00131     return global;
00132     }
00134 
00136   virtual void ReleaseGlobalDataPointer( void *GlobalData ) const
00137     { delete (GlobalDataStruct *) GlobalData;  }
00138 
00140   virtual void InitializeIteration();
00141 
00144   virtual PixelType  ComputeUpdate(const NeighborhoodType &neighborhood,
00145                      void *globalData,
00146                      const FloatOffsetType &offset = FloatOffsetType(0.0));
00147 
00148   void SetMinNorm(float ts=1.0) { m_Minnorm=ts;}
00149 
00150 
00151   void SetDoInverse(bool b = false) { m_DoInverse=b;}
00152 
00153 
00154 protected:
00155   MIRegistrationFunction();
00156   ~MIRegistrationFunction() {}
00157   void PrintSelf(std::ostream& os, Indent indent) const;
00158 
00160   typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00161 
00164   struct GlobalDataStruct
00165     {
00166     FixedImageNeighborhoodIteratorType   m_FixedImageIterator;
00167     };
00168 
00170   TimeStepType                    m_TimeStep;
00171 
00172 
00173 private:
00174   MIRegistrationFunction(const Self&); //purposely not implemented
00175   void operator=(const Self&); //purposely not implemented
00176   
00178   SpacingType                     m_FixedImageSpacing;
00179   PointType                       m_FixedImageOrigin;
00180 
00182   GradientCalculatorPointer       m_FixedImageGradientCalculator;
00183 
00185   GradientCalculatorPointer       m_MovingImageGradientCalculator;
00186 
00188   InterpolatorPointer             m_MovingImageInterpolator;
00189 
00190 
00192   double                          m_DenominatorThreshold;
00193 
00195   double                          m_IntensityDifferenceThreshold;
00196 
00197   mutable double                          m_MetricTotal;
00198 
00199   unsigned int m_NumberOfSamples;
00200   unsigned int m_NumberOfBins;
00201   float        m_Minnorm;
00202 
00203   bool         m_DoInverse;
00204 };
00205 
00206 
00207 } // end namespace itk
00208 
00209 #ifndef ITK_MANUAL_INSTANTIATION
00210 #include "itkMIRegistrationFunction.txx"
00211 #endif
00212 
00213 #endif
00214 

Generated at Thu May 28 10:47:47 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000