]> Creatis software - clitk.git/blobdiff - registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
dicom structure in cmd line
[clitk.git] / registration / itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
index 852583b8373c52a804e9e007b329bf07edd6c645..9391dc23898a7045fec8c1c55475695c9399dc6e 100644 (file)
@@ -41,7 +41,7 @@
 // gets integrated into the main directories.
 #include "itkConfigure.h"
 
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
 #include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx"
 #else
 
 #include "itkImageRegionIterator.h"
 #include "itkImageIterator.h"
 #include "vnl/vnl_math.h"
-#if ITK_VERSION_MAJOR >= 4
-  #include "itkBSplineTransform.h"
-#else
-  #include "itkBSplineDeformableTransform.h"
-#endif
+#include "itkBSplineDeformableTransform.h"
 
 namespace itk
 {
@@ -1445,9 +1441,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
     // Compute the transform Jacobian.
     typedef typename TransformType::JacobianType JacobianType;
-    const JacobianType& jacobian =
-      this->m_Transform->GetJacobian(
-        m_FixedImageSamples[sampleNumber].FixedImagePointValue );
+#if ITK_VERSION_MAJOR >= 4
+      JacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( m_FixedImageSamples[sampleNumber].FixedImagePointValue, jacobian );
+#else
+      const JacobianType & jacobian =
+        this->m_Transform->GetJacobian( m_FixedImageSamples[sampleNumber].FixedImagePointValue );
+#endif
 
     for ( unsigned int mu = 0; mu < m_NumberOfParameters; mu++ ) {
       double innerProduct = 0.0;
@@ -1480,8 +1480,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
       weights = m_BSplineTransformWeightsArray[sampleNumber];
       indices = m_BSplineTransformIndicesArray[sampleNumber];
     } else {
+#if ITK_VERSION_MAJOR >= 4
+      m_BSplineTransform->ComputeJacobianFromBSplineWeightsWithRespectToPosition(
+        m_FixedImageSamples[sampleNumber].FixedImagePointValue, m_Weights, m_Indices );
+#else
       m_BSplineTransform->GetJacobian(
         m_FixedImageSamples[sampleNumber].FixedImagePointValue, m_Weights, m_Indices );
+#endif
     }
 
     for( unsigned int dim = 0; dim < FixedImageDimension; dim++ ) {