ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkImageToSpatialObjectRegistrationMethod.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 __itkImageToSpatialObjectRegistrationMethod_h
00019 #define __itkImageToSpatialObjectRegistrationMethod_h
00020 
00021 #include "itkProcessObject.h"
00022 #include "itkImage.h"
00023 #include "itkImageToSpatialObjectMetric.h"
00024 #include "itkSingleValuedNonLinearOptimizer.h"
00025 #include "itkDataObjectDecorator.h"
00026 
00027 namespace itk
00028 {
00084 template< typename TFixedImage, typename TMovingSpatialObject >
00085 class ITK_EXPORT ImageToSpatialObjectRegistrationMethod:public ProcessObject
00086 {
00087 public:
00089   typedef ImageToSpatialObjectRegistrationMethod Self;
00090   typedef ProcessObject                          Superclass;
00091   typedef SmartPointer< Self >                   Pointer;
00092   typedef SmartPointer< const Self >             ConstPointer;
00093 
00095   itkNewMacro(Self);
00096 
00098   itkTypeMacro(ImageToSpatialObjectRegistrationMethod, ProcessObject);
00099 
00101   typedef          TFixedImage                  FixedImageType;
00102   typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
00103 
00105   typedef TMovingSpatialObject MovingSpatialObjectType;
00106   typedef typename MovingSpatialObjectType::ConstPointer
00107   MovingSpatialObjectConstPointer;
00108 
00110   typedef ImageToSpatialObjectMetric< FixedImageType,
00111                                       MovingSpatialObjectType >     MetricType;
00112   typedef typename MetricType::Pointer MetricPointer;
00113 
00115   typedef  typename MetricType::TransformType TransformType;
00116   typedef  typename TransformType::Pointer    TransformPointer;
00117 
00120   typedef  DataObjectDecorator< TransformType >      TransformOutputType;
00121   typedef typename TransformOutputType::Pointer      TransformOutputPointer;
00122   typedef typename TransformOutputType::ConstPointer TransformOutputConstPointer;
00123 
00125   typedef  typename MetricType::InterpolatorType InterpolatorType;
00126   typedef  typename InterpolatorType::Pointer    InterpolatorPointer;
00127 
00129   typedef   SingleValuedNonLinearOptimizer OptimizerType;
00130 
00133   typedef  typename MetricType::TransformParametersType ParametersType;
00134 
00136   typedef typename DataObject::Pointer DataObjectPointer;
00137 
00139   void StartRegistration(void);
00140 
00142   itkSetConstObjectMacro(FixedImage, FixedImageType);
00143   itkGetConstObjectMacro(FixedImage, FixedImageType);
00145 
00147   itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
00148   itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
00150 
00152   itkSetObjectMacro(Optimizer,  OptimizerType);
00153   itkGetObjectMacro(Optimizer,  OptimizerType);
00155 
00157   itkSetObjectMacro(Metric, MetricType);
00158   itkGetObjectMacro(Metric, MetricType);
00160 
00162   itkSetObjectMacro(Transform, TransformType);
00163   itkGetObjectMacro(Transform, TransformType);
00165 
00167   itkSetObjectMacro(Interpolator, InterpolatorType);
00168   itkGetObjectMacro(Interpolator, InterpolatorType);
00170 
00172   itkSetMacro(InitialTransformParameters, ParametersType);
00173   itkGetConstReferenceMacro(InitialTransformParameters, ParametersType);
00175 
00178   itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
00179 
00181   const TransformOutputType * GetOutput() const;
00182 
00185   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00186   using Superclass::MakeOutput;
00187   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00188 
00191   unsigned long GetMTime() const;
00192 
00193 protected:
00194   ImageToSpatialObjectRegistrationMethod();
00195   virtual ~ImageToSpatialObjectRegistrationMethod() {}
00196   void PrintSelf(std::ostream & os, Indent indent) const;
00197 
00200   void  GenerateData();
00201 
00203   void Initialize()
00204   throw ( ExceptionObject );
00205 
00206   ParametersType m_InitialTransformParameters;
00207   ParametersType m_LastTransformParameters;
00208 private:
00209   ImageToSpatialObjectRegistrationMethod(const Self &); //purposely not
00210                                                         // implemented
00211   void operator=(const Self &);                         //purposely not
00212                                                         // implemented
00213 
00214   MetricPointer          m_Metric;
00215   OptimizerType::Pointer m_Optimizer;
00216 
00217   MovingSpatialObjectConstPointer m_MovingSpatialObject;
00218   FixedImageConstPointer          m_FixedImage;
00219 
00220   TransformPointer    m_Transform;
00221   InterpolatorPointer m_Interpolator;
00222 };
00223 } // end namespace itk
00224 
00225 #ifndef ITK_MANUAL_INSTANTIATION
00226 #include "itkImageToSpatialObjectRegistrationMethod.hxx"
00227 #endif
00228 
00229 #endif
00230