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 {
00081 template <class TFixedImage, class TMovingImage, class TDeformationField, class TRealType = float>
00082 class ITK_EXPORT MultiResolutionPDEDeformableRegistration :
00083 public ImageToImageFilter <TDeformationField, TDeformationField>
00084 {
00085 public:
00086
00088 typedef MultiResolutionPDEDeformableRegistration Self;
00089 typedef ImageToImageFilter<TDeformationField, TDeformationField>
00090 Superclass;
00091 typedef SmartPointer<Self> Pointer;
00092 typedef SmartPointer<const Self> ConstPointer;
00093
00095 itkNewMacro(Self);
00096
00098 itkTypeMacro( MultiResolutionPDEDeformableRegistration,
00099 ImageToImageFilter );
00100
00102 typedef TFixedImage FixedImageType;
00103 typedef typename FixedImageType::Pointer FixedImagePointer;
00104 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00105
00107 typedef TMovingImage MovingImageType;
00108 typedef typename MovingImageType::Pointer MovingImagePointer;
00109 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00110
00112 typedef TDeformationField DeformationFieldType;
00113 typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
00114
00116 itkStaticConstMacro(ImageDimension, unsigned int,
00117 FixedImageType::ImageDimension);
00118
00120 typedef Image<TRealType,itkGetStaticConstMacro(ImageDimension)> FloatImageType;
00121
00123 typedef PDEDeformableRegistrationFilter<
00124 FloatImageType, FloatImageType, DeformationFieldType > RegistrationType;
00125 typedef typename RegistrationType::Pointer RegistrationPointer;
00126
00128 typedef DemonsRegistrationFilter<
00129 FloatImageType, FloatImageType, DeformationFieldType > DefaultRegistrationType;
00130
00132 typedef MultiResolutionPyramidImageFilter<
00133 FixedImageType, FloatImageType > FixedImagePyramidType;
00134 typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
00135
00137 typedef MultiResolutionPyramidImageFilter<
00138 MovingImageType, FloatImageType > MovingImagePyramidType;
00139 typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
00140
00142 typedef VectorResampleImageFilter<
00143 DeformationFieldType, DeformationFieldType > FieldExpanderType;
00144 typedef typename FieldExpanderType::Pointer FieldExpanderPointer;
00145
00147 virtual void SetFixedImage( const FixedImageType * ptr );
00148
00150 const FixedImageType * GetFixedImage(void) const;
00151
00153 virtual void SetMovingImage( const MovingImageType * ptr );
00154
00156 const MovingImageType * GetMovingImage(void) const;
00157
00160 virtual void SetInitialDeformationField( DeformationFieldType * ptr )
00161 {
00162 this->m_InitialDeformationField=ptr;
00163 }
00164
00168 virtual void SetArbitraryInitialDeformationField( DeformationFieldType * ptr )
00169 {
00170 this->SetInput( ptr );
00171 }
00172
00174 const DeformationFieldType * GetDeformationField(void)
00175 { return this->GetOutput(); }
00176
00183 virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const;
00184
00186 itkSetObjectMacro( RegistrationFilter, RegistrationType );
00187
00189 itkGetObjectMacro( RegistrationFilter, RegistrationType );
00190
00192 itkSetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00193
00195 itkGetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00196
00198 itkSetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00199
00201 itkGetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00202
00204 virtual void SetNumberOfLevels( unsigned int num );
00205
00207 itkGetConstReferenceMacro( NumberOfLevels, unsigned int );
00208
00210 itkGetConstReferenceMacro( CurrentLevel, unsigned int );
00211
00213 itkSetVectorMacro( NumberOfIterations, unsigned int, m_NumberOfLevels );
00214
00216 itkSetObjectMacro( FieldExpander, FieldExpanderType );
00217
00219 itkGetObjectMacro( FieldExpander, FieldExpanderType );
00220
00222 virtual const unsigned int * GetNumberOfIterations() const
00223 { return &(m_NumberOfIterations[0]); }
00224
00226 virtual void StopRegistration();
00227
00228 protected:
00229 MultiResolutionPDEDeformableRegistration();
00230 ~MultiResolutionPDEDeformableRegistration() {}
00231 void PrintSelf(std::ostream& os, Indent indent) const;
00232
00235 virtual void GenerateData();
00236
00240 virtual void GenerateInputRequestedRegion();
00241
00248 virtual void GenerateOutputInformation();
00249
00253 virtual void EnlargeOutputRequestedRegion( DataObject *ptr );
00254
00257 virtual bool Halt();
00258
00259 private:
00260 MultiResolutionPDEDeformableRegistration(const Self&);
00261 void operator=(const Self&);
00262
00263 RegistrationPointer m_RegistrationFilter;
00264 FixedImagePyramidPointer m_FixedImagePyramid;
00265 MovingImagePyramidPointer m_MovingImagePyramid;
00266 FieldExpanderPointer m_FieldExpander;
00267 DeformationFieldPointer m_InitialDeformationField;
00268
00269 unsigned int m_NumberOfLevels;
00270 unsigned int m_CurrentLevel;
00271 std::vector<unsigned int> m_NumberOfIterations;
00272
00274 bool m_StopRegistrationFlag;
00275
00276 };
00277
00278
00279 }
00280
00281 #ifndef ITK_MANUAL_INSTANTIATION
00282 #include "itkMultiResolutionPDEDeformableRegistration.txx"
00283 #endif
00284
00285
00286 #endif
00287