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

itkHistogramImageToImageMetric.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkHistogramImageToImageMetric.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-05-02 05:43:54 $
00007   Version:   $Revision: 1.17 $
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 __itkHistogramImageToImageMetric_h
00018 #define __itkHistogramImageToImageMetric_h
00019 
00020 #include "itkHistogram.h"
00021 #include "itkImageToImageMetric.h"
00022 
00023 namespace itk
00024 {
00035 template <class TFixedImage, class TMovingImage>
00036 class ITK_EXPORT HistogramImageToImageMetric : 
00037 public ImageToImageMetric<TFixedImage, TMovingImage>
00038 {
00039 public:
00041   typedef HistogramImageToImageMetric                   Self;
00042   typedef ImageToImageMetric<TFixedImage, TMovingImage> Superclass;
00043   typedef SmartPointer<Self>                            Pointer;
00044   typedef SmartPointer<const Self>                      ConstPointer;
00045 
00047   itkTypeMacro(HistogramImageToImageMetric, ImageToImageMetric);
00048 
00050   typedef typename Superclass::RealType                   RealType;
00051   typedef typename Superclass::TransformType              TransformType;
00052   typedef typename Superclass::TransformPointer           TransformPointer;
00053   typedef typename Superclass::TransformParametersType
00054                                                           TransformParametersType;
00055   typedef typename Superclass::TransformJacobianType
00056                                                           TransformJacobianType;
00057   typedef typename Superclass::GradientPixelType          GradientPixelType;
00058   typedef typename Superclass::InputPointType             InputPointType;
00059   typedef typename Superclass::OutputPointType            OutputPointType;
00060   typedef typename Superclass::MeasureType                MeasureType;
00061   typedef typename Superclass::DerivativeType             DerivativeType;
00062   typedef typename Superclass::FixedImageType             FixedImageType;
00063   typedef typename Superclass::FixedImageType::PixelType  FixedImagePixelType;
00064   typedef typename Superclass::MovingImageType            MovingImageType;
00065   typedef typename Superclass::MovingImageType::PixelType MovingImagePixelType;
00066   typedef typename Superclass::FixedImageConstPointer
00067                                                           FixedImageConstPointerType;
00068   typedef typename Superclass::MovingImageConstPointer
00069                                                           MovingImageConstPointerType;
00070 
00074 #ifdef ITK_USE_REVIEW_STATISTICS
00075   typedef Statistics::Histogram<double>                  HistogramType;
00076 #else
00077   typedef Statistics::Histogram<double, 2>               HistogramType;
00078 #endif
00079 
00080   typedef typename HistogramType::MeasurementVectorType  MeasurementVectorType;
00081   typedef typename HistogramType::SizeType               HistogramSizeType;
00082   typedef typename HistogramType::Pointer                HistogramPointer;
00083 
00085   void Initialize() throw (ExceptionObject);
00086 
00089   void SetTransform( TransformType * transform );
00090 
00093   itkSetMacro( HistogramSize, HistogramSizeType );
00094 
00096   itkGetConstReferenceMacro( HistogramSize, HistogramSizeType );
00097 
00100   itkSetMacro( UpperBoundIncreaseFactor, double );
00101   itkGetConstMacro( UpperBoundIncreaseFactor, double );
00103 
00105   itkSetMacro( PaddingValue, FixedImagePixelType );
00106 
00108   itkGetConstReferenceMacro( PaddingValue, FixedImagePixelType );
00109 
00113   itkGetConstReferenceMacro( Histogram, HistogramPointer );
00114 
00118   itkSetMacro( UsePaddingValue, bool );
00119   itkGetConstMacro( UsePaddingValue, bool );
00121 
00123   itkSetMacro( DerivativeStepLength, double );
00124 
00126   itkGetConstMacro( DerivativeStepLength, double );
00127 
00129   typedef Array<double> ScalesType;
00130 
00132   itkSetMacro( DerivativeStepLengthScales, ScalesType );
00133 
00135   itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00136 
00138   MeasureType GetValue(const TransformParametersType& parameters) const;
00139 
00141   void GetDerivative(const TransformParametersType & parameters,
00142                      DerivativeType & derivative) const;
00143 
00145   void GetValueAndDerivative(const TransformParametersType & parameters,
00146                              MeasureType& Value,
00147                              DerivativeType& Derivative) const;
00148 
00152   void SetLowerBound( const MeasurementVectorType & bound );
00153 
00157   void SetUpperBound( const MeasurementVectorType & bound );
00158 
00159 
00160 protected:
00163   HistogramImageToImageMetric();
00164   virtual ~HistogramImageToImageMetric() {};
00166 
00168   HistogramSizeType m_HistogramSize;
00169 
00171   mutable MeasurementVectorType m_LowerBound;
00172 
00174   mutable MeasurementVectorType m_UpperBound;
00175 
00177   double m_UpperBoundIncreaseFactor;
00178 
00181   bool m_LowerBoundSetByUser;
00182 
00185   bool m_UpperBoundSetByUser;
00186 
00189   void ComputeHistogram(const TransformParametersType & parameters,
00190                         HistogramType& histogram) const;
00191 
00194   void ComputeHistogram(const TransformParametersType & parameters,
00195                         unsigned int parameter,
00196                         double step,
00197                         HistogramType& histogram) const;
00198 
00200   void CopyHistogram(HistogramType& target, HistogramType& source) const;
00201 
00204   virtual MeasureType EvaluateMeasure(HistogramType& histogram) const = 0;
00205 
00207   void PrintSelf(std::ostream& os, Indent indent) const;
00208 
00209 private:
00210   HistogramImageToImageMetric(const Self&); //purposely not implemented
00211   void operator=(const Self&); //purposely not implemented
00212 
00214   FixedImagePixelType m_PaddingValue;
00215 
00219   bool m_UsePaddingValue;
00220 
00222   double m_DerivativeStepLength;
00223 
00225   ScalesType m_DerivativeStepLengthScales;
00226 
00229   HistogramPointer  m_Histogram;
00230 
00231 };
00232 
00233 } // end namespace itk
00234 
00235 #ifndef ITK_MANUAL_INSTANTIATION
00236 #include "itkHistogramImageToImageMetric.txx"
00237 #endif
00238 
00239 #endif // __itkHistogramImageToImageMetric_h
00240 

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