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 /*=========================================================================
21 Program: Insight Segmentation & Registration Toolkit
22 Module: $RCSfile: itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h,v $
24 Date: $Date: 2010/06/14 17:32:07 $
25 Version: $Revision: 1.1 $
27 Copyright (c) Insight Software Consortium. All rights reserved.
28 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
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.
34 =========================================================================*/
35 #ifndef __itkMeanSquaresImageToImageMetricFor3DBLUTFFD_h
36 #define __itkMeanSquaresImageToImageMetricFor3DBLUTFFD_h
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"
43 #if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
44 #include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h"
47 #include "itkImageToImageMetric.h"
48 #include "itkCovariantVector.h"
54 /** \class MeanSquaresImageToImageMetricFor3DBLUTFFD
55 * \brief Computes similarity between two objects to be registered
57 * This Class is templated over the type of the fixed and moving
58 * images to be compared.
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.
67 * \ingroup RegistrationMetrics
69 template < class TFixedImage, class TMovingImage >
70 class ITK_EXPORT MeanSquaresImageToImageMetricFor3DBLUTFFD :
71 public ImageToImageMetric< TFixedImage, TMovingImage>
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;
81 /** Method for creation through the object factory. */
84 /** Run-time type information (and related methods). */
85 itkTypeMacro(MeanSquaresImageToImageMetricFor3DBLUTFFD, ImageToImageMetric);
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;
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;
107 /** Get the derivatives of the match measure. */
108 void GetDerivative( const TransformParametersType & parameters,
109 DerivativeType & derivative ) const;
111 /** Get the value for single valued optimizers. */
112 MeasureType GetValue( const TransformParametersType & parameters ) const;
114 /** Get value and derivatives for multiple valued optimizers. */
115 void GetValueAndDerivative( const TransformParametersType & parameters,
116 MeasureType& Value, DerivativeType& Derivative ) const;
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>));
129 /** End concept checking */
133 MeanSquaresImageToImageMetricFor3DBLUTFFD();
134 virtual ~MeanSquaresImageToImageMetricFor3DBLUTFFD() {};
137 MeanSquaresImageToImageMetricFor3DBLUTFFD(const Self&); //purposely not implemented
138 void operator=(const Self&); //purposely not implemented
142 } // end namespace itk
144 #ifndef ITK_MANUAL_INSTANTIATION
145 #include "itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx"