1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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 copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #ifndef _clitkNormalizedCorrelationImageToImageMetric_h
20 #define _clitkNormalizedCorrelationImageToImageMetric_h
22 // First make sure that the configuration is available.
23 // This line can be removed once the optimized versions
24 // gets integrated into the main directories.
25 #include "itkConfigure.h"
27 #if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
28 #include "clitkOptNormalizedCorrelationImageToImageMetric.h"
31 #include "itkImageToImageMetric.h"
32 #include "itkCovariantVector.h"
39 template < class TFixedImage, class TMovingImage >
40 class ITK_EXPORT NormalizedCorrelationImageToImageMetric :
41 public itk::ImageToImageMetric< TFixedImage, TMovingImage>
45 /** Standard class typedefs. */
46 typedef NormalizedCorrelationImageToImageMetric Self;
47 typedef itk::ImageToImageMetric<TFixedImage, TMovingImage > Superclass;
49 typedef itk::SmartPointer<Self> Pointer;
50 typedef itk::SmartPointer<const Self> ConstPointer;
52 /** Method for creation through the object factory. */
55 /** Run-time type information (and related methods). */
56 itkTypeMacro(NormalizedCorrelationImageToImageMetric, itk::Object);
59 /** Types transferred from the base class */
60 typedef typename Superclass::RealType RealType;
61 typedef typename Superclass::TransformType TransformType;
62 typedef typename Superclass::TransformPointer TransformPointer;
63 typedef typename Superclass::TransformParametersType TransformParametersType;
64 typedef typename Superclass::TransformJacobianType TransformJacobianType;
65 typedef typename Superclass::GradientPixelType GradientPixelType;
66 typedef typename Superclass::OutputPointType OutputPointType;
67 typedef typename Superclass::InputPointType InputPointType;
69 typedef typename Superclass::MeasureType MeasureType;
70 typedef typename Superclass::DerivativeType DerivativeType;
71 typedef typename Superclass::FixedImageType FixedImageType;
72 typedef typename Superclass::MovingImageType MovingImageType;
73 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
74 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
77 /** Get the derivatives of the match measure. */
78 void GetDerivative( const TransformParametersType & parameters,
79 DerivativeType & Derivative ) const;
81 /** Get the value for single valued optimizers. */
82 MeasureType GetValue( const TransformParametersType & parameters ) const;
84 /** Get value and derivatives for multiple valued optimizers. */
85 void GetValueAndDerivative( const TransformParametersType & parameters,
86 MeasureType& Value, DerivativeType& Derivative ) const;
88 /** Set/Get SubtractMean boolean. If true, the sample mean is subtracted
89 * from the sample values in the cross-correlation formula and
90 * typically results in narrower valleys in the cost fucntion.
91 * Default value is false. */
92 itkSetMacro( SubtractMean, bool );
93 itkGetConstReferenceMacro( SubtractMean, bool );
94 itkBooleanMacro( SubtractMean );
97 NormalizedCorrelationImageToImageMetric();
98 virtual ~NormalizedCorrelationImageToImageMetric() {};
99 void PrintSelf(std::ostream& os, itk::Indent indent) const;
102 NormalizedCorrelationImageToImageMetric(const Self&); //purposely not implemented
103 void operator=(const Self&); //purposely not implemented
109 } // end namespace clitk
111 #ifndef ITK_MANUAL_INSTANTIATION
112 #include "clitkNormalizedCorrelationImageToImageMetric.txx"
117 #endif // _clitkNormalizedCorrelationImageToImageMetric.txx