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: 2008-12-21 19:13:12 $
00007   Version:   $Revision: 1.15 $
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   void SetTransform( TransformType * transform );
00085 
00088   itkSetMacro( HistogramSize, HistogramSizeType );
00089 
00091   itkGetConstReferenceMacro( HistogramSize, HistogramSizeType );
00092 
00095   itkSetMacro( UpperBoundIncreaseFactor, double );
00096   itkGetMacro( UpperBoundIncreaseFactor, double );
00098 
00100   itkSetMacro( PaddingValue, FixedImagePixelType );
00101 
00103   itkGetConstReferenceMacro( PaddingValue, FixedImagePixelType );
00104 
00108   itkGetConstReferenceMacro( Histogram, HistogramPointer );
00109 
00113   itkSetMacro( UsePaddingValue, bool );
00114   itkGetMacro( UsePaddingValue, bool );
00116 
00118   itkSetMacro( DerivativeStepLength, double );
00119 
00121   itkGetMacro( DerivativeStepLength, double );
00122 
00124   typedef Array<double> ScalesType;
00125 
00127   itkSetMacro( DerivativeStepLengthScales, ScalesType );
00128 
00130   itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
00131 
00133   MeasureType GetValue(const TransformParametersType& parameters) const;
00134 
00136   void GetDerivative(const TransformParametersType & parameters,
00137                      DerivativeType & derivative) const;
00138 
00140   void GetValueAndDerivative(const TransformParametersType & parameters,
00141                              MeasureType& Value,
00142                              DerivativeType& Derivative) const;
00143 
00147   void SetLowerBound( const MeasurementVectorType & bound );
00148 
00152   void SetUpperBound( const MeasurementVectorType & bound );
00153 
00154 
00155 protected:
00158   HistogramImageToImageMetric();
00159   virtual ~HistogramImageToImageMetric() {};
00161 
00163   HistogramSizeType m_HistogramSize;
00164 
00166   mutable MeasurementVectorType m_LowerBound;
00167 
00169   mutable MeasurementVectorType m_UpperBound;
00170 
00172   double m_UpperBoundIncreaseFactor;
00173 
00176   bool m_LowerBoundSetByUser;
00177 
00180   bool m_UpperBoundSetByUser;
00181 
00184   void ComputeHistogram(const TransformParametersType & parameters,
00185                         HistogramType& histogram) const;
00186 
00189   void ComputeHistogram(const TransformParametersType & parameters,
00190                         unsigned int parameter,
00191                         double step,
00192                         HistogramType& histogram) const;
00193 
00195   void CopyHistogram(HistogramType& target, HistogramType& source) const;
00196 
00199   virtual MeasureType EvaluateMeasure(HistogramType& histogram) const = 0;
00200 
00202   void PrintSelf(std::ostream& os, Indent indent) const;
00203 
00204 private:
00205   HistogramImageToImageMetric(const Self&); //purposely not implemented
00206   void operator=(const Self&); //purposely not implemented
00207 
00209   FixedImagePixelType m_PaddingValue;
00210 
00214   bool m_UsePaddingValue;
00215 
00217   double m_DerivativeStepLength;
00218 
00220   ScalesType m_DerivativeStepLengthScales;
00221 
00224   HistogramPointer  m_Histogram;
00225 
00226 };
00227 
00228 } // end namespace itk
00229 
00230 #ifndef ITK_MANUAL_INSTANTIATION
00231 #include "itkHistogramImageToImageMetric.txx"
00232 #endif
00233 
00234 #endif // __itkHistogramImageToImageMetric_h
00235 

Generated at Sat Feb 28 12:35:39 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000