00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMultiResolutionImageRegistrationMethod_h
00018 #define __itkMultiResolutionImageRegistrationMethod_h
00019
00020 #include "itkProcessObject.h"
00021 #include "itkImageToImageMetric.h"
00022 #include "itkSingleValuedNonLinearOptimizer.h"
00023 #include "itkMultiResolutionPyramidImageFilter.h"
00024 #include "itkNumericTraits.h"
00025 #include "itkDataObjectDecorator.h"
00026
00027 namespace itk
00028 {
00029
00066 template <typename TFixedImage, typename TMovingImage>
00067 class ITK_EXPORT MultiResolutionImageRegistrationMethod : public ProcessObject
00068 {
00069 public:
00071 typedef MultiResolutionImageRegistrationMethod Self;
00072 typedef ProcessObject Superclass;
00073 typedef SmartPointer<Self> Pointer;
00074 typedef SmartPointer<const Self> ConstPointer;
00075
00077 itkNewMacro(Self);
00078
00080 itkTypeMacro(MultiResolutionImageRegistrationMethod, ProcessObject);
00081
00083 typedef TFixedImage FixedImageType;
00084 typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00085 typedef typename FixedImageType::RegionType FixedImageRegionType;
00086
00088 typedef TMovingImage MovingImageType;
00089 typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00090
00092 typedef ImageToImageMetric< FixedImageType,
00093 MovingImageType > MetricType;
00094 typedef typename MetricType::Pointer MetricPointer;
00095
00097 typedef typename MetricType::TransformType TransformType;
00098 typedef typename TransformType::Pointer TransformPointer;
00099
00102 typedef DataObjectDecorator< TransformType > TransformOutputType;
00103 typedef typename TransformOutputType::Pointer TransformOutputPointer;
00104 typedef typename TransformOutputType::ConstPointer TransformOutputConstPointer;
00105
00107 typedef typename MetricType::InterpolatorType InterpolatorType;
00108 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00109
00111 typedef SingleValuedNonLinearOptimizer OptimizerType;
00112
00114 typedef MultiResolutionPyramidImageFilter< FixedImageType,
00115 FixedImageType >
00116 FixedImagePyramidType;
00117 typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
00118
00120 typedef MultiResolutionPyramidImageFilter< MovingImageType,
00121 MovingImageType >
00122 MovingImagePyramidType;
00123 typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
00124
00127 typedef typename MetricType::TransformParametersType ParametersType;
00128
00130 typedef typename DataObject::Pointer DataObjectPointer;
00131
00133 void StartRegistration();
00134
00136 void StopRegistration();
00137
00139 itkSetConstObjectMacro( FixedImage, FixedImageType );
00140 itkGetConstObjectMacro( FixedImage, FixedImageType );
00142
00144 itkSetConstObjectMacro( MovingImage, MovingImageType );
00145 itkGetConstObjectMacro( MovingImage, MovingImageType );
00147
00149 itkSetObjectMacro( Optimizer, OptimizerType );
00150 itkGetObjectMacro( Optimizer, OptimizerType );
00152
00154 itkSetObjectMacro( Metric, MetricType );
00155 itkGetObjectMacro( Metric, MetricType );
00157
00159 itkSetMacro( FixedImageRegion, FixedImageRegionType );
00160 itkGetConstReferenceMacro( FixedImageRegion, FixedImageRegionType );
00162
00164 itkSetObjectMacro( Transform, TransformType );
00165 itkGetObjectMacro( Transform, TransformType );
00167
00169 itkSetObjectMacro( Interpolator, InterpolatorType );
00170 itkGetObjectMacro( Interpolator, InterpolatorType );
00172
00174 itkSetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00175 itkGetObjectMacro( FixedImagePyramid, FixedImagePyramidType );
00177
00179 itkSetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00180 itkGetObjectMacro( MovingImagePyramid, MovingImagePyramidType );
00182
00184 itkSetClampMacro( NumberOfLevels, unsigned long, 1,
00185 NumericTraits<unsigned long>::max() );
00186 itkGetMacro( NumberOfLevels, unsigned long );
00188
00190 itkGetMacro( CurrentLevel, unsigned long );
00191
00193 itkSetMacro( InitialTransformParameters, ParametersType );
00194 itkGetConstReferenceMacro( InitialTransformParameters, ParametersType );
00196
00200 itkSetMacro( InitialTransformParametersOfNextLevel, ParametersType );
00201 itkGetConstReferenceMacro( InitialTransformParametersOfNextLevel, ParametersType );
00203
00206 itkGetConstReferenceMacro( LastTransformParameters, ParametersType );
00207
00209 const TransformOutputType * GetOutput() const;
00210
00213 virtual DataObjectPointer MakeOutput(unsigned int idx);
00214
00217 unsigned long GetMTime() const;
00218
00219 protected:
00220 MultiResolutionImageRegistrationMethod();
00221 virtual ~MultiResolutionImageRegistrationMethod() {};
00222 void PrintSelf(std::ostream& os, Indent indent) const;
00223
00226 void GenerateData ();
00227
00232 void Initialize() throw (ExceptionObject);
00233
00235 void PreparePyramids( void );
00236
00238 itkSetMacro( CurrentLevel, unsigned long );
00239
00240 private:
00241 MultiResolutionImageRegistrationMethod(const Self&);
00242 void operator=(const Self&);
00243
00244 MetricPointer m_Metric;
00245 OptimizerType::Pointer m_Optimizer;
00246
00247 MovingImageConstPointer m_MovingImage;
00248 FixedImageConstPointer m_FixedImage;
00249
00250 TransformPointer m_Transform;
00251 InterpolatorPointer m_Interpolator;
00252
00253 MovingImagePyramidPointer m_MovingImagePyramid;
00254 FixedImagePyramidPointer m_FixedImagePyramid;
00255
00256 ParametersType m_InitialTransformParameters;
00257 ParametersType m_InitialTransformParametersOfNextLevel;
00258 ParametersType m_LastTransformParameters;
00259
00260 FixedImageRegionType m_FixedImageRegion;
00261 std::vector<FixedImageRegionType> m_FixedImageRegionPyramid;
00262
00263 unsigned long m_NumberOfLevels;
00264 unsigned long m_CurrentLevel;
00265
00266 bool m_Stop;
00267
00268 };
00269
00270
00271 }
00272
00273
00274 #ifndef ITK_MANUAL_INSTANTIATION
00275 #include "itkMultiResolutionImageRegistrationMethod.txx"
00276 #endif
00277
00278 #endif
00279
00280
00281
00282