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:
00076 typedef PDEDeformableRegistrationFilter Self;
00077 typedef DenseFiniteDifferenceImageFilter<
00078 TDeformationField,TDeformationField> Superclass;
00079 typedef SmartPointer<Self> Pointer;
00080 typedef SmartPointer<const Self> ConstPointer;
00081
00083 itkNewMacro(Self);
00084
00086 itkTypeMacro( PDEDeformableRegistrationFilter,
00087 DenseFiniteDifferenceImageFilter );
00088
00090 typedef TFixedImage FixedImageType;
00091 typedef typename FixedImageType::Pointer FixedImagePointer;
00092 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00093
00095 typedef TMovingImage MovingImageType;
00096 typedef typename MovingImageType::Pointer MovingImagePointer;
00097 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00098
00100 typedef TDeformationField DeformationFieldType;
00101 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00102
00104 typedef typename Superclass::OutputImageType OutputImageType;
00105
00107 typedef typename Superclass::FiniteDifferenceFunctionType
00108 FiniteDifferenceFunctionType;
00109
00111 typedef PDEDeformableRegistrationFunction<FixedImageType,MovingImageType,
00112 DeformationFieldType> 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 SetInitialDeformationField( DeformationFieldType * ptr )
00132 { this->SetInput( ptr ); }
00133
00135 DeformationFieldType * GetDeformationField()
00136 { return this->GetOutput(); }
00137
00143 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00144
00150 itkSetMacro( SmoothDeformationField, bool );
00151 itkGetMacro( SmoothDeformationField, bool );
00152 itkBooleanMacro( SmoothDeformationField );
00153
00157 itkSetVectorMacro( StandardDeviations, double, ImageDimension );
00158 virtual void SetStandardDeviations( double value );
00159
00162 const double * GetStandardDeviations(void)
00163 { return (double *) m_StandardDeviations; }
00164
00170 itkSetMacro( SmoothUpdateField, bool );
00171 itkGetMacro( SmoothUpdateField, bool );
00172 itkBooleanMacro( SmoothUpdateField );
00173
00176 itkSetVectorMacro( UpdateFieldStandardDeviations, double, ImageDimension );
00177 virtual void SetUpdateFieldStandardDeviations( double value );
00178
00181 const double * GetUpdateFieldStandardDeviations(void)
00182 { return (double *) m_UpdateFieldStandardDeviations; }
00183
00184
00185
00187 virtual void StopRegistration()
00188 { m_StopRegistrationFlag = true; }
00189
00192 itkSetMacro( MaximumError, double );
00193 itkGetMacro( MaximumError, double );
00194
00197 itkSetMacro( MaximumKernelWidth, unsigned int );
00198 itkGetMacro( MaximumKernelWidth, unsigned int );
00199
00200
00201 protected:
00202 PDEDeformableRegistrationFilter();
00203 ~PDEDeformableRegistrationFilter() {}
00204 void PrintSelf(std::ostream& os, Indent indent) const;
00205
00208 virtual bool Halt()
00209 {
00210
00211 if ( m_StopRegistrationFlag )
00212 {
00213 return true;
00214 }
00215
00216 return this->Superclass::Halt();
00217 }
00218
00221 virtual void CopyInputToOutput();
00222
00225 virtual void InitializeIteration();
00226
00230 virtual void SmoothDeformationField();
00231
00235 virtual void SmoothUpdateField();
00236
00239 virtual void PostProcessOutput();
00240
00242 virtual void Initialize();
00243
00248 virtual void GenerateOutputInformation();
00249
00256 virtual void GenerateInputRequestedRegion();
00257
00258 private:
00259 PDEDeformableRegistrationFilter(const Self&);
00260 void operator=(const Self&);
00261
00263 double m_StandardDeviations[ImageDimension];
00264 double m_UpdateFieldStandardDeviations[ImageDimension];
00265
00267 bool m_SmoothDeformationField;
00268 bool m_SmoothUpdateField;
00269
00270
00273 DeformationFieldPointer m_TempField;
00274
00275 private:
00277 double m_MaximumError;
00278
00280 unsigned int m_MaximumKernelWidth;
00281
00283 bool m_StopRegistrationFlag;
00284
00285 };
00286
00287
00288 }
00289
00290 #ifndef ITK_MANUAL_INSTANTIATION
00291 #include "itkPDEDeformableRegistrationFilter.txx"
00292 #endif
00293
00294 #endif