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

itkGradientDifferenceImageToImageMetric.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientDifferenceImageToImageMetric.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/12/31 12:40:37 $ 00007 Version: $Revision: 1.4 $ 00008 00009 Copyright (c) 2002 Insight 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 __itkGradientDifferenceImageToImageMetric_h 00018 #define __itkGradientDifferenceImageToImageMetric_h 00019 00020 #include "itkImageToImageMetric.h" 00021 00022 #include "itkPoint.h" 00023 #include "itkCastImageFilter.h" 00024 #include "itkResampleImageFilter.h" 00025 #include "itkSobelOperator.h" 00026 #include "itkNeighborhoodOperatorImageFilter.h" 00027 00028 00029 namespace itk 00030 { 00049 template < class TFixedImage, class TMovingImage > 00050 class ITK_EXPORT GradientDifferenceImageToImageMetric : 00051 public ImageToImageMetric< TFixedImage, TMovingImage> 00052 { 00053 public: 00054 00056 typedef GradientDifferenceImageToImageMetric Self; 00057 typedef ImageToImageMetric<TFixedImage, TMovingImage > Superclass; 00058 00059 typedef SmartPointer<Self> Pointer; 00060 typedef SmartPointer<const Self> ConstPointer; 00061 00063 itkNewMacro(Self); 00064 00066 itkTypeMacro(GradientDifferenceImageToImageMetric, ImageToImageMetric); 00067 00068 00070 typedef typename Superclass::RealType RealType; 00071 typedef typename Superclass::TransformType TransformType; 00072 typedef typename Superclass::TransformPointer TransformPointer; 00073 typedef typename Superclass::TransformParametersType TransformParametersType; 00074 typedef typename Superclass::TransformJacobianType TransformJacobianType; 00075 00076 typedef typename Superclass::MeasureType MeasureType; 00077 typedef typename Superclass::DerivativeType DerivativeType; 00078 typedef typename Superclass::FixedImageType FixedImageType; 00079 typedef typename Superclass::MovingImageType MovingImageType; 00080 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer; 00081 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer; 00082 00083 typedef typename TFixedImage::PixelType FixedImagePixelType; 00084 typedef typename TMovingImage::PixelType MovedImagePixelType; 00085 00086 itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension); 00088 typedef itk::Image< FixedImagePixelType, 00089 itkGetStaticConstMacro( FixedImageDimension ) > 00090 TransformedMovingImageType; 00091 00092 typedef itk::ResampleImageFilter< MovingImageType, TransformedMovingImageType > 00093 TransformMovingImageFilterType; 00094 00097 typedef itk::Image< RealType, 00098 itkGetStaticConstMacro( FixedImageDimension ) > 00099 FixedGradientImageType; 00100 00101 typedef itk::CastImageFilter< FixedImageType, FixedGradientImageType > 00102 CastFixedImageFilterType; 00103 00104 typedef typename FixedGradientImageType::PixelType FixedGradientPixelType; 00105 00106 00109 itkStaticConstMacro( MovedImageDimension, unsigned int, 00110 MovingImageType::ImageDimension ); 00111 00112 typedef itk::Image< RealType, 00113 itkGetStaticConstMacro( MovedImageDimension ) > 00114 MovedGradientImageType; 00115 00116 typedef itk::CastImageFilter< TransformedMovingImageType, MovedGradientImageType > 00117 CastMovedImageFilterType; 00118 00119 typedef typename MovedGradientImageType::PixelType MovedGradientPixelType; 00120 00121 00122 #if 0 00123 00124 itkGetConstObjectMacro( FixedGradientImage, FixedGradientImageType::Pointer ); 00126 itkGetConstObjectMacro( MovedGradientImage, MovedGradientImageType::Pointer ); 00127 #endif 00128 00130 void GetDerivative( const TransformParametersType & parameters, 00131 DerivativeType & derivative ) const; 00132 00134 MeasureType GetValue( const TransformParametersType & parameters ) const; 00135 00137 void GetValueAndDerivative( const TransformParametersType & parameters, 00138 MeasureType& Value, DerivativeType& derivative ) const; 00139 00142 virtual void Initialize(void) throw ( ExceptionObject ); 00143 00145 void WriteGradientImagesToFiles(void) const; 00146 00147 protected: 00148 GradientDifferenceImageToImageMetric(); 00149 virtual ~GradientDifferenceImageToImageMetric() {}; 00150 void PrintSelf(std::ostream& os, Indent indent) const; 00151 00153 void ComputeMovedGradientRange( void ) const; 00154 00156 void ComputeVariance( void ) const; 00157 00159 MeasureType ComputeMeasure( const TransformParametersType &parameters, 00160 const double *subtractionFactor ) const; 00161 00162 typedef NeighborhoodOperatorImageFilter< 00163 FixedGradientImageType, FixedGradientImageType > FixedSobelFilter; 00164 00165 typedef NeighborhoodOperatorImageFilter< 00166 MovedGradientImageType, MovedGradientImageType > MovedSobelFilter; 00167 00168 private: 00169 GradientDifferenceImageToImageMetric(const Self&); //purposely not implemented 00170 void operator=(const Self&); //purposely not implemented 00171 00173 mutable MovedGradientPixelType m_Variance[FixedImageDimension]; 00174 00176 mutable MovedGradientPixelType m_MinMovedGradient[MovedImageDimension]; 00177 mutable MovedGradientPixelType m_MaxMovedGradient[MovedImageDimension]; 00179 mutable FixedGradientPixelType m_MinFixedGradient[FixedImageDimension]; 00180 mutable FixedGradientPixelType m_MaxFixedGradient[FixedImageDimension]; 00181 00183 typename TransformMovingImageFilterType::Pointer m_TransformMovingImageFilter; 00184 00187 typename TransformedMovingImageType::Pointer m_MovedImage; 00188 00190 typename FixedGradientImageType::Pointer 00191 m_FixedGradientImage[itkGetStaticConstMacro( FixedImageDimension )]; 00192 00194 typename MovedGradientImageType::Pointer 00195 m_MovedGradientImage[itkGetStaticConstMacro( MovedImageDimension )]; 00196 00197 00199 CastFixedImageFilterType m_CastFixedImageFilter; 00200 00201 SobelOperator< FixedGradientPixelType, 00202 itkGetStaticConstMacro(FixedImageDimension) > 00203 m_FixedSobelOperators[FixedImageDimension]; 00204 FixedSobelFilter m_FixedSobelFilters[FixedImageDimension]; 00205 00206 00208 CastMovedImageFilterType m_CastMovedImageFilter; 00209 00210 SobelOperator< MovedGradientPixelType, 00211 itkGetStaticConstMacro(MovedImageDimension) > 00212 m_MovedSobelOperators[MovedImageDimension]; 00213 MovedSobelFilter m_MovedSobelFilters[MovedImageDimension]; 00214 00215 }; 00216 00217 } // end namespace itk 00218 00219 #ifndef ITK_MANUAL_INSTANTIATION 00220 #include "itkGradientDifferenceImageToImageMetric.txx" 00221 #endif 00222 00223 #endif 00224 00225 00226

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