go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkParzenWindowMutualInformationImageToImageMetric.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 #ifndef __itkParzenWindowMutualInformationImageToImageMetric_H__
00016 #define __itkParzenWindowMutualInformationImageToImageMetric_H__
00017 
00018 #include "itkParzenWindowHistogramImageToImageMetric.h"
00019 
00020 #include "itkArray2D.h"
00021 
00022 namespace itk
00023 {
00024 
00071   template <class TFixedImage,class TMovingImage >
00072     class ParzenWindowMutualInformationImageToImageMetric :
00073   public ParzenWindowHistogramImageToImageMetric< TFixedImage, TMovingImage >
00074   {
00075   public:
00076 
00078     typedef ParzenWindowMutualInformationImageToImageMetric             Self;
00079     typedef ParzenWindowHistogramImageToImageMetric<
00080       TFixedImage, TMovingImage >                                       Superclass;
00081     typedef SmartPointer<Self>                                          Pointer;
00082     typedef SmartPointer<const Self>                                    ConstPointer;
00083 
00085     itkNewMacro( Self );
00086 
00088     itkTypeMacro(
00089       ParzenWindowMutualInformationImageToImageMetric,
00090       ParzenWindowHistogramImageToImageMetric );
00091 
00093     typedef typename
00094       Superclass::CoordinateRepresentationType              CoordinateRepresentationType;
00095     typedef typename Superclass::MovingImageType            MovingImageType;
00096     typedef typename Superclass::MovingImagePixelType       MovingImagePixelType;
00097     typedef typename Superclass::MovingImageConstPointer    MovingImageConstPointer;
00098     typedef typename Superclass::FixedImageType             FixedImageType;
00099     typedef typename Superclass::FixedImageConstPointer     FixedImageConstPointer;
00100     typedef typename Superclass::FixedImageRegionType       FixedImageRegionType;
00101     typedef typename Superclass::TransformType              TransformType;
00102     typedef typename Superclass::TransformPointer           TransformPointer;
00103     typedef typename Superclass::InputPointType             InputPointType;
00104     typedef typename Superclass::OutputPointType            OutputPointType;
00105     typedef typename Superclass::TransformParametersType    TransformParametersType;
00106     typedef typename Superclass::TransformJacobianType      TransformJacobianType;
00107     typedef typename Superclass::InterpolatorType           InterpolatorType;
00108     typedef typename Superclass::InterpolatorPointer        InterpolatorPointer;
00109     typedef typename Superclass::RealType                   RealType;
00110     typedef typename Superclass::GradientPixelType          GradientPixelType;
00111     typedef typename Superclass::GradientImageType          GradientImageType;
00112     typedef typename Superclass::GradientImagePointer       GradientImagePointer;
00113     typedef typename Superclass::GradientImageFilterType    GradientImageFilterType;
00114     typedef typename Superclass::GradientImageFilterPointer GradientImageFilterPointer;
00115     typedef typename Superclass::FixedImageMaskType         FixedImageMaskType;
00116     typedef typename Superclass::FixedImageMaskPointer      FixedImageMaskPointer;
00117     typedef typename Superclass::MovingImageMaskType        MovingImageMaskType;
00118     typedef typename Superclass::MovingImageMaskPointer     MovingImageMaskPointer;
00119     typedef typename Superclass::MeasureType                MeasureType;
00120     typedef typename Superclass::DerivativeType             DerivativeType;
00121     typedef typename Superclass::DerivativeValueType        DerivativeValueType;
00122     typedef typename Superclass::ParametersType             ParametersType;
00123     typedef typename Superclass::FixedImagePixelType        FixedImagePixelType;
00124     typedef typename Superclass::MovingImageRegionType      MovingImageRegionType;
00125     typedef typename Superclass::ImageSamplerType           ImageSamplerType;
00126     typedef typename Superclass::ImageSamplerPointer        ImageSamplerPointer;
00127     typedef typename Superclass::ImageSampleContainerType   ImageSampleContainerType;
00128     typedef typename
00129       Superclass::ImageSampleContainerPointer               ImageSampleContainerPointer;
00130     typedef typename Superclass::FixedImageLimiterType      FixedImageLimiterType;
00131     typedef typename Superclass::MovingImageLimiterType     MovingImageLimiterType;
00132     typedef typename
00133       Superclass::FixedImageLimiterOutputType               FixedImageLimiterOutputType;
00134     typedef typename
00135       Superclass::MovingImageLimiterOutputType              MovingImageLimiterOutputType;
00136     typedef typename
00137       Superclass::MovingImageDerivativeScalesType           MovingImageDerivativeScalesType;
00138 
00140     itkStaticConstMacro( FixedImageDimension, unsigned int,
00141       FixedImageType::ImageDimension );
00142 
00144     itkStaticConstMacro( MovingImageDimension, unsigned int,
00145       MovingImageType::ImageDimension );
00146 
00148     MeasureType GetValue( const ParametersType& parameters ) const;
00149 
00151     itkGetConstMacro( UseJacobianPreconditioning, bool );
00152     itkSetMacro( UseJacobianPreconditioning, bool );
00153 
00154   protected:
00155 
00157     ParzenWindowMutualInformationImageToImageMetric();
00158 
00160     virtual ~ParzenWindowMutualInformationImageToImageMetric() {};
00161 
00165     typedef typename Superclass::FixedImageIndexType                FixedImageIndexType;
00166     typedef typename Superclass::FixedImageIndexValueType           FixedImageIndexValueType;
00167     typedef typename Superclass::MovingImageIndexType               MovingImageIndexType;
00168     typedef typename Superclass::FixedImagePointType                FixedImagePointType;
00169     typedef typename Superclass::MovingImagePointType               MovingImagePointType;
00170     typedef typename Superclass::MovingImageContinuousIndexType     MovingImageContinuousIndexType;
00171     typedef typename Superclass::BSplineInterpolatorType            BSplineInterpolatorType;
00172     typedef typename Superclass::CentralDifferenceGradientFilterType        CentralDifferenceGradientFilterType;
00173     typedef typename Superclass::MovingImageDerivativeType          MovingImageDerivativeType;
00174     typedef typename Superclass::PDFValueType                       PDFValueType;
00175     typedef typename Superclass::MarginalPDFType                    MarginalPDFType;
00176     typedef typename Superclass::JointPDFType                       JointPDFType;
00177     typedef typename Superclass::JointPDFDerivativesType            JointPDFDerivativesType;
00178     typedef typename Superclass::IncrementalMarginalPDFType         IncrementalMarginalPDFType;
00179     typedef typename Superclass::JointPDFIndexType                  JointPDFIndexType;
00180     typedef typename Superclass::JointPDFRegionType                 JointPDFRegionType;
00181     typedef typename Superclass::JointPDFSizeType                   JointPDFSizeType;
00182     typedef typename Superclass::JointPDFDerivativesIndexType       JointPDFDerivativesIndexType;
00183     typedef typename Superclass::JointPDFDerivativesRegionType      JointPDFDerivativesRegionType;
00184     typedef typename Superclass::JointPDFDerivativesSizeType        JointPDFDerivativesSizeType;
00185     typedef typename Superclass::ParzenValueContainerType           ParzenValueContainerType;
00186     typedef typename Superclass::KernelFunctionType                 KernelFunctionType;
00187     typedef typename Superclass::NonZeroJacobianIndicesType         NonZeroJacobianIndicesType;
00188 
00192     virtual void GetValueAndAnalyticDerivative(
00193       const ParametersType& parameters,
00194       MeasureType& value, DerivativeType& derivative ) const;
00195 
00200     virtual void GetValueAndAnalyticDerivativeLowMemory(
00201       const ParametersType& parameters,
00202       MeasureType& value, DerivativeType& derivative ) const;
00203 
00207     virtual void GetValueAndFiniteDifferenceDerivative( const ParametersType& parameters,
00208       MeasureType& value, DerivativeType& derivative ) const;
00209 
00211     virtual void ComputeJacobianPreconditioner(
00212       const TransformJacobianType & jac,
00213       const NonZeroJacobianIndicesType & nzji,
00214       DerivativeType & preconditioner,
00215       DerivativeType & divisor ) const;
00216 
00218     virtual void InitializeHistograms( void );
00219 
00220   private:
00221 
00223     ParzenWindowMutualInformationImageToImageMetric( const Self& ); // purposely not implemented
00225     void operator=( const Self& );                              // purposely not implemented
00226 
00228     typedef double                      PRatioType;
00229     typedef Array2D< PRatioType >       PRatioArrayType;
00230     mutable PRatioArrayType             m_PRatioArray;
00231 
00233     bool  m_UseJacobianPreconditioning;
00234 
00236     void UpdateDerivativeLowMemory(
00237       const RealType & fixedImageValue,
00238       const RealType & movingImageValue,
00239       const DerivativeType & imageJacobian,
00240       const NonZeroJacobianIndicesType & nzji,
00241       DerivativeType & derivative ) const;
00242 
00244     void ComputeValueAndPRatioArray( double & MI ) const;
00245 
00246   }; // end class ParzenWindowMutualInformationImageToImageMetric
00247 
00248 } // end namespace itk
00249 
00250 #ifndef ITK_MANUAL_INSTANTIATION
00251 #include "itkParzenWindowMutualInformationImageToImageMetric.hxx"
00252 #endif
00253 
00254 #endif // end #ifndef __itkParzenWindowMutualInformationImageToImageMetric_H__
00255 


Generated on 11-05-2012 for elastix by doxygen 1.7.6.1 elastix logo