go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkParzenWindowHistogramImageToImageMetric.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __itkParzenWindowHistogramImageToImageMetric_H__
16 #define __itkParzenWindowHistogramImageToImageMetric_H__
17 
19 #include "itkBSplineKernelFunction.h"
20 
21 
22 namespace itk
23 {
24 
71  template <class TFixedImage,class TMovingImage >
73  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
74  {
75  public:
76 
80  typedef SmartPointer<Self> Pointer;
81  typedef SmartPointer<const Self> ConstPointer;
82 
85 
87  typedef typename
103  typedef typename Superclass::RealType RealType;
122  typedef typename
126  typedef typename
128  typedef typename
130  typedef typename
132 
134  itkStaticConstMacro( FixedImageDimension, unsigned int,
135  FixedImageType::ImageDimension );
136 
138  itkStaticConstMacro( MovingImageDimension, unsigned int,
139  MovingImageType::ImageDimension );
140 
147  void Initialize(void) throw ( ExceptionObject );
148 
153  void GetDerivative(
154  const ParametersType& parameters,
155  DerivativeType & Derivative ) const;
156 
162  void GetValueAndDerivative( const ParametersType& parameters,
163  MeasureType& value, DerivativeType& derivative ) const;
164 
171  itkSetClampMacro( NumberOfFixedHistogramBins, unsigned long,
172  4, NumericTraits<unsigned long>::max() );
173  itkGetMacro( NumberOfFixedHistogramBins, unsigned long);
174 
181  itkSetClampMacro( NumberOfMovingHistogramBins, unsigned long,
182  4, NumericTraits<unsigned long>::max() );
183  itkGetMacro( NumberOfMovingHistogramBins, unsigned long);
184 
186  itkSetClampMacro( FixedKernelBSplineOrder, unsigned int, 0, 3 );
187  itkGetConstMacro( FixedKernelBSplineOrder, unsigned int );
188 
190  itkSetClampMacro( MovingKernelBSplineOrder, unsigned int, 0, 3 );
191  itkGetConstMacro( MovingKernelBSplineOrder, unsigned int );
192 
196  itkSetMacro( UseExplicitPDFDerivatives, bool );
197  itkGetConstReferenceMacro( UseExplicitPDFDerivatives, bool );
198  itkBooleanMacro( UseExplicitPDFDerivatives );
199 
203  itkSetMacro( UseDerivative, bool );
204  itkGetConstMacro( UseDerivative, bool );
205 
209  itkSetMacro( UseFiniteDifferenceDerivative, bool );
210  itkGetConstMacro( UseFiniteDifferenceDerivative, bool );
211 
216  itkSetMacro( FiniteDifferencePerturbation, double );
217  itkGetConstMacro( FiniteDifferencePerturbation, double );
218 
219  protected:
220 
223 
225  virtual ~ParzenWindowHistogramImageToImageMetric() {};
226 
228  void PrintSelf( std::ostream& os, Indent indent ) const;
229 
235  typedef typename FixedImageType::OffsetValueType OffsetValueType;
244 
246  typedef float PDFValueType;
248  typedef Image<PDFValueType,2> JointPDFType;
249  typedef Image<PDFValueType,3> JointPDFDerivativesType;
250  typedef Image<PDFValueType,2> IncrementalMarginalPDFType;
251  typedef JointPDFType::IndexType JointPDFIndexType;
252  typedef JointPDFType::RegionType JointPDFRegionType;
253  typedef JointPDFType::SizeType JointPDFSizeType;
254  typedef JointPDFDerivativesType::IndexType JointPDFDerivativesIndexType;
255  typedef JointPDFDerivativesType::RegionType JointPDFDerivativesRegionType;
256  typedef JointPDFDerivativesType::SizeType JointPDFDerivativesSizeType;
257  typedef IncrementalMarginalPDFType::IndexType IncrementalMarginalPDFIndexType;
258  typedef IncrementalMarginalPDFType::RegionType IncrementalMarginalPDFRegionType;
259  typedef IncrementalMarginalPDFType::SizeType IncrementalMarginalPDFSizeType;
260  typedef Array<double> ParzenValueContainerType;
261 
264 
268  mutable double m_Alpha;
271 
275  typename JointPDFType::Pointer m_JointPDF;
276  typename JointPDFDerivativesType::Pointer m_JointPDFDerivatives;
277  typename JointPDFDerivativesType::Pointer m_IncrementalJointPDFRight;
278  typename JointPDFDerivativesType::Pointer m_IncrementalJointPDFLeft;
279  typename IncrementalMarginalPDFType::Pointer m_FixedIncrementalMarginalPDFRight;
280  typename IncrementalMarginalPDFType::Pointer m_MovingIncrementalMarginalPDFRight;
281  typename IncrementalMarginalPDFType::Pointer m_FixedIncrementalMarginalPDFLeft;
282  typename IncrementalMarginalPDFType::Pointer m_MovingIncrementalMarginalPDFLeft;
290 
292  typename KernelFunctionType::Pointer m_FixedKernel;
293  typename KernelFunctionType::Pointer m_MovingKernel;
294  typename KernelFunctionType::Pointer m_DerivativeMovingKernel;
295 
301  const TransformJacobianType & jacobian,
302  const MovingImageDerivativeType & movingImageDerivative,
303  DerivativeType & imageJacobian ) const;
304 
312  double parzenWindowTerm, OffsetValueType parzenWindowIndex,
313  const KernelFunctionType * kernel, ParzenValueContainerType & parzenValues ) const;
314 
318  virtual void UpdateJointPDFAndDerivatives(
319  RealType fixedImageValue, RealType movingImageValue,
320  const DerivativeType * imageJacobian, const NonZeroJacobianIndicesType * nzji ) const;
321 
333  RealType fixedImageValue, RealType movingImageValue, RealType movingMaskValue,
334  const DerivativeType & movingImageValuesRight,
335  const DerivativeType & movingImageValuesLeft,
336  const DerivativeType & movingMaskValuesRight,
337  const DerivativeType & movingMaskValuesLeft,
338  const NonZeroJacobianIndicesType & nzji ) const;
339 
346  const JointPDFIndexType & pdfIndex, double factor,
347  const DerivativeType & imageJacobian,
348  const NonZeroJacobianIndicesType & nzji ) const;
349 
351  virtual void NormalizeJointPDF(
352  JointPDFType * pdf, double factor ) const;
353 
355  virtual void NormalizeJointPDFDerivatives(
356  JointPDFDerivativesType * pdf, double factor ) const;
357 
362  virtual void ComputeMarginalPDF(
363  const JointPDFType * jointPDF,
364  MarginalPDFType & marginalPDF,
365  unsigned int direction ) const;
366 
370  virtual void ComputeIncrementalMarginalPDFs(
371  const JointPDFDerivativesType * incrementalPDF,
372  IncrementalMarginalPDFType * fixedIncrementalMarginalPDF,
373  IncrementalMarginalPDFType * movingIncrementalMarginalPDF ) const;
374 
384  virtual void ComputePDFsAndPDFDerivatives( const ParametersType & parameters ) const;
385 
409  virtual void ComputePDFsAndIncrementalPDFs( const ParametersType & parameters ) const;
410 
419  virtual void ComputePDFs( const ParametersType & parameters ) const;
420 
422  virtual void InitializeHistograms( void );
423  virtual void InitializeKernels( void );
424 
430  const ParametersType & itkNotUsed( parameters ),
431  MeasureType & itkNotUsed( value ),
432  DerivativeType & itkNotUsed( derivative ) ) const {};
433 
439  const ParametersType & itkNotUsed( parameters ),
440  MeasureType & itkNotUsed( value ),
441  DerivativeType & itkNotUsed( derivative ) ) const {};
442 
443  private:
444 
446  ParzenWindowHistogramImageToImageMetric( const Self& ); // purposely not implemented
448  void operator=( const Self& ); // purposely not implemented
449 
458 
460 
461  }; // end class ParzenWindowHistogramImageToImageMetric
462 
463 } // end namespace itk
464 
465 #ifndef ITK_MANUAL_INSTANTIATION
466 #include "itkParzenWindowHistogramImageToImageMetric.hxx"
467 #endif
468 
469 #endif // end #ifndef __itkParzenWindowHistogramImageToImageMetric_H__
470 
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
virtual void GetValueAndFiniteDifferenceDerivative(const ParametersType &, MeasureType &, DerivativeType &) const
Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
virtual void ComputeIncrementalMarginalPDFs(const JointPDFDerivativesType *incrementalPDF, IncrementalMarginalPDFType *fixedIncrementalMarginalPDF, IncrementalMarginalPDFType *movingIncrementalMarginalPDF) const
Superclass::CoordinateRepresentationType CoordinateRepresentationType
void EvaluateParzenValues(double parzenWindowTerm, OffsetValueType parzenWindowIndex, const KernelFunctionType *kernel, ParzenValueContainerType &parzenValues) const
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageType MovingImageType
virtual void UpdateJointPDFAndDerivatives(RealType fixedImageValue, RealType movingImageValue, const DerivativeType *imageJacobian, const NonZeroJacobianIndicesType *nzji) const
Superclass::FixedImageMaskPointer FixedImageMaskPointer
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
Superclass::GradientPixelType GradientPixelType
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
Superclass::FixedImageRegionType FixedImageRegionType
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
MovingImageType::IndexType MovingImageIndexType
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
TransformType::InputPointType FixedImagePointType
virtual void NormalizeJointPDF(JointPDFType *pdf, double factor) const
ImageSamplerBase< FixedImageType > ImageSamplerType
virtual void ComputeMarginalPDF(const JointPDFType *jointPDF, MarginalPDFType &marginalPDF, unsigned int direction) const
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
virtual void ComputePDFsAndIncrementalPDFs(const ParametersType &parameters) const
virtual void UpdateJointPDFAndIncrementalPDFs(RealType fixedImageValue, RealType movingImageValue, RealType movingMaskValue, const DerivativeType &movingImageValuesRight, const DerivativeType &movingImageValuesLeft, const DerivativeType &movingMaskValuesRight, const DerivativeType &movingMaskValuesLeft, const NonZeroJacobianIndicesType &nzji) const
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::CoordinateRepresentationType CoordinateRepresentationType
virtual void GetValueAndAnalyticDerivative(const ParametersType &, MeasureType &, DerivativeType &) const
FixedArray< double, itkGetStaticConstMacro(MovingImageDimension) > MovingImageDerivativeScalesType
FixedImageIndexType::IndexValueType FixedImageIndexValueType
TransformType::OutputPointType MovingImagePointType
int max(int a, int b)
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::GradientImageType GradientImageType
virtual void ComputePDFs(const ParametersType &parameters) const
Superclass::TransformPointer TransformPointer
A base class for image metrics based on a joint histogram computed using Parzen Windowing.
void PrintSelf(std::ostream &os, Indent indent) const
void UpdateJointPDFDerivatives(const JointPDFIndexType &pdfIndex, double factor, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji) const
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
void GetDerivative(const ParametersType &parameters, DerivativeType &Derivative) const
Superclass::GradientImageFilterType GradientImageFilterType
MovingImageType::RegionType MovingImageRegionType
Superclass::InterpolatorType InterpolatorType
Superclass::TransformJacobianType TransformJacobianType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
Superclass::MovingImagePixelType MovingImagePixelType
virtual void NormalizeJointPDFDerivatives(JointPDFDerivativesType *pdf, double factor) const
Superclass::MovingImageMaskPointer MovingImageMaskPointer
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
virtual void ComputePDFsAndPDFDerivatives(const ParametersType &parameters) const
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Superclass::FixedImageMaskType FixedImageMaskType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::CentralDifferenceGradientFilterType CentralDifferenceGradientFilterType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImagePointer GradientImagePointer


Generated on 05-01-2014 for elastix by doxygen 1.8.5 elastix logo