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:
00080
00082 typedef MultiResolutionPDEDeformableRegistration Self;
00083 typedef ImageToImageFilter<TDeformationField, TDeformationField>
00084 Superclass;
00085 typedef SmartPointer<Self> Pointer;
00086 typedef SmartPointer<const Self> ConstPointer;
00087
00089 itkNewMacro(Self);
00090
00092 itkTypeMacro( MultiResolutionPDEDeformableRegistration,
00093 ImageToImageFilter );
00094
00096 typedef TFixedImage FixedImageType;
00097 typedef typename FixedImageType::Pointer FixedImagePointer;
00098 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00099
00101 typedef TMovingImage MovingImageType;
00102 typedef typename MovingImageType::Pointer MovingImagePointer;
00103 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00104
00106 typedef TDeformationField DeformationFieldType;
00107 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00108
00110 itkStaticConstMacro(ImageDimension, unsigned int,
00111 FixedImageType::ImageDimension);
00112
00114 typedef Image<float,itkGetStaticConstMacro(ImageDimension)> FloatImageType;
00115
00117 typedef PDEDeformableRegistrationFilter<
00118 FloatImageType, FloatImageType, DeformationFieldType > RegistrationType;
00119 typedef typename RegistrationType::Pointer RegistrationPointer;
00120
00122 typedef DemonsRegistrationFilter<
00123 FloatImageType, FloatImageType, DeformationFieldType > DefaultRegistrationType;
00124
00126 typedef MultiResolutionPyramidImageFilter<
00127 FixedImageType, FloatImageType > FixedImagePyramidType;
00128 typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
00129
00131 typedef MultiResolutionPyramidImageFilter<
00132 MovingImageType, FloatImageType > MovingImagePyramidType;
00133 typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
00134
00136 typedef VectorResampleImageFilter<
00137 DeformationFieldType, DeformationFieldType > FieldExpanderType;
00138 typedef typename FieldExpanderType::Pointer FieldExpanderPointer;
00139
00141 virtual void SetFixedImage( const FixedImageType * ptr );
00142
00144 const FixedImageType * GetFixedImage(void) const;
00145
00147 virtual void SetMovingImage( const MovingImageType * ptr );
00148
00150 const MovingImageType * GetMovingImage(void) const;
00151
00153 virtual void SetInitialDeformationField( DeformationFieldType * itkNotUsed(ptr) )
00154 {
00155 itkExceptionMacro( << "This feature not implemented yet" );
00156
00157 }
00159
00161 const DeformationFieldType * GetDeformationField(void)
00162 { return this->GetOutput(); }
00163
00170 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00171
00173 itkSetObjectMacro( RegistrationFilter, RegistrationType );
00174
00176 itkGetObjectMacro( RegistrationFilter, RegistrationType );
00177
00179 itkSetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00180
00182 itkGetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00183
00185 itkSetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00186
00188 itkGetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00189
00191 virtual void SetNumberOfLevels( unsigned int num );
00192
00194 itkGetConstReferenceMacro( NumberOfLevels, unsigned int );
00195
00197 itkGetConstReferenceMacro( CurrentLevel, unsigned int );
00198
00200 itkSetVectorMacro( NumberOfIterations, unsigned int, m_NumberOfLevels );
00201
00203 virtual const unsigned int * GetNumberOfIterations() const
00204 { return &(m_NumberOfIterations[0]); }
00205
00207 virtual void StopRegistration();
00208
00209 protected:
00210 MultiResolutionPDEDeformableRegistration();
00211 ~MultiResolutionPDEDeformableRegistration() {}
00212 void PrintSelf(std::ostream& os, Indent indent) const;
00213
00216 virtual void GenerateData();
00217
00221 virtual void GenerateInputRequestedRegion();
00222
00229 virtual void GenerateOutputInformation();
00230
00234 virtual void EnlargeOutputRequestedRegion( DataObject *ptr );
00235
00238 virtual bool Halt();
00239
00240 private:
00241 MultiResolutionPDEDeformableRegistration(const Self&);
00242 void operator=(const Self&);
00243
00244 RegistrationPointer m_RegistrationFilter;
00245 FixedImagePyramidPointer m_FixedImagePyramid;
00246 MovingImagePyramidPointer m_MovingImagePyramid;
00247 FieldExpanderPointer m_FieldExpander;
00248
00249 unsigned int m_NumberOfLevels;
00250 unsigned int m_CurrentLevel;
00251 std::vector<unsigned int> m_NumberOfIterations;
00252
00254 bool m_StopRegistrationFlag;
00255
00256 };
00257
00258
00259 }
00260
00261 #ifndef ITK_MANUAL_INSTANTIATION
00262 #include "itkMultiResolutionPDEDeformableRegistration.txx"
00263 #endif
00264
00265
00266 #endif
00267