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 {
00076 template <class TFixedImage, class TMovingImage, class TDeformationField, class TRealType = float>
00077 class ITK_EXPORT MultiResolutionPDEDeformableRegistration :
00078 public ImageToImageFilter <TDeformationField, TDeformationField>
00079 {
00080 public:
00081
00083 typedef MultiResolutionPDEDeformableRegistration Self;
00084 typedef ImageToImageFilter<TDeformationField, TDeformationField>
00085 Superclass;
00086 typedef SmartPointer<Self> Pointer;
00087 typedef SmartPointer<const Self> ConstPointer;
00088
00090 itkNewMacro(Self);
00091
00093 itkTypeMacro( MultiResolutionPDEDeformableRegistration,
00094 ImageToImageFilter );
00095
00097 typedef TFixedImage FixedImageType;
00098 typedef typename FixedImageType::Pointer FixedImagePointer;
00099 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00100
00102 typedef TMovingImage MovingImageType;
00103 typedef typename MovingImageType::Pointer MovingImagePointer;
00104 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00105
00107 typedef TDeformationField DeformationFieldType;
00108 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00109
00111 itkStaticConstMacro(ImageDimension, unsigned int,
00112 FixedImageType::ImageDimension);
00113
00115 typedef Image<TRealType,itkGetStaticConstMacro(ImageDimension)> FloatImageType;
00116
00118 typedef PDEDeformableRegistrationFilter<
00119 FloatImageType, FloatImageType, DeformationFieldType > RegistrationType;
00120 typedef typename RegistrationType::Pointer RegistrationPointer;
00121
00123 typedef DemonsRegistrationFilter<
00124 FloatImageType, FloatImageType, DeformationFieldType > DefaultRegistrationType;
00125
00127 typedef MultiResolutionPyramidImageFilter<
00128 FixedImageType, FloatImageType > FixedImagePyramidType;
00129 typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
00130
00132 typedef MultiResolutionPyramidImageFilter<
00133 MovingImageType, FloatImageType > MovingImagePyramidType;
00134 typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
00135
00137 typedef VectorResampleImageFilter<
00138 DeformationFieldType, DeformationFieldType > FieldExpanderType;
00139 typedef typename FieldExpanderType::Pointer FieldExpanderPointer;
00140
00142 virtual void SetFixedImage( const FixedImageType * ptr );
00143
00145 const FixedImageType * GetFixedImage(void) const;
00146
00148 virtual void SetMovingImage( const MovingImageType * ptr );
00149
00151 const MovingImageType * GetMovingImage(void) const;
00152
00154 virtual void SetInitialDeformationField( DeformationFieldType * ptr )
00155 {
00156 this->m_InitialDeformationField=ptr;
00157
00158 }
00160
00162 const DeformationFieldType * GetDeformationField(void)
00163 { return this->GetOutput(); }
00164
00171 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00172
00174 itkSetObjectMacro( RegistrationFilter, RegistrationType );
00175
00177 itkGetObjectMacro( RegistrationFilter, RegistrationType );
00178
00180 itkSetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00181
00183 itkGetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00184
00186 itkSetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00187
00189 itkGetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00190
00192 virtual void SetNumberOfLevels( unsigned int num );
00193
00195 itkGetConstReferenceMacro( NumberOfLevels, unsigned int );
00196
00198 itkGetConstReferenceMacro( CurrentLevel, unsigned int );
00199
00201 itkSetVectorMacro( NumberOfIterations, unsigned int, m_NumberOfLevels );
00202
00204 virtual const unsigned int * GetNumberOfIterations() const
00205 { return &(m_NumberOfIterations[0]); }
00206
00208 virtual void StopRegistration();
00209
00210 protected:
00211 MultiResolutionPDEDeformableRegistration();
00212 ~MultiResolutionPDEDeformableRegistration() {}
00213 void PrintSelf(std::ostream& os, Indent indent) const;
00214
00217 virtual void GenerateData();
00218
00222 virtual void GenerateInputRequestedRegion();
00223
00230 virtual void GenerateOutputInformation();
00231
00235 virtual void EnlargeOutputRequestedRegion( DataObject *ptr );
00236
00239 virtual bool Halt();
00240
00241 private:
00242 MultiResolutionPDEDeformableRegistration(const Self&);
00243 void operator=(const Self&);
00244
00245 RegistrationPointer m_RegistrationFilter;
00246 FixedImagePyramidPointer m_FixedImagePyramid;
00247 MovingImagePyramidPointer m_MovingImagePyramid;
00248 FieldExpanderPointer m_FieldExpander;
00249 DeformationFieldPointer m_InitialDeformationField;
00250
00251 unsigned int m_NumberOfLevels;
00252 unsigned int m_CurrentLevel;
00253 std::vector<unsigned int> m_NumberOfIterations;
00254
00256 bool m_StopRegistrationFlag;
00257
00258 };
00259
00260
00261 }
00262
00263 #ifndef ITK_MANUAL_INSTANTIATION
00264 #include "itkMultiResolutionPDEDeformableRegistration.txx"
00265 #endif
00266
00267
00268 #endif
00269