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: 2004/10/29 20:57:14 $
00007   Version:   $Revision: 1.10 $
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 
00079   void Initialize() throw (ExceptionObject);
00080 
00083   itkSetMacro( HistogramSize, HistogramSizeType );
00084 
00086   itkGetConstReferenceMacro( HistogramSize, HistogramSizeType );
00087 
00090   itkSetMacro( UpperBoundIncreaseFactor, double );
00091   itkGetMacro( UpperBoundIncreaseFactor, double );
00092 
00094   itkSetMacro( PaddingValue, FixedImagePixelType );
00095 
00097   itkGetConstReferenceMacro( PaddingValue, FixedImagePixelType );
00098 
00102   itkSetMacro( UsePaddingValue, bool );
00103   itkGetMacro( UsePaddingValue, bool );
00104 
00106   itkSetMacro( DerivativeStepLength, double );
00107 
00109   itkGetMacro( DerivativeStepLength, double );
00110 
00112   typedef Array<double> ScalesType;
00113 
00115   itkSetMacro( DerivativeStepLengthScales, ScalesType );
00116 
00118   itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00119 
00121   MeasureType GetValue(const TransformParametersType& parameters) const;
00122 
00124   void GetDerivative(const TransformParametersType & parameters,
00125                      DerivativeType & derivative) const;
00126 
00128   void GetValueAndDerivative(const TransformParametersType & parameters,
00129                              MeasureType& Value,
00130                              DerivativeType& Derivative) const;
00131 
00132 protected:
00135   HistogramImageToImageMetric();
00136   virtual ~HistogramImageToImageMetric() {};
00137 
00139   HistogramSizeType m_HistogramSize;
00141   mutable MeasurementVectorType m_LowerBound;
00143   mutable MeasurementVectorType m_UpperBound;
00145   double m_UpperBoundIncreaseFactor;
00146 
00149   void ComputeHistogram(const TransformParametersType & parameters,
00150                         HistogramType& histogram) const;
00153   void ComputeHistogram(const TransformParametersType & parameters,
00154                         unsigned int parameter,
00155                         double step,
00156                         HistogramType& histogram) const;
00160   void CopyHistogram(HistogramType& target, HistogramType& source) const;
00161 
00164   virtual MeasureType EvaluateMeasure(HistogramType& histogram) const = 0;
00165   
00167   void PrintSelf(std::ostream& os, Indent indent) const;
00168 
00169 private:
00170   HistogramImageToImageMetric(const Self&); //purposely not implemented
00171   void operator=(const Self&); //purposely not implemented
00172 
00174   FixedImagePixelType m_PaddingValue;
00175 
00179   bool m_UsePaddingValue;
00180 
00182   double m_DerivativeStepLength;
00183 
00185   ScalesType m_DerivativeStepLengthScales;
00186 };
00187 
00188 } // end namespace itk
00189 
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkHistogramImageToImageMetric.txx"
00192 #endif
00193 
00194 #endif // __itkHistogramImageToImageMetric_h

Generated at Tue Mar 29 23:53:50 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000