]> Creatis software - clitk.git/blob - registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h
Merge branch 'master' of /home/romulo/creatis/clitk3-git-shared/clitk3
[clitk.git] / registration / itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
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
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 copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 /*=========================================================================
20
21   Program:   Insight Segmentation & Registration Toolkit
22   Module:    $RCSfile: itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h,v $
23   Language:  C++
24   Date:      $Date: 2010/06/14 17:32:07 $
25   Version:   $Revision: 1.1 $
26
27   Copyright (c) Insight Software Consortium. All rights reserved.
28   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
29
30      This software is distributed WITHOUT ANY WARRANTY; without even
31      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
32      PURPOSE.  See the above copyright notices for more information.
33
34 =========================================================================*/
35 #ifndef __itkMeanSquaresImageToImageMetricFor3DBLUTFFD_h
36 #define __itkMeanSquaresImageToImageMetricFor3DBLUTFFD_h
37
38 // First make sure that the configuration is available.
39 // This line can be removed once the optimized versions
40 // gets integrated into the main directories.
41 #include "itkConfigure.h"
42
43 #ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
44 #include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h"
45 #else
46
47 #include "itkImageToImageMetric.h"
48 #include "itkCovariantVector.h"
49 #include "itkPoint.h"
50
51
52 namespace itk
53 {
54 /** \class MeanSquaresImageToImageMetricFor3DBLUTFFD
55  * \brief Computes similarity between two objects to be registered
56  *
57  * This Class is templated over the type of the fixed and moving
58  * images to be compared.
59  *
60  * This metric computes the sum of squared differences between pixels in
61  * the moving image and pixels in the fixed image. The spatial correspondance
62  * between both images is established through a Transform. Pixel values are
63  * taken from the Moving image. Their positions are mapped to the Fixed image
64  * and result in general in non-grid position on it. Values at these non-grid
65  * position of the Fixed image are interpolated using a user-selected Interpolator.
66  *
67  * \ingroup RegistrationMetrics
68  */
69 template < class TFixedImage, class TMovingImage >
70 class ITK_EXPORT MeanSquaresImageToImageMetricFor3DBLUTFFD :
71   public ImageToImageMetric< TFixedImage, TMovingImage>
72 {
73 public:
74
75   /** Standard class typedefs. */
76   typedef MeanSquaresImageToImageMetricFor3DBLUTFFD                  Self;
77   typedef ImageToImageMetric<TFixedImage, TMovingImage > Superclass;
78   typedef SmartPointer<Self>                             Pointer;
79   typedef SmartPointer<const Self>                       ConstPointer;
80
81   /** Method for creation through the object factory. */
82   itkNewMacro(Self);
83
84   /** Run-time type information (and related methods). */
85   itkTypeMacro(MeanSquaresImageToImageMetricFor3DBLUTFFD, ImageToImageMetric);
86
87
88   /** Types transferred from the base class */
89   typedef typename Superclass::RealType                 RealType;
90   typedef typename Superclass::TransformType            TransformType;
91   typedef typename Superclass::TransformPointer         TransformPointer;
92   typedef typename Superclass::TransformParametersType  TransformParametersType;
93   typedef typename Superclass::TransformJacobianType    TransformJacobianType;
94   typedef typename Superclass::GradientPixelType        GradientPixelType;
95   typedef typename Superclass::GradientImageType        GradientImageType;
96   typedef typename Superclass::InputPointType           InputPointType;
97   typedef typename Superclass::OutputPointType          OutputPointType;
98
99   typedef typename Superclass::MeasureType              MeasureType;
100   typedef typename Superclass::DerivativeType           DerivativeType;
101   typedef typename Superclass::FixedImageType           FixedImageType;
102   typedef typename Superclass::MovingImageType          MovingImageType;
103   typedef typename Superclass::FixedImageConstPointer   FixedImageConstPointer;
104   typedef typename Superclass::MovingImageConstPointer  MovingImageConstPointer;
105
106
107   /** Get the derivatives of the match measure. */
108   void GetDerivative( const TransformParametersType & parameters,
109                       DerivativeType & derivative ) const;
110
111   /**  Get the value for single valued optimizers. */
112   MeasureType GetValue( const TransformParametersType & parameters ) const;
113
114   /**  Get value and derivatives for multiple valued optimizers. */
115   void GetValueAndDerivative( const TransformParametersType & parameters,
116                               MeasureType& Value, DerivativeType& Derivative ) const;
117
118 #ifdef ITK_USE_CONCEPT_CHECKING
119   /** Begin concept checking */
120   itkConceptMacro(MovingPixelTypeHasNumericTraitsCheck,
121                   (Concept::HasNumericTraits<typename TMovingImage::PixelType>));
122   itkConceptMacro(MovingRealTypeAdditivieOperatorsCheck,
123                   (Concept::AdditiveOperators<
124                    typename NumericTraits<typename TMovingImage::PixelType>::RealType>));
125   itkConceptMacro(MovingRealTypeMultiplyOperatorCheck,
126                   (Concept::MultiplyOperator<
127                    typename NumericTraits<typename TMovingImage::PixelType>::RealType>));
128
129   /** End concept checking */
130 #endif
131
132 protected:
133   MeanSquaresImageToImageMetricFor3DBLUTFFD();
134   virtual ~MeanSquaresImageToImageMetricFor3DBLUTFFD() {};
135
136 private:
137   MeanSquaresImageToImageMetricFor3DBLUTFFD(const Self&); //purposely not implemented
138   void operator=(const Self&); //purposely not implemented
139
140 };
141
142 } // end namespace itk
143
144 #ifndef ITK_MANUAL_INSTANTIATION
145 #include "itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx"
146 #endif
147
148 #endif
149
150 #endif
151