]> Creatis software - clitk.git/blobdiff - registration/clitkCorrelationRatioImageToImageMetric.txx
Ensure compatibility with ITK < 4.12 for throw exception
[clitk.git] / registration / clitkCorrelationRatioImageToImageMetric.txx
index e7133ca69da81d03113c216b952f4ffc6b1a829c..1454539c8183b24d2d56a8239d027061076732d9 100644 (file)
@@ -51,7 +51,11 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
+::Initialize(void)
+#else
 ::Initialize(void) throw ( ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
@@ -227,7 +231,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
   FixedImageType> FixedIteratorType;
 
   typedef  itk::ImageRegionConstIteratorWithIndex<
-  ITK_TYPENAME Superclass::GradientImageType> GradientIteratorType;
+  typename Superclass::GradientImageType> GradientIteratorType;
 
 
   FixedIteratorType ti( fixedImage, this->GetFixedImageRegion() );
@@ -240,7 +244,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 
   const unsigned int ParametersDimension = this->GetNumberOfParameters();
   derivative = DerivativeType( ParametersDimension );
-  derivative.Fill( itk::NumericTraits<ITK_TYPENAME DerivativeType::ValueType>::Zero );
+  derivative.Fill( itk::NumericTraits<typename DerivativeType::ValueType>::Zero );
 
   ti.GoToBegin();
 
@@ -266,9 +270,8 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
-      const TransformJacobianType & jacobian =
-        this->m_Transform->GetJacobian( inputPoint );
-
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint , jacobian);
 
       const RealType fixedValue     = ti.Value();
       this->m_NumberOfPixelsCounted++;
@@ -343,7 +346,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
   FixedImageType> FixedIteratorType;
 
   typedef  itk::ImageRegionConstIteratorWithIndex<
-  ITK_TYPENAME Superclass::GradientImageType> GradientIteratorType;
+  typename Superclass::GradientImageType> GradientIteratorType;
 
 
   FixedIteratorType ti( fixedImage, this->GetFixedImageRegion() );
@@ -358,7 +361,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 
   const unsigned int ParametersDimension = this->GetNumberOfParameters();
   derivative = DerivativeType( ParametersDimension );
-  derivative.Fill( NumericTraits<ITK_TYPENAME DerivativeType::ValueType>::Zero );
+  derivative.Fill( NumericTraits<typename DerivativeType::ValueType>::Zero );
 
   ti.GoToBegin();
 
@@ -384,9 +387,8 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
-      const TransformJacobianType & jacobian =
-        this->m_Transform->GetJacobian( inputPoint );
-
+      TransformJacobianType jacobian;
+        this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
 
       const RealType fixedValue     = ti.Value();
       this->m_NumberOfPixelsCounted++;