00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMultiResolutionPDEDeformableRegistration_h
00018 #define __itkMultiResolutionPDEDeformableRegistration_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 #include "itkPDEDeformableRegistrationFilter.h"
00023 #include "itkDemonsRegistrationFilter.h"
00024 #include "itkMultiResolutionPyramidImageFilter.h"
00025 #include "itkVectorResampleImageFilter.h"
00026
00027 #include <vector>
00028
00029 namespace itk
00030 {
00075 template <class TFixedImage, class TMovingImage, class TDeformationField>
00076 class ITK_EXPORT MultiResolutionPDEDeformableRegistration :
00077 public ImageToImageFilter <TDeformationField, TDeformationField>
00078 {
00079 public:
00081 typedef MultiResolutionPDEDeformableRegistration Self;
00082 typedef ImageToImageFilter<TDeformationField, TDeformationField>
00083 Superclass;
00084 typedef SmartPointer<Self> Pointer;
00085 typedef SmartPointer<const Self> ConstPointer;
00086
00088 itkNewMacro(Self);
00089
00091 itkTypeMacro( MultiResolutionPDEDeformableRegistration,
00092 ImageToImageFilter );
00093
00095 typedef TFixedImage FixedImageType;
00096 typedef typename FixedImageType::Pointer FixedImagePointer;
00097 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00098
00100 typedef TMovingImage MovingImageType;
00101 typedef typename MovingImageType::Pointer MovingImagePointer;
00102 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00103
00105 typedef TDeformationField DeformationFieldType;
00106 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00107
00109 itkStaticConstMacro(ImageDimension, unsigned int,
00110 FixedImageType::ImageDimension);
00111
00113 typedef Image<float,itkGetStaticConstMacro(ImageDimension)> FloatImageType;
00114
00116 typedef PDEDeformableRegistrationFilter<
00117 FloatImageType, FloatImageType, DeformationFieldType > RegistrationType;
00118 typedef typename RegistrationType::Pointer RegistrationPointer;
00119
00121 typedef DemonsRegistrationFilter<
00122 FloatImageType, FloatImageType, DeformationFieldType > DefaultRegistrationType;
00123
00125 typedef MultiResolutionPyramidImageFilter<
00126 FixedImageType, FloatImageType > FixedImagePyramidType;
00127 typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
00128
00130 typedef MultiResolutionPyramidImageFilter<
00131 MovingImageType, FloatImageType > MovingImagePyramidType;
00132 typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
00133
00135 typedef VectorResampleImageFilter<
00136 DeformationFieldType, DeformationFieldType > FieldExpanderType;
00137 typedef typename FieldExpanderType::Pointer FieldExpanderPointer;
00138
00140 virtual void SetFixedImage( const FixedImageType * ptr );
00141
00143 const FixedImageType * GetFixedImage(void) const;
00144
00146 virtual void SetMovingImage( const MovingImageType * ptr );
00147
00149 const MovingImageType * GetMovingImage(void) const;
00150
00152 virtual void SetInitialDeformationField( DeformationFieldType * itkNotUsed(ptr) )
00153 {
00154 itkExceptionMacro( << "This feature not implemented yet" );
00155
00156 }
00157
00159 const DeformationFieldType * GetDeformationField(void)
00160 { return this->GetOutput(); }
00161
00168 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00169
00171 itkSetObjectMacro( RegistrationFilter, RegistrationType );
00172
00174 itkGetObjectMacro( RegistrationFilter, RegistrationType );
00175
00177 itkSetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00178
00180 itkGetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00181
00183 itkSetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00184
00186 itkGetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00187
00189 virtual void SetNumberOfLevels( unsigned int num );
00190
00192 itkGetConstReferenceMacro( NumberOfLevels, unsigned int );
00193
00195 itkGetConstReferenceMacro( CurrentLevel, unsigned int );
00196
00198 itkSetVectorMacro( NumberOfIterations, unsigned int, m_NumberOfLevels );
00199
00201 virtual const unsigned int * GetNumberOfIterations() const
00202 { return &(m_NumberOfIterations[0]); }
00203
00205 virtual void StopRegistration();
00206
00207 protected:
00208 MultiResolutionPDEDeformableRegistration();
00209 ~MultiResolutionPDEDeformableRegistration() {}
00210 void PrintSelf(std::ostream& os, Indent indent) const;
00211
00214 virtual void GenerateData();
00215
00219 virtual void GenerateInputRequestedRegion();
00220
00227 virtual void GenerateOutputInformation();
00228
00232 virtual void EnlargeOutputRequestedRegion( DataObject *ptr );
00233
00236 virtual bool Halt();
00237
00238 private:
00239 MultiResolutionPDEDeformableRegistration(const Self&);
00240 void operator=(const Self&);
00241
00242 RegistrationPointer m_RegistrationFilter;
00243 FixedImagePyramidPointer m_FixedImagePyramid;
00244 MovingImagePyramidPointer m_MovingImagePyramid;
00245 FieldExpanderPointer m_FieldExpander;
00246
00247 unsigned int m_NumberOfLevels;
00248 unsigned int m_CurrentLevel;
00249 std::vector<unsigned int> m_NumberOfIterations;
00250
00252 bool m_StopRegistrationFlag;
00253
00254 };
00255
00256
00257 }
00258
00259 #ifndef ITK_MANUAL_INSTANTIATION
00260 #include "itkMultiResolutionPDEDeformableRegistration.txx"
00261 #endif
00262
00263
00264 #endif