00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkPDEDeformableRegistrationFilter_h
00018 #define __itkPDEDeformableRegistrationFilter_h
00019
00020 #include "itkDenseFiniteDifferenceImageFilter.h"
00021 #include "itkPDEDeformableRegistrationFunction.h"
00022
00023 namespace itk {
00024
00070 template<class TFixedImage, class TMovingImage, class TDeformationField>
00071 class ITK_EXPORT PDEDeformableRegistrationFilter :
00072 public DenseFiniteDifferenceImageFilter<TDeformationField,TDeformationField>
00073 {
00074 public:
00075
00077 typedef PDEDeformableRegistrationFilter Self;
00078 typedef DenseFiniteDifferenceImageFilter<
00079 TDeformationField,TDeformationField> Superclass;
00080 typedef SmartPointer<Self> Pointer;
00081 typedef SmartPointer<const Self> ConstPointer;
00082
00084 itkNewMacro(Self);
00085
00087 itkTypeMacro( PDEDeformableRegistrationFilter,
00088 DenseFiniteDifferenceImageFilter );
00089
00091 typedef TFixedImage FixedImageType;
00092 typedef typename FixedImageType::Pointer FixedImagePointer;
00093 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00094
00096 typedef TMovingImage MovingImageType;
00097 typedef typename MovingImageType::Pointer MovingImagePointer;
00098 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00099
00101 typedef TDeformationField DeformationFieldType;
00102 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00103
00105 typedef typename Superclass::OutputImageType OutputImageType;
00106
00108 typedef typename Superclass::FiniteDifferenceFunctionType
00109 FiniteDifferenceFunctionType;
00110
00112 typedef PDEDeformableRegistrationFunction<FixedImageType,MovingImageType,
00113 DeformationFieldType> PDEDeformableRegistrationFunctionType;
00114
00116 itkStaticConstMacro(ImageDimension, unsigned int,
00117 Superclass::ImageDimension);
00118
00120 void SetFixedImage( const FixedImageType * ptr );
00121
00123 const FixedImageType * GetFixedImage(void) const;
00124
00126 void SetMovingImage( const MovingImageType * ptr );
00127
00129 const MovingImageType * GetMovingImage(void) const;
00130
00132 void SetInitialDeformationField( DeformationFieldType * ptr )
00133 { this->SetInput( ptr ); }
00134
00136 DeformationFieldType * GetDeformationField()
00137 { return this->GetOutput(); }
00138
00144 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00145
00151 itkSetMacro( SmoothDeformationField, bool );
00152 itkGetConstMacro( SmoothDeformationField, bool );
00153 itkBooleanMacro( SmoothDeformationField );
00155
00159 itkSetVectorMacro( StandardDeviations, double, ImageDimension );
00160 virtual void SetStandardDeviations( double value );
00162
00165 const double * GetStandardDeviations(void)
00166 { return (double *) m_StandardDeviations; }
00167
00173 itkSetMacro( SmoothUpdateField, bool );
00174 itkGetConstMacro( SmoothUpdateField, bool );
00175 itkBooleanMacro( SmoothUpdateField );
00177
00180 itkSetVectorMacro( UpdateFieldStandardDeviations, double, ImageDimension );
00181 virtual void SetUpdateFieldStandardDeviations( double value );
00183
00186 const double * GetUpdateFieldStandardDeviations(void)
00187 { return (double *) m_UpdateFieldStandardDeviations; }
00188
00189
00190
00192 virtual void StopRegistration()
00193 { m_StopRegistrationFlag = true; }
00194
00197 itkSetMacro( MaximumError, double );
00198 itkGetConstMacro( MaximumError, double );
00200
00203 itkSetMacro( MaximumKernelWidth, unsigned int );
00204 itkGetConstMacro( MaximumKernelWidth, unsigned int );
00206
00207
00208 protected:
00209 PDEDeformableRegistrationFilter();
00210 ~PDEDeformableRegistrationFilter() {}
00211 void PrintSelf(std::ostream& os, Indent indent) const;
00212
00215 virtual bool Halt()
00216 {
00217
00218 if ( m_StopRegistrationFlag )
00219 {
00220 return true;
00221 }
00222
00223 return this->Superclass::Halt();
00224 }
00225
00228 virtual void CopyInputToOutput();
00229
00232 virtual void InitializeIteration();
00233
00237 virtual void SmoothDeformationField();
00238
00242 virtual void SmoothUpdateField();
00243
00246 virtual void PostProcessOutput();
00247
00249 virtual void Initialize();
00250
00255 virtual void GenerateOutputInformation();
00256
00263 virtual void GenerateInputRequestedRegion();
00264
00265 private:
00266 PDEDeformableRegistrationFilter(const Self&);
00267 void operator=(const Self&);
00268
00270 double m_StandardDeviations[ImageDimension];
00271 double m_UpdateFieldStandardDeviations[ImageDimension];
00272
00274 bool m_SmoothDeformationField;
00275 bool m_SmoothUpdateField;
00276
00277
00280 DeformationFieldPointer m_TempField;
00281
00282 private:
00284 double m_MaximumError;
00285
00287 unsigned int m_MaximumKernelWidth;
00288
00290 bool m_StopRegistrationFlag;
00291
00292 };
00293
00294
00295 }
00296
00297 #ifndef ITK_MANUAL_INSTANTIATION
00298 #include "itkPDEDeformableRegistrationFilter.txx"
00299 #endif
00300
00301 #endif
00302