00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMeanSquareRegistrationFunction_h
00018 #define __itkMeanSquareRegistrationFunction_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 MeanSquareRegistrationFunction :
00054 public PDEDeformableRegistrationFunction< TFixedImage,
00055 TMovingImage, TDeformationField>
00056 {
00057 public:
00058
00060 typedef MeanSquareRegistrationFunction 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( MeanSquareRegistrationFunction,
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 DeformationFieldType::PixelType DeformationFieldPixelType;
00087 typedef typename Superclass::DeformationFieldTypePointer
00088 DeformationFieldTypePointer;
00089
00091 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00092
00094 typedef typename Superclass::PixelType PixelType;
00095 typedef typename Superclass::RadiusType RadiusType;
00096 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00097 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00098 typedef typename Superclass::TimeStepType TimeStepType;
00099
00101 typedef double CoordRepType;
00102 typedef InterpolateImageFunction<MovingImageType,CoordRepType>
00103 InterpolatorType;
00104 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00105 typedef typename InterpolatorType::PointType PointType;
00106 typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00107 DefaultInterpolatorType;
00108
00110 typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
00111
00113 typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
00114 typedef typename GradientCalculatorType::Pointer GradientCalculatorPointer;
00115
00117 void SetMovingImageInterpolator( InterpolatorType * ptr )
00118 { m_MovingImageInterpolator = ptr; }
00119
00121 InterpolatorType * GetMovingImageInterpolator(void)
00122 { return m_MovingImageInterpolator; }
00123
00125 virtual TimeStepType ComputeGlobalTimeStep(void *itkNotUsed(GlobalData)) const
00126 { return m_TimeStep; }
00127
00130 virtual void *GetGlobalDataPointer() const
00131 {
00132 GlobalDataStruct *global = new GlobalDataStruct();
00133 return global;
00134 }
00136
00138 virtual void ReleaseGlobalDataPointer( void *GlobalData ) const
00139 { delete (GlobalDataStruct *) GlobalData; }
00140
00142 virtual void InitializeIteration();
00143
00146 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00147 void *globalData,
00148 const FloatOffsetType &offset = FloatOffsetType(0.0));
00149
00150
00151 protected:
00152 MeanSquareRegistrationFunction();
00153 ~MeanSquareRegistrationFunction() {}
00154 void PrintSelf(std::ostream& os, Indent indent) const;
00155
00157 typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
00158
00161 struct GlobalDataStruct
00162 {
00163 FixedImageNeighborhoodIteratorType m_FixedImageIterator;
00164 };
00165
00166 private:
00167 MeanSquareRegistrationFunction(const Self&);
00168 void operator=(const Self&);
00169
00171 SpacingType m_FixedImageSpacing;
00172
00174 GradientCalculatorPointer m_FixedImageGradientCalculator;
00175
00177 InterpolatorPointer m_MovingImageInterpolator;
00178
00180 TimeStepType m_TimeStep;
00181
00183 double m_DenominatorThreshold;
00184
00186 double m_IntensityDifferenceThreshold;
00187 };
00188
00189
00190 }
00191
00192 #ifndef ITK_MANUAL_INSTANTIATION
00193 #include "itkMeanSquareRegistrationFunction.txx"
00194 #endif
00195
00196 #endif
00197