ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageRegistrationMethod.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 __itkImageRegistrationMethod_h
00019 #define __itkImageRegistrationMethod_h
00020 
00021 #include "itkProcessObject.h"
00022 #include "itkImage.h"
00023 #include "itkImageToImageMetric.h"
00024 #include "itkSingleValuedNonLinearOptimizer.h"
00025 #include "itkDataObjectDecorator.h"
00026 
00027 namespace itk
00028 {
00069 template< typename TFixedImage, typename TMovingImage >
00070 class ITK_EXPORT ImageRegistrationMethod:public ProcessObject
00071 {
00072 public:
00074   typedef ImageRegistrationMethod    Self;
00075   typedef ProcessObject              Superclass;
00076   typedef SmartPointer< Self >       Pointer;
00077   typedef SmartPointer< const Self > ConstPointer;
00078 
00080   itkNewMacro(Self);
00081 
00083   itkTypeMacro(ImageRegistrationMethod, ProcessObject);
00084 
00086   typedef          TFixedImage                  FixedImageType;
00087   typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00088 
00090   typedef          TMovingImage                  MovingImageType;
00091   typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
00092 
00094   typedef ImageToImageMetric< FixedImageType, MovingImageType > MetricType;
00095   typedef typename MetricType::Pointer                          MetricPointer;
00096   typedef typename MetricType::FixedImageRegionType             FixedImageRegionType;
00097 
00099   typedef  typename MetricType::TransformType TransformType;
00100   typedef  typename TransformType::Pointer    TransformPointer;
00101 
00104   typedef  DataObjectDecorator< TransformType >      TransformOutputType;
00105   typedef typename TransformOutputType::Pointer      TransformOutputPointer;
00106   typedef typename TransformOutputType::ConstPointer TransformOutputConstPointer;
00107 
00109   typedef  typename MetricType::InterpolatorType InterpolatorType;
00110   typedef  typename InterpolatorType::Pointer    InterpolatorPointer;
00111 
00113   typedef   SingleValuedNonLinearOptimizer OptimizerType;
00114 
00117   typedef  typename MetricType::TransformParametersType ParametersType;
00118 
00120   typedef typename DataObject::Pointer DataObjectPointer;
00121 
00123   void SetFixedImage(const FixedImageType *fixedImage);
00124 
00125   itkGetConstObjectMacro(FixedImage, FixedImageType);
00126 
00128   void SetMovingImage(const MovingImageType *movingImage);
00129 
00130   itkGetConstObjectMacro(MovingImage, MovingImageType);
00131 
00133   itkSetObjectMacro(Optimizer,  OptimizerType);
00134   itkGetObjectMacro(Optimizer,  OptimizerType);
00136 
00138   itkSetObjectMacro(Metric, MetricType);
00139   itkGetObjectMacro(Metric, MetricType);
00141 
00143   itkSetObjectMacro(Transform, TransformType);
00144   itkGetObjectMacro(Transform, TransformType);
00146 
00148   itkSetObjectMacro(Interpolator, InterpolatorType);
00149   itkGetObjectMacro(Interpolator, InterpolatorType);
00151 
00153   virtual void SetInitialTransformParameters(const ParametersType & param);
00154 
00155   itkGetConstReferenceMacro(InitialTransformParameters, ParametersType);
00156 
00159   itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
00160 
00168   void SetFixedImageRegion(const FixedImageRegionType & region);
00169 
00174   itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
00175 
00178   itkGetConstMacro(FixedImageRegionDefined, bool);
00179 
00184   itkSetMacro(FixedImageRegionDefined, bool);
00185 
00187   virtual void Initialize()
00188   throw ( ExceptionObject );
00189 
00191   const TransformOutputType * GetOutput() const;
00192 
00195   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00196   using Superclass::MakeOutput;
00197   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00198 
00201   unsigned long GetMTime() const;
00202 
00203 protected:
00204   ImageRegistrationMethod();
00205   virtual ~ImageRegistrationMethod() {}
00206   void PrintSelf(std::ostream & os, Indent indent) const;
00209   void  GenerateData();
00210 
00212   itkSetMacro(LastTransformParameters, ParametersType);
00213 #ifdef ITKV3_COMPATIBILITY
00214 public:
00215 #else
00216 protected:
00217 #endif
00218 
00234   void StartRegistration(void);
00235 
00241   void StartOptimization(void);
00242 
00243 private:
00244   ImageRegistrationMethod(const Self &); //purposely not implemented
00245   void operator=(const Self &);          //purposely not implemented
00246 
00247   MetricPointer          m_Metric;
00248   OptimizerType::Pointer m_Optimizer;
00249 
00250   MovingImageConstPointer m_MovingImage;
00251   FixedImageConstPointer  m_FixedImage;
00252 
00253   TransformPointer    m_Transform;
00254   InterpolatorPointer m_Interpolator;
00255 
00256   ParametersType m_InitialTransformParameters;
00257   ParametersType m_LastTransformParameters;
00258 
00259   bool                 m_FixedImageRegionDefined;
00260   FixedImageRegionType m_FixedImageRegion;
00261 };
00262 } // end namespace itk
00263 
00264 #ifndef ITK_MANUAL_INSTANTIATION
00265 #include "itkImageRegistrationMethod.hxx"
00266 #endif
00267 
00268 #endif
00269