ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkMultiResolutionImageRegistrationMethod.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkMultiResolutionImageRegistrationMethod_h
00019 #define __itkMultiResolutionImageRegistrationMethod_h
00020 
00021 #include "itkProcessObject.h"
00022 #include "itkImageToImageMetric.h"
00023 #include "itkSingleValuedNonLinearOptimizer.h"
00024 #include "itkMultiResolutionPyramidImageFilter.h"
00025 #include "itkNumericTraits.h"
00026 #include "itkDataObjectDecorator.h"
00027 
00028 namespace itk
00029 {
00071 template< typename TFixedImage, typename TMovingImage >
00072 class ITK_EXPORT MultiResolutionImageRegistrationMethod:public ProcessObject
00073 {
00074 public:
00076   typedef MultiResolutionImageRegistrationMethod Self;
00077   typedef ProcessObject                          Superclass;
00078   typedef SmartPointer< Self >                   Pointer;
00079   typedef SmartPointer< const Self >             ConstPointer;
00080 
00082   itkNewMacro(Self);
00083 
00085   itkTypeMacro(MultiResolutionImageRegistrationMethod, ProcessObject);
00086 
00088   typedef          TFixedImage                  FixedImageType;
00089   typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00090   typedef typename FixedImageType::RegionType   FixedImageRegionType;
00091 
00093   typedef          TMovingImage                  MovingImageType;
00094   typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00095 
00097   typedef ImageToImageMetric< FixedImageType, MovingImageType > MetricType;
00098   typedef typename MetricType::Pointer                          MetricPointer;
00099 
00101   typedef typename MetricType::TransformType TransformType;
00102   typedef typename TransformType::Pointer    TransformPointer;
00103 
00106   typedef  DataObjectDecorator< TransformType >      TransformOutputType;
00107   typedef typename TransformOutputType::Pointer      TransformOutputPointer;
00108   typedef typename TransformOutputType::ConstPointer TransformOutputConstPointer;
00109 
00111   typedef typename MetricType::InterpolatorType InterpolatorType;
00112   typedef typename InterpolatorType::Pointer    InterpolatorPointer;
00113 
00115   typedef SingleValuedNonLinearOptimizer OptimizerType;
00116 
00118   typedef MultiResolutionPyramidImageFilter< FixedImageType, FixedImageType > FixedImagePyramidType;
00119   typedef typename FixedImagePyramidType::Pointer                             FixedImagePyramidPointer;
00120 
00122   typedef typename FixedImagePyramidType::ScheduleType ScheduleType;
00123 
00125   typedef MultiResolutionPyramidImageFilter< MovingImageType, MovingImageType > MovingImagePyramidType;
00126   typedef typename MovingImagePyramidType::Pointer                              MovingImagePyramidPointer;
00127 
00130   typedef  typename MetricType::TransformParametersType ParametersType;
00131 
00133   typedef typename DataObject::Pointer DataObjectPointer;
00134 
00136   void StartRegistration();
00137 
00139   void StopRegistration();
00140 
00142   itkSetConstObjectMacro(FixedImage, FixedImageType);
00143   itkGetConstObjectMacro(FixedImage, FixedImageType);
00145 
00147   itkSetConstObjectMacro(MovingImage, MovingImageType);
00148   itkGetConstObjectMacro(MovingImage, MovingImageType);
00150 
00152   itkSetObjectMacro(Optimizer,  OptimizerType);
00153   itkGetObjectMacro(Optimizer,  OptimizerType);
00155 
00157   itkSetObjectMacro(Metric, MetricType);
00158   itkGetObjectMacro(Metric, MetricType);
00160 
00162   itkSetMacro(FixedImageRegion, FixedImageRegionType);
00163   itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
00165 
00167   itkSetObjectMacro(Transform, TransformType);
00168   itkGetObjectMacro(Transform, TransformType);
00170 
00172   itkSetObjectMacro(Interpolator, InterpolatorType);
00173   itkGetObjectMacro(Interpolator, InterpolatorType);
00175 
00177   itkSetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
00178   itkGetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
00180 
00182   itkSetObjectMacro(MovingImagePyramid, MovingImagePyramidType);
00183   itkGetObjectMacro(MovingImagePyramid, MovingImagePyramidType);
00185 
00187   void SetSchedules(const ScheduleType & fixedSchedule,
00188                     const ScheduleType & movingSchedule);
00189 
00190   itkGetConstMacro(FixedImagePyramidSchedule, ScheduleType);
00191   itkGetConstMacro(MovingImagePyramidSchedule, ScheduleType);
00192 
00194   void SetNumberOfLevels(SizeValueType numberOfLevels);
00195 
00196   itkGetConstMacro(NumberOfLevels, SizeValueType);
00197 
00199   itkGetConstMacro(CurrentLevel, SizeValueType);
00200 
00202   itkSetMacro(InitialTransformParameters, ParametersType);
00203   itkGetConstReferenceMacro(InitialTransformParameters, ParametersType);
00205 
00209   itkSetMacro(InitialTransformParametersOfNextLevel, ParametersType);
00210   itkGetConstReferenceMacro(InitialTransformParametersOfNextLevel, ParametersType);
00212 
00215   itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
00216 
00218   const TransformOutputType * GetOutput() const;
00219 
00222   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00223   using Superclass::MakeOutput;
00224   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00225 
00228   unsigned long GetMTime() const;
00229 
00230 protected:
00231   MultiResolutionImageRegistrationMethod();
00232   virtual ~MultiResolutionImageRegistrationMethod() {}
00233   void PrintSelf(std::ostream & os, Indent indent) const;
00234 
00237   void  GenerateData();
00238 
00243   void Initialize()
00244   throw ( ExceptionObject );
00245 
00247   void PreparePyramids(void);
00248 
00250   itkSetMacro(CurrentLevel, SizeValueType);
00251 private:
00252   MultiResolutionImageRegistrationMethod(const Self &); //purposely not
00253                                                         // implemented
00254   void operator=(const Self &);                         //purposely not
00256 
00257   // implemented
00258 
00259   MetricPointer          m_Metric;
00260   OptimizerType::Pointer m_Optimizer;
00261 
00262   MovingImageConstPointer m_MovingImage;
00263   FixedImageConstPointer  m_FixedImage;
00264 
00265   TransformPointer    m_Transform;
00266   InterpolatorPointer m_Interpolator;
00267 
00268   MovingImagePyramidPointer m_MovingImagePyramid;
00269   FixedImagePyramidPointer  m_FixedImagePyramid;
00270 
00271   ParametersType m_InitialTransformParameters;
00272   ParametersType m_InitialTransformParametersOfNextLevel;
00273   ParametersType m_LastTransformParameters;
00274 
00275   FixedImageRegionType                m_FixedImageRegion;
00276   std::vector< FixedImageRegionType > m_FixedImageRegionPyramid;
00277 
00278   SizeValueType m_NumberOfLevels;
00279   SizeValueType m_CurrentLevel;
00280 
00281   bool m_Stop;
00282 
00283   ScheduleType m_FixedImagePyramidSchedule;
00284   ScheduleType m_MovingImagePyramidSchedule;
00285 
00286   bool m_ScheduleSpecified;
00287   bool m_NumberOfLevelsSpecified;
00288 };
00289 } // end namespace itk
00290 
00291 #ifndef ITK_MANUAL_INSTANTIATION
00292 #include "itkMultiResolutionImageRegistrationMethod.hxx"
00293 #endif
00294 
00295 #endif
00296