]> Creatis software - clitk.git/blobdiff - registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
Added clitkAffineRegistration from Jef's file. Also does translations only and rigid...
[clitk.git] / registration / clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
diff --git a/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h b/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
new file mode 100644 (file)
index 0000000..053ad93
--- /dev/null
@@ -0,0 +1,119 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
+
+#ifndef _clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
+#define _clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
+
+// First make sure that the configuration is available.
+// This line can be removed once the optimized versions
+// gets integrated into the main directories.
+#include "itkConfigure.h"
+
+#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#include "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h"
+#else
+
+#include "itkImageToImageMetric.h"
+#include "itkCovariantVector.h"
+#include "itkPoint.h"
+
+
+namespace clitk
+{
+
+template < class TFixedImage, class TMovingImage >
+class ITK_EXPORT NormalizedCorrelationImageToImageMetricFor3DBLUTFFD :
+  public itk::ImageToImageMetric< TFixedImage, TMovingImage>
+{
+public:
+
+  /** Standard class typedefs. */
+  typedef NormalizedCorrelationImageToImageMetricFor3DBLUTFFD    Self;
+  typedef itk::ImageToImageMetric<TFixedImage, TMovingImage >  Superclass;
+
+  typedef itk::SmartPointer<Self>         Pointer;
+  typedef itk::SmartPointer<const Self>   ConstPointer;
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(NormalizedCorrelationImageToImageMetricFor3DBLUTFFD, itk::Object);
+
+
+  /** Types transferred from the base class */
+  typedef typename Superclass::RealType                 RealType;
+  typedef typename Superclass::TransformType            TransformType;
+  typedef typename Superclass::TransformPointer         TransformPointer;
+  typedef typename Superclass::TransformParametersType  TransformParametersType;
+  typedef typename Superclass::TransformJacobianType    TransformJacobianType;
+  typedef typename Superclass::GradientPixelType        GradientPixelType;
+  typedef typename Superclass::OutputPointType          OutputPointType;
+  typedef typename Superclass::InputPointType           InputPointType;
+
+  typedef typename Superclass::MeasureType              MeasureType;
+  typedef typename Superclass::DerivativeType           DerivativeType;
+  typedef typename Superclass::FixedImageType           FixedImageType;
+  typedef typename Superclass::MovingImageType          MovingImageType;
+  typedef typename Superclass::FixedImageConstPointer   FixedImageConstPointer;
+  typedef typename Superclass::MovingImageConstPointer  MovingImageConstPointer;
+
+
+  /** Get the derivatives of the match measure. */
+  void GetDerivative( const TransformParametersType & parameters,
+                      DerivativeType & Derivative ) const;
+
+  /**  Get the value for single valued optimizers. */
+  MeasureType GetValue( const TransformParametersType & parameters ) const;
+
+  /**  Get value and derivatives for multiple valued optimizers. */
+  void GetValueAndDerivative( const TransformParametersType & parameters,
+                              MeasureType& Value, DerivativeType& Derivative ) const;
+
+  /** Set/Get SubtractMean boolean. If true, the sample mean is subtracted
+   * from the sample values in the cross-correlation formula and
+   * typically results in narrower valleys in the cost fucntion.
+   * Default value is false. */
+  itkSetMacro( SubtractMean, bool );
+  itkGetConstReferenceMacro( SubtractMean, bool );
+  itkBooleanMacro( SubtractMean );
+
+protected:
+  NormalizedCorrelationImageToImageMetricFor3DBLUTFFD();
+  virtual ~NormalizedCorrelationImageToImageMetricFor3DBLUTFFD() {};
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  NormalizedCorrelationImageToImageMetricFor3DBLUTFFD(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+
+  bool    m_SubtractMean;
+
+};
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx"
+#endif
+
+#endif // opt
+
+#endif // _clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
+
+