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: 2003/12/11 20:03:29 $
00007   Version:   $Revision: 1.9 $
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   itkNewMacro(Self);
00048  
00050   itkTypeMacro(HistogramImageToImageMetric, ImageToImageMetric);
00051  
00053   typedef typename Superclass::RealType                   RealType;
00054   typedef typename Superclass::TransformType              TransformType;
00055   typedef typename Superclass::TransformPointer           TransformPointer;
00056   typedef typename Superclass::TransformParametersType
00057     TransformParametersType;
00058   typedef typename Superclass::TransformJacobianType
00059     TransformJacobianType;
00060   typedef typename Superclass::GradientPixelType          GradientPixelType;
00061   typedef typename Superclass::InputPointType             InputPointType;
00062   typedef typename Superclass::OutputPointType            OutputPointType;
00063   typedef typename Superclass::MeasureType                MeasureType;
00064   typedef typename Superclass::DerivativeType             DerivativeType;
00065   typedef typename Superclass::FixedImageType             FixedImageType;
00066   typedef typename Superclass::FixedImageType::PixelType  FixedImagePixelType;
00067   typedef typename Superclass::MovingImageType            MovingImageType;
00068   typedef typename Superclass::MovingImageType::PixelType MovingImagePixelType;
00069   typedef typename Superclass::FixedImageConstPointer
00070     FixedImageConstPointerType;
00071   typedef typename Superclass::MovingImageConstPointer
00072     MovingImageConstPointerType;
00073 
00077   typedef Statistics::Histogram<double, 2> HistogramType;
00078   typedef typename HistogramType::MeasurementVectorType  MeasurementVectorType;
00079   typedef typename HistogramType::SizeType               HistogramSizeType;
00080 
00082   void Initialize() throw (ExceptionObject);
00083 
00086   itkSetMacro( HistogramSize, HistogramSizeType );
00087 
00089   itkGetConstReferenceMacro( HistogramSize, HistogramSizeType );
00090 
00093   itkSetMacro( UpperBoundIncreaseFactor, double );
00094   itkGetMacro( UpperBoundIncreaseFactor, double );
00095 
00097   itkSetMacro( PaddingValue, FixedImagePixelType );
00098 
00100   itkGetConstReferenceMacro( PaddingValue, FixedImagePixelType );
00101 
00105   itkSetMacro( UsePaddingValue, bool );
00106   itkGetMacro( UsePaddingValue, bool );
00107 
00109   itkSetMacro( DerivativeStepLength, double );
00110 
00112   itkGetMacro( DerivativeStepLength, double );
00113 
00115   typedef Array<double> ScalesType;
00116 
00118   itkSetMacro( DerivativeStepLengthScales, ScalesType );
00119 
00121   itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00122 
00124   MeasureType GetValue(const TransformParametersType& parameters) const;
00125 
00127   void GetDerivative(const TransformParametersType & parameters,
00128                      DerivativeType & derivative) const;
00129 
00131   void GetValueAndDerivative(const TransformParametersType & parameters,
00132                              MeasureType& Value,
00133                              DerivativeType& Derivative) const;
00134 
00135 protected:
00138   HistogramImageToImageMetric();
00139   virtual ~HistogramImageToImageMetric() {};
00140 
00142   HistogramSizeType m_HistogramSize;
00144   mutable MeasurementVectorType m_LowerBound;
00146   mutable MeasurementVectorType m_UpperBound;
00148   double m_UpperBoundIncreaseFactor;
00149 
00152   void ComputeHistogram(const TransformParametersType & parameters,
00153                         HistogramType& histogram) const;
00156   void ComputeHistogram(const TransformParametersType & parameters,
00157                         unsigned int parameter,
00158                         double step,
00159                         HistogramType& histogram) const;
00163   void CopyHistogram(HistogramType& target, HistogramType& source) const;
00164 
00167   virtual MeasureType EvaluateMeasure(HistogramType& histogram) const = 0;
00168   
00170   void PrintSelf(std::ostream& os, Indent indent) const;
00171 
00172 private:
00173   HistogramImageToImageMetric(const Self&); //purposely not implemented
00174   void operator=(const Self&); //purposely not implemented
00175 
00177   FixedImagePixelType m_PaddingValue;
00178 
00182   bool m_UsePaddingValue;
00183 
00185   double m_DerivativeStepLength;
00186 
00188   ScalesType m_DerivativeStepLengthScales;
00189 };
00190 
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkHistogramImageToImageMetric.txx"
00195 #endif
00196 
00197 #endif // __itkHistogramImageToImageMetric_h

Generated at Sun Jan 25 13:19:35 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000