Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageToSpatialObjectMetric.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageToSpatialObjectMetric.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-24 20:02:56 $
00007   Version:   $Revision: 1.11 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkImageToSpatialObjectMetric_h
00018 #define __itkImageToSpatialObjectMetric_h
00019 
00020 #include "itkSingleValuedCostFunction.h"
00021 #include "itkMinimumMaximumImageCalculator.h"
00022 #include "itkLinearInterpolateImageFunction.h"
00023 #include "vnl/vnl_vector_fixed.h"
00024 
00025 namespace itk
00026 {
00027   
00058 template < class TFixedImage, class TMovingSpatialObject> 
00059 class ITK_EXPORT ImageToSpatialObjectMetric 
00060   : public SingleValuedCostFunction
00061 {
00062 public:
00063   typedef ImageToSpatialObjectMetric  Self;
00064   typedef SingleValuedCostFunction    Superclass;
00065   typedef SmartPointer<Self>          Pointer;
00066   typedef SmartPointer<const Self>    ConstPointer;
00067 
00069   typedef TFixedImage          FixedImageType;
00070 
00072   typedef TMovingSpatialObject  MovingSpatialObjectType;
00073 
00075   typedef Superclass::ParametersValueType CoordinateRepresentationType;
00076 
00078   itkStaticConstMacro(ImageDimension, unsigned int,
00079                       FixedImageType::ImageDimension);
00080 
00082   itkStaticConstMacro(ObjectDimension, unsigned int,
00083                       MovingSpatialObjectType::ObjectDimension);
00084 
00086   typedef Transform<CoordinateRepresentationType, 
00087                     itkGetStaticConstMacro(ObjectDimension),
00088                     itkGetStaticConstMacro(ImageDimension) > TransformType;
00089 
00090   typedef typename TransformType::Pointer            TransformPointer;
00091   typedef typename TransformType::InputPointType     InputPointType;
00092   typedef typename TransformType::OutputPointType    OutputPointType;
00093   typedef typename TransformType::ParametersType     TransformParametersType;
00094   typedef typename TransformType::JacobianType       TransformJacobianType;
00095 
00097   typedef LinearInterpolateImageFunction<
00098     TFixedImage,
00099     CoordinateRepresentationType > InterpolatorType;
00100 
00101   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
00102 
00104   typedef vnl_vector_fixed<double,
00105                            itkGetStaticConstMacro(ObjectDimension)> VectorType;
00106 
00108   typedef Superclass::MeasureType          MeasureType;
00109 
00111   typedef Superclass::DerivativeType   DerivativeType; 
00112 
00114   typedef typename FixedImageType::Pointer    FixedImagePointer;
00115 
00117   typedef typename MovingSpatialObjectType::Pointer  
00118   MovingSpatialObjectPointer;
00119 
00121   typedef typename FixedImageType::ConstPointer   FixedImageConstPointer;
00122 
00124   typedef typename MovingSpatialObjectType::ConstPointer MovingSpatialObjectConstPointer;
00125 
00128   typedef Superclass::ParametersType         ParametersType;
00129 
00131   itkTypeMacro(ImageToSpatialObjectMetric, Object);
00132 
00134   itkSetConstObjectMacro( FixedImage, FixedImageType );
00135 
00137   itkGetConstObjectMacro( FixedImage, FixedImageType );
00138 
00140   itkSetConstObjectMacro( MovingSpatialObject, MovingSpatialObjectType );
00141 
00143   itkGetConstObjectMacro( MovingSpatialObject, MovingSpatialObjectType );
00144 
00146   itkSetObjectMacro( Interpolator, InterpolatorType );
00147 
00149   itkGetObjectMacro( Interpolator, InterpolatorType );
00150 
00152   virtual void GetDerivative( const ParametersType & parameters,
00153                               DerivativeType & derivative ) const = 0;
00154 
00156   virtual MeasureType    GetValue( const ParametersType & parameters ) const =0;
00157 
00159   virtual void GetValueAndDerivative( const ParametersType & parameters,
00160                                       MeasureType & Value, 
00161                                       DerivativeType  & Derivative ) const =0;
00162 
00164   virtual void Initialize(void) throw (ExceptionObject);
00165 
00168   itkGetConstReferenceMacro( LastTransformParameters, ParametersType );
00169 
00171   itkSetObjectMacro( Transform, TransformType );
00172 
00173 protected:
00174 
00175   ImageToSpatialObjectMetric();
00176   virtual ~ImageToSpatialObjectMetric() {};
00177   ImageToSpatialObjectMetric(const Self&) {}
00178   void operator=(const Self&) {}
00179   void PrintSelf(std::ostream& os, Indent indent) const;
00180 
00181   MeasureType                 m_MatchMeasure;
00182   DerivativeType              m_MatchMeasureDerivatives;
00183   mutable TransformPointer    m_Transform;
00184   InterpolatorPointer         m_Interpolator;
00185 
00186   MovingSpatialObjectConstPointer   m_MovingSpatialObject;
00187   FixedImageConstPointer            m_FixedImage;
00188   ParametersType                    m_LastTransformParameters;
00189 
00190 };
00191 
00192 } // end namespace itk
00193 
00194 #ifndef ITK_MANUAL_INSTANTIATION
00195 #include "itkImageToSpatialObjectMetric.txx"
00196 #endif
00197 
00198 #endif
00199 

Generated at Mon Jul 12 2010 18:48:44 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000