itkLogDomainDeformableRegistrationFilter.h
Go to the documentation of this file.00001 #ifndef __itkLogDomainDeformableRegistrationFilter_h
00002 #define __itkLogDomainDeformableRegistrationFilter_h
00003
00004 #include "itkDenseFiniteDifferenceImageFilter.h"
00005 #include "itkExponentialDeformationFieldImageFilter2.h"
00006 #include "itkPDEDeformableRegistrationFunction.h"
00007
00008 namespace itk
00009 {
00066 template< class TFixedImage, class TMovingImage, class TField >
00067 class ITK_EXPORT LogDomainDeformableRegistrationFilter:
00068 public DenseFiniteDifferenceImageFilter< TField, TField >
00069 {
00070 public:
00072 typedef LogDomainDeformableRegistrationFilter Self;
00073 typedef DenseFiniteDifferenceImageFilter< TField, TField > Superclass;
00074 typedef SmartPointer< Self > Pointer;
00075 typedef SmartPointer< const Self > ConstPointer;
00076
00078 itkNewMacro(Self);
00079
00081 itkTypeMacro(LogDomainDeformableRegistrationFilter,
00082 DenseFiniteDifferenceImageFilter);
00083
00085 typedef TFixedImage FixedImageType;
00086 typedef typename FixedImageType::Pointer FixedImagePointer;
00087 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00088
00090 typedef TMovingImage MovingImageType;
00091 typedef typename MovingImageType::Pointer MovingImagePointer;
00092 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00093
00095 typedef TField VelocityFieldType;
00096 typedef typename VelocityFieldType::Pointer VelocityFieldPointer;
00097
00099 typedef TField DeformationFieldType;
00100 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00101
00103 typedef typename Superclass::OutputImageType OutputImageType;
00104
00106 typedef typename Superclass::FiniteDifferenceFunctionType
00107 FiniteDifferenceFunctionType;
00108
00110 typedef PDEDeformableRegistrationFunction< FixedImageType, MovingImageType,
00111 DeformationFieldType >
00112 PDEDeformableRegistrationFunctionType;
00113
00115 itkStaticConstMacro(ImageDimension, unsigned int,
00116 Superclass::ImageDimension);
00117
00119 void SetFixedImage(const FixedImageType *ptr);
00120
00122 const FixedImageType * GetFixedImage(void) const;
00123
00125 void SetMovingImage(const MovingImageType *ptr);
00126
00128 const MovingImageType * GetMovingImage(void) const;
00129
00131 void SetInitialVelocityField(VelocityFieldType *ptr)
00132 { this->SetInput(ptr); }
00133
00135 VelocityFieldType * GetVelocityField() { return this->GetOutput(); }
00136
00138 DeformationFieldPointer GetDeformationField();
00139
00141 DeformationFieldPointer GetInverseDeformationField();
00142
00147 virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const;
00148
00154 itkSetMacro(SmoothVelocityField, bool);
00155 itkGetConstMacro(SmoothVelocityField, bool);
00156 itkBooleanMacro(SmoothVelocityField);
00157
00161 itkSetVectorMacro(StandardDeviations, double, ImageDimension);
00162 virtual void SetStandardDeviations(double value);
00163
00166 const double * GetStandardDeviations(void) const
00167 { return static_cast< const double * >( m_StandardDeviations ); }
00168
00174 itkSetMacro(SmoothUpdateField, bool);
00175 itkGetConstMacro(SmoothUpdateField, bool);
00176 itkBooleanMacro(SmoothUpdateField);
00177
00180 itkSetVectorMacro(UpdateFieldStandardDeviations, double, ImageDimension);
00181 virtual void SetUpdateFieldStandardDeviations(double value);
00182
00185 const double * GetUpdateFieldStandardDeviations(void) const
00186 { return static_cast< const double * >( m_UpdateFieldStandardDeviations ); }
00187
00189 virtual void StopRegistration()
00190 {
00191 m_StopRegistrationFlag = true;
00192 }
00193
00196 itkSetMacro(MaximumError, double);
00197 itkGetConstMacro(MaximumError, double);
00198
00201 itkSetMacro(MaximumKernelWidth, unsigned int);
00202 itkGetConstMacro(MaximumKernelWidth, unsigned int);
00203
00208 virtual double GetMetric() const { return 0; }
00209 protected:
00210 LogDomainDeformableRegistrationFilter();
00211 ~LogDomainDeformableRegistrationFilter() {}
00212 void PrintSelf(std::ostream & os, Indent indent) const;
00213
00215 typedef ExponentialDeformationFieldImageFilter2<
00216 VelocityFieldType, DeformationFieldType > FieldExponentiatorType;
00217
00218 typedef typename FieldExponentiatorType::Pointer FieldExponentiatorPointer;
00219
00220 itkSetObjectMacro(Exponentiator, FieldExponentiatorType);
00221 itkGetObjectMacro(Exponentiator, FieldExponentiatorType);
00222
00225 virtual bool Halt()
00226 {
00227 if ( m_StopRegistrationFlag )
00228 {
00229 return true;
00230 }
00231
00232 return this->Superclass::Halt();
00233 }
00234
00237 virtual void CopyInputToOutput();
00238
00241 virtual void InitializeIteration();
00242
00246 virtual void SmoothVelocityField();
00247
00251 virtual void SmoothUpdateField();
00252
00256 virtual void SmoothGivenField(VelocityFieldType *field, const double StandardDeviations[ImageDimension]);
00257
00260 virtual void PostProcessOutput();
00261
00263 virtual void Initialize();
00264
00269 virtual void GenerateOutputInformation();
00270
00276 virtual void GenerateInputRequestedRegion();
00277
00278 private:
00279 LogDomainDeformableRegistrationFilter(const Self &);
00280
00281 void operator=(const Self &);
00282
00283
00284
00286 double m_StandardDeviations[ImageDimension];
00287 double m_UpdateFieldStandardDeviations[ImageDimension];
00288
00290 bool m_SmoothVelocityField;
00291 bool m_SmoothUpdateField;
00292
00294 VelocityFieldPointer m_TempField;
00295
00297 double m_MaximumError;
00298
00300 unsigned int m_MaximumKernelWidth;
00301
00303 bool m_StopRegistrationFlag;
00304
00305 FieldExponentiatorPointer m_Exponentiator;
00306 FieldExponentiatorPointer m_InverseExponentiator;
00307 };
00308 }
00309
00310 #ifndef ITK_MANUAL_INSTANTIATION
00311 # include "itkLogDomainDeformableRegistrationFilter.txx"
00312 #endif
00313
00314 #endif