00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkDiffeomorphicDemonsRegistrationFilter_h
00019 #define __itkDiffeomorphicDemonsRegistrationFilter_h
00020
00021 #include "itkPDEDeformableRegistrationFilter.h"
00022 #include "itkESMDemonsRegistrationFunction.h"
00023
00024 #include "itkMultiplyByConstantImageFilter.h"
00025 #include "itkExponentialDeformationFieldImageFilter.h"
00026 #include "itkWarpVectorImageFilter.h"
00027 #include "itkVectorLinearInterpolateNearestNeighborExtrapolateImageFunction.h"
00028 #include "itkAddImageFilter.h"
00029
00030 namespace itk {
00031
00079 template<class TFixedImage, class TMovingImage, class TDeformationField>
00080 class ITK_EXPORT DiffeomorphicDemonsRegistrationFilter :
00081 public PDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
00082 TDeformationField>
00083 {
00084 public:
00086 typedef DiffeomorphicDemonsRegistrationFilter Self;
00087 typedef PDEDeformableRegistrationFilter<
00088 TFixedImage, TMovingImage,TDeformationField> Superclass;
00089 typedef SmartPointer<Self> Pointer;
00090 typedef SmartPointer<const Self> ConstPointer;
00091
00093 itkNewMacro(Self);
00094
00096 itkTypeMacro( DiffeomorphicDemonsRegistrationFilter,
00097 PDEDeformableRegistrationFilter );
00098
00100 typedef typename Superclass::FixedImageType FixedImageType;
00101 typedef typename Superclass::FixedImagePointer FixedImagePointer;
00102
00104 typedef typename Superclass::MovingImageType MovingImageType;
00105 typedef typename Superclass::MovingImagePointer MovingImagePointer;
00106
00108 typedef typename Superclass::DeformationFieldType DeformationFieldType;
00109 typedef typename Superclass::DeformationFieldPointer DeformationFieldPointer;
00110
00112 typedef typename
00113 Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType;
00114
00116 typedef typename
00117 FiniteDifferenceFunctionType::TimeStepType TimeStepType;
00118
00120 typedef ESMDemonsRegistrationFunction<
00121 FixedImageType,
00122 MovingImageType, DeformationFieldType> DemonsRegistrationFunctionType;
00123 typedef typename
00124 DemonsRegistrationFunctionType::GradientType GradientType;
00125
00130 virtual double GetMetric() const;
00131 virtual const double &GetRMSChange() const;
00133
00134 virtual void SetUseGradientType( GradientType gtype );
00135 virtual GradientType GetUseGradientType() const;
00136
00140 itkSetMacro( UseFirstOrderExp, bool );
00141 itkGetMacro( UseFirstOrderExp, bool );
00142 itkBooleanMacro( UseFirstOrderExp );
00144
00149 virtual void SetIntensityDifferenceThreshold(double);
00150 virtual double GetIntensityDifferenceThreshold() const;
00152
00155 virtual void SetMaximumUpdateStepLength(double);
00156 virtual double GetMaximumUpdateStepLength() const;
00158
00159 protected:
00160 DiffeomorphicDemonsRegistrationFilter();
00161 ~DiffeomorphicDemonsRegistrationFilter() {}
00162 void PrintSelf(std::ostream& os, Indent indent) const;
00163
00165 virtual void InitializeIteration();
00166
00169 virtual void AllocateUpdateBuffer();
00170
00172 virtual void ApplyUpdate(TimeStepType dt);
00173
00174 private:
00175 DiffeomorphicDemonsRegistrationFilter(const Self&);
00176 void operator=(const Self&);
00177
00180 DemonsRegistrationFunctionType * DownCastDifferenceFunctionType();
00181 const DemonsRegistrationFunctionType * DownCastDifferenceFunctionType() const;
00183
00184
00186 typedef MultiplyByConstantImageFilter<
00187 DeformationFieldType,
00188 TimeStepType, DeformationFieldType > MultiplyByConstantType;
00189
00190 typedef ExponentialDeformationFieldImageFilter<
00191 DeformationFieldType, DeformationFieldType > FieldExponentiatorType;
00192
00193
00194 typedef WarpVectorImageFilter<
00195 DeformationFieldType,
00196 DeformationFieldType, DeformationFieldType> VectorWarperType;
00197
00198 typedef VectorLinearInterpolateNearestNeighborExtrapolateImageFunction<
00199 DeformationFieldType, double> FieldInterpolatorType;
00200
00201 typedef AddImageFilter<
00202 DeformationFieldType,
00203 DeformationFieldType, DeformationFieldType> AdderType;
00204
00205
00206 typedef typename MultiplyByConstantType::Pointer MultiplyByConstantPointer;
00207 typedef typename FieldExponentiatorType::Pointer FieldExponentiatorPointer;
00208 typedef typename VectorWarperType::Pointer VectorWarperPointer;
00209 typedef typename FieldInterpolatorType::Pointer FieldInterpolatorPointer;
00210 typedef typename FieldInterpolatorType::OutputType FieldInterpolatorOutputType;
00211 typedef typename AdderType::Pointer AdderPointer;
00212
00213
00214 MultiplyByConstantPointer m_Multiplier;
00215 FieldExponentiatorPointer m_Exponentiator;
00216 VectorWarperPointer m_Warper;
00217 AdderPointer m_Adder;
00218 bool m_UseFirstOrderExp;
00219 };
00220
00221
00222 }
00223
00224 #ifndef ITK_MANUAL_INSTANTIATION
00225 #include "itkDiffeomorphicDemonsRegistrationFilter.txx"
00226 #endif
00227
00228 #endif
00229