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: 2005/09/29 22:43:38 $
00007   Version:   $Revision: 1.13 $
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   typedef Statistics::Histogram<double, 2> HistogramType;
00075   typedef typename HistogramType::MeasurementVectorType  MeasurementVectorType;
00076   typedef typename HistogramType::SizeType               HistogramSizeType;
00077   typedef typename HistogramType::Pointer                HistogramPointer;
00078 
00080   void Initialize() throw (ExceptionObject);
00081 
00084   itkSetMacro( HistogramSize, HistogramSizeType );
00085 
00087   itkGetConstReferenceMacro( HistogramSize, HistogramSizeType );
00088 
00091   itkSetMacro( UpperBoundIncreaseFactor, double );
00092   itkGetMacro( UpperBoundIncreaseFactor, double );
00093 
00095   itkSetMacro( PaddingValue, FixedImagePixelType );
00096 
00098   itkGetConstReferenceMacro( PaddingValue, FixedImagePixelType );
00099 
00103   itkGetConstReferenceMacro( Histogram, HistogramPointer );
00104   
00108   itkSetMacro( UsePaddingValue, bool );
00109   itkGetMacro( UsePaddingValue, bool );
00110 
00112   itkSetMacro( DerivativeStepLength, double );
00113 
00115   itkGetMacro( DerivativeStepLength, double );
00116 
00118   typedef Array<double> ScalesType;
00119 
00121   itkSetMacro( DerivativeStepLengthScales, ScalesType );
00122 
00124   itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00125 
00127   MeasureType GetValue(const TransformParametersType& parameters) const;
00128 
00130   void GetDerivative(const TransformParametersType & parameters,
00131                      DerivativeType & derivative) const;
00132 
00134   void GetValueAndDerivative(const TransformParametersType & parameters,
00135                              MeasureType& Value,
00136                              DerivativeType& Derivative) const;
00137 
00141   void SetLowerBound( const MeasurementVectorType & bound );
00142 
00146   void SetUpperBound( const MeasurementVectorType & bound );
00147 
00148 
00149 protected:
00152   HistogramImageToImageMetric();
00153   virtual ~HistogramImageToImageMetric() {};
00154 
00156   HistogramSizeType m_HistogramSize;
00158   mutable MeasurementVectorType m_LowerBound;
00160   mutable MeasurementVectorType m_UpperBound;
00162   double m_UpperBoundIncreaseFactor;
00163 
00166   bool m_LowerBoundSetByUser;
00167 
00170   bool m_UpperBoundSetByUser;
00171 
00174   void ComputeHistogram(const TransformParametersType & parameters,
00175                         HistogramType& histogram) const;
00178   void ComputeHistogram(const TransformParametersType & parameters,
00179                         unsigned int parameter,
00180                         double step,
00181                         HistogramType& histogram) const;
00185   void CopyHistogram(HistogramType& target, HistogramType& source) const;
00186 
00189   virtual MeasureType EvaluateMeasure(HistogramType& histogram) const = 0;
00190   
00192   void PrintSelf(std::ostream& os, Indent indent) const;
00193 
00194 private:
00195   HistogramImageToImageMetric(const Self&); //purposely not implemented
00196   void operator=(const Self&); //purposely not implemented
00197 
00199   FixedImagePixelType m_PaddingValue;
00200 
00204   bool m_UsePaddingValue;
00205 
00207   double m_DerivativeStepLength;
00208 
00210   ScalesType m_DerivativeStepLengthScales;
00211 
00214   HistogramPointer  m_Histogram;
00215   
00216 };
00217 
00218 } // end namespace itk
00219 
00220 #ifndef ITK_MANUAL_INSTANTIATION
00221 #include "itkHistogramImageToImageMetric.txx"
00222 #endif
00223 
00224 #endif // __itkHistogramImageToImageMetric_h

Generated at Wed May 24 23:16:20 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000