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

itkImageToImageMetric.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageToImageMetric.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/10/09 21:11:27 $ 00007 Version: $Revision: 1.19 $ 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 __itkImageToImageMetric_h 00018 #define __itkImageToImageMetric_h 00019 00020 #include "itkImageBase.h" 00021 #include "itkTransform.h" 00022 #include "itkInterpolateImageFunction.h" 00023 #include "itkSingleValuedCostFunction.h" 00024 #include "itkExceptionObject.h" 00025 #include "itkGradientRecursiveGaussianImageFilter.h" 00026 #include "itkSpatialObject.h" 00027 00028 namespace itk 00029 { 00030 00050 template <class TFixedImage, class TMovingImage> 00051 class ITK_EXPORT ImageToImageMetric : public SingleValuedCostFunction 00052 { 00053 public: 00055 typedef ImageToImageMetric Self; 00056 typedef SingleValuedCostFunction Superclass; 00057 typedef SmartPointer<Self> Pointer; 00058 typedef SmartPointer<const Self> ConstPointer; 00059 00061 typedef Superclass::ParametersValueType CoordinateRepresentationType; 00062 00064 itkTypeMacro(ImageToImageMetric, SingleValuedCostFunction); 00065 00067 typedef TMovingImage MovingImageType; 00068 typedef typename TMovingImage::PixelType MovingImagePixelType; 00069 typedef typename MovingImageType::ConstPointer MovingImageConstPointer; 00070 00072 typedef TFixedImage FixedImageType; 00073 typedef typename FixedImageType::ConstPointer FixedImageConstPointer; 00074 typedef typename FixedImageType::RegionType FixedImageRegionType; 00075 00077 itkStaticConstMacro(MovingImageDimension, unsigned int, 00078 TMovingImage::ImageDimension); 00079 itkStaticConstMacro(FixedImageDimension, unsigned int, 00080 TFixedImage::ImageDimension); 00081 00083 typedef Transform<CoordinateRepresentationType, 00084 itkGetStaticConstMacro(MovingImageDimension), 00085 itkGetStaticConstMacro(FixedImageDimension)> TransformType; 00086 00087 typedef typename TransformType::Pointer TransformPointer; 00088 typedef typename TransformType::InputPointType InputPointType; 00089 typedef typename TransformType::OutputPointType OutputPointType; 00090 typedef typename TransformType::ParametersType TransformParametersType; 00091 typedef typename TransformType::JacobianType TransformJacobianType; 00092 00094 typedef InterpolateImageFunction< 00095 MovingImageType, 00096 CoordinateRepresentationType > InterpolatorType; 00097 00098 00100 typedef typename NumericTraits<MovingImagePixelType>::RealType RealType; 00101 typedef CovariantVector<RealType, 00102 itkGetStaticConstMacro(MovingImageDimension)> GradientPixelType; 00103 typedef Image<GradientPixelType, 00104 itkGetStaticConstMacro(MovingImageDimension)> GradientImageType; 00105 typedef SmartPointer<GradientImageType> GradientImagePointer; 00106 typedef GradientRecursiveGaussianImageFilter< MovingImageType, 00107 GradientImageType > 00108 GradientImageFilterType; 00109 typedef typename GradientImageFilterType::Pointer GradientImageFilterPointer; 00110 00111 00112 typedef typename InterpolatorType::Pointer InterpolatorPointer; 00113 00114 00115 00118 typedef SpatialObject< itkGetStaticConstMacro(FixedImageDimension) 00119 > FixedImageMaskType; 00120 typedef typename FixedImageMaskType::Pointer FixedImageMaskPointer; 00121 00124 typedef SpatialObject< itkGetStaticConstMacro(MovingImageDimension) 00125 > MovingImageMaskType; 00126 typedef typename MovingImageMaskType::Pointer MovingImageMaskPointer; 00127 00128 00129 00131 typedef Superclass::MeasureType MeasureType; 00132 00134 typedef Superclass::DerivativeType DerivativeType; 00135 00137 typedef Superclass::ParametersType ParametersType; 00138 00140 itkSetConstObjectMacro( FixedImage, FixedImageType ); 00141 00143 itkGetConstObjectMacro( FixedImage, FixedImageType ); 00144 00146 itkSetConstObjectMacro( MovingImage, MovingImageType ); 00147 00149 itkGetConstObjectMacro( MovingImage, MovingImageType ); 00150 00152 itkSetObjectMacro( Transform, TransformType ); 00153 00155 itkGetObjectMacro( Transform, TransformType ); 00156 00158 itkSetObjectMacro( Interpolator, InterpolatorType ); 00159 00161 itkGetObjectMacro( Interpolator, InterpolatorType ); 00162 00164 itkGetConstMacro( NumberOfPixelsCounted, unsigned long ); 00165 00167 itkSetMacro( FixedImageRegion, FixedImageRegionType ); 00168 00170 itkGetConstMacro( FixedImageRegion, FixedImageRegionType ); 00171 00173 itkSetObjectMacro( MovingImageMask, MovingImageMaskType ); 00174 itkGetObjectMacro( MovingImageMask, MovingImageMaskType ); 00175 00177 itkSetObjectMacro( FixedImageMask, FixedImageMaskType ); 00178 itkGetObjectMacro( FixedImageMask, FixedImageMaskType ); 00179 00180 00182 void SetTransformParameters( const ParametersType & parameters ) const; 00183 00185 unsigned int GetNumberOfParameters(void) const 00186 { return m_Transform->GetNumberOfParameters(); } 00187 00190 virtual void Initialize(void) throw ( ExceptionObject ); 00191 00192 protected: 00193 ImageToImageMetric(); 00194 virtual ~ImageToImageMetric() {}; 00195 void PrintSelf(std::ostream& os, Indent indent) const; 00196 00197 mutable unsigned long m_NumberOfPixelsCounted; 00198 00199 FixedImageConstPointer m_FixedImage; 00200 MovingImageConstPointer m_MovingImage; 00201 00202 mutable TransformPointer m_Transform; 00203 InterpolatorPointer m_Interpolator; 00204 00205 bool m_ComputeGradient; 00206 GradientImagePointer m_GradientImage; 00207 00208 mutable FixedImageMaskPointer m_FixedImageMask; 00209 mutable MovingImageMaskPointer m_MovingImageMask; 00210 00211 private: 00212 ImageToImageMetric(const Self&); //purposely not implemented 00213 void operator=(const Self&); //purposely not implemented 00214 00215 FixedImageRegionType m_FixedImageRegion; 00216 00217 00218 }; 00219 00220 } // end namespace itk 00221 00222 #ifndef ITK_MANUAL_INSTANTIATION 00223 #include "itkImageToImageMetric.txx" 00224 #endif 00225 00226 #endif 00227 00228 00229

Generated at Sun Apr 1 02:35:48 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000