]> Creatis software - clitk.git/commitdiff
itk4 Renaming
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Mon, 29 Aug 2011 16:08:01 +0000 (18:08 +0200)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Mon, 29 Aug 2011 16:08:01 +0000 (18:08 +0200)
- Rename GetJacobian to ComputeJacobianWithRespectToParameters
- Call Transform constructor without OutputDimension parameter
- Rename m_Jacobian to m_SharedDataBSplineJacobian and declare it

15 files changed:
registration/clitkBSplineDeformableTransform.h
registration/clitkBSplineDeformableTransform.txx
registration/clitkCorrelationRatioImageToImageMetric.txx
registration/clitkDeformationFieldTransform.h
registration/clitkDeformationFieldTransform.txx
registration/clitkMultipleBSplineDeformableTransform.h
registration/clitkMultipleBSplineDeformableTransform.txx
registration/clitkNormalizedCorrelationImageToImageMetric.txx
registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
registration/clitkPointListTransform.h
registration/clitkPointListTransform.txx
registration/clitkShapedBLUTSpatioTemporalDeformableTransform.h
registration/clitkShapedBLUTSpatioTemporalDeformableTransform.txx
registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx

index 5a084c9d841c2a3ffec678936666c41d1f0d9772..bab7f8c78257206b4d060b557211235d89b2217d 100644 (file)
@@ -254,7 +254,15 @@ namespace clitk
     } 
     
     /** Compute the Jacobian Matrix of the transformation at one point */
+#if ITK_VERSION_MAJOR >= 4
+    virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const;
+    virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented for " << this->GetNameOfClass() );
+    }
+#else
     virtual const JacobianType& GetJacobian(const InputPointType  &point ) const;
+#endif
 
     /** Return the number of parameters that completely define the Transfom */
     virtual unsigned int GetNumberOfParameters(void) const;
@@ -363,6 +371,9 @@ namespace clitk
 
     // VD Add MultipleBSplineDeformableTransform as friend to facilitate wrapping
     friend class MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>;
+#if ITK_VERSION_MAJOR >= 4
+    mutable JacobianType                            m_SharedDataBSplineJacobian;
+#endif
 
   }; //class BSplineDeformableTransform
 
index db47430b5a82ab339d4103558a29d923bce7d6c8..1a2dfd3ccab98b4e60deef7e064edf18de99a474 100644 (file)
@@ -32,7 +32,11 @@ namespace clitk
   // Constructor with default arguments
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+#if ITK_VERSION_MAJOR >= 4
+  ::BSplineDeformableTransform():Superclass(0)
+#else
   ::BSplineDeformableTransform():Superclass(OutputDimension,0)
+#endif
   {
     unsigned int i;
     
@@ -576,10 +580,18 @@ namespace clitk
     m_CoefficientImage = m_WrappedImage;
     
     //JV Wrap jacobian into OutputDimension X Vectorial images
+#if ITK_VERSION_MAJOR >= 4
+    this->m_SharedDataBSplineJacobian.set_size( OutputDimension, this->GetNumberOfParameters() );
+#else
     this->m_Jacobian.set_size( OutputDimension, this->GetNumberOfParameters() );
+#endif
 
     // Use memset to set the memory
+#if ITK_VERSION_MAJOR >= 4
+    JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_SharedDataBSplineJacobian.data_block());
+#else
     JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_Jacobian.data_block());
+#endif
     memset(jacobianDataPointer, 0,  OutputDimension*numberOfPixels*sizeof(JacobianPixelType));
     m_LastJacobianIndex = m_ValidRegion.GetIndex();
     m_NeedResetJacobian = false;
@@ -904,6 +916,69 @@ namespace clitk
 
   // JV weights are identical as for transformpoint, could be done simultaneously in metric!!!!
   // Compute the Jacobian in one position 
+#if ITK_VERSION_MAJOR >= 4
+  template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
+  void
+  BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+  ::ComputeJacobianWithRespectToParameters(const InputPointType & point, JacobianType & jacobian) const
+  {
+    if (m_NeedResetJacobian)
+      ResetJacobian();
+
+    //========================================================
+    // For each dimension, copy the weight to the support region
+    //========================================================
+
+    // Check if inside mask
+    if (m_Mask &&  !(m_Mask->IsInside(point) ) )
+      {
+       // Outside: no (deformable) displacement
+        jacobian = m_SharedDataBSplineJacobian;
+       return;
+      }
+
+    //Get index
+    this->TransformPointToContinuousIndex( point, m_Index );
+
+    // NOTE: if the support region does not lie totally within the grid
+    // we assume zero displacement and return the input point
+    if ( !this->InsideValidRegion( m_Index ) )
+      {
+        jacobian = m_SharedDataBSplineJacobian;
+       return;
+      }
+
+    //Compute interpolation weights
+    const WeightsDataType *weights = NULL;
+    m_VectorInterpolator->EvaluateWeightsAtContinuousIndex( m_Index, &weights, m_LastJacobianIndex);
+    m_SupportRegion.SetIndex( m_LastJacobianIndex );
+
+    //Reset the iterators
+    unsigned int j = 0;
+    for ( j = 0; j < OutputDimension; j++ )
+      m_Iterator[j] = IteratorType( m_JacobianImage[j], m_SupportRegion);
+
+    // For each dimension, copy the weight to the support region
+    while ( ! (m_Iterator[0]).IsAtEnd() )
+      {
+       //copy weight to jacobian image
+       for ( j = 0; j < OutputDimension; j++ )
+         {
+           m_ZeroVector[j]=*weights;
+           (m_Iterator[j]).Set( m_ZeroVector);
+           m_ZeroVector[j]=itk::NumericTraits<JacobianValueType>::Zero;
+           ++(m_Iterator[j]);
+         }
+       // go to next coefficient in the support region
+       weights++;
+      }
+    m_NeedResetJacobian = true;
+
+    // Return the result
+    jacobian = m_SharedDataBSplineJacobian;
+
+  }
+#else
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   const 
   typename BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
@@ -972,6 +1047,7 @@ namespace clitk
     return this->m_Jacobian;
 
   }
+#endif
 
 
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
index e7133ca69da81d03113c216b952f4ffc6b1a829c..aac2a786560e270580faafdee5155b488b327fde 100644 (file)
@@ -266,8 +266,13 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint , jacobian);
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
 
       const RealType fixedValue     = ti.Value();
@@ -384,8 +389,13 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+        this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
 
       const RealType fixedValue     = ti.Value();
index dd289591fb05e62ad496776eb07f118cdcc3c72f..06c528855cdd8fb4ec09b24b8a97c164e8c9614d 100644 (file)
@@ -109,11 +109,22 @@ namespace clitk
       return OutputCovariantVectorType();
     }
 
+#if ITK_VERSION_MAJOR >= 4
+    virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToParameters" );
+    }
+    virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToPosition" );
+    }
+#else
     virtual const JacobianType& GetJacobian(const InputPointType  &point ) const
     {
       itkExceptionMacro( << "DeformationFieldTransform doesn't declare GetJacobian" );
       return this->m_Jacobian;
     }
+#endif
 
   protected:
     DeformationFieldTransform();
index e8349a6569258262e5677b924826b5fc8e663f36..049f270bd25a5ebc797646ba1135b891d04cefdf 100644 (file)
@@ -26,7 +26,11 @@ namespace clitk
   // Constructor
   template<class TScalarType, unsigned int InputDimension, unsigned int OutputDimension, unsigned int SpaceDimension>
   DeformationFieldTransform<TScalarType, InputDimension, OutputDimension, SpaceDimension>
+#if ITK_VERSION_MAJOR >= 4
+  ::DeformationFieldTransform():Superclass(1)
+#else
   ::DeformationFieldTransform():Superclass(OutputDimension,1)
+#endif
   {
      m_DeformationField=NULL;
      m_Interpolator=DefaultInterpolatorType::New();
index 3e8dc3a5b0afca8b2aadcaa508ce47a0a32cab98..09f008faa65ffe3f04d560038ce87770ff74c3ce 100644 (file)
@@ -213,7 +213,15 @@ namespace clitk
     }
 
     /** Compute the Jacobian Matrix of the transformation at one point */
+#if ITK_VERSION_MAJOR >= 4
+    virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const;
+    virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented for " << this->GetNameOfClass() );
+    }
+#else
     virtual const JacobianType& GetJacobian(const InputPointType  &point ) const;
+#endif
 
     /** Return the number of parameters that completely define the Transfom */
     virtual unsigned int GetNumberOfParameters(void) const;
@@ -261,6 +269,9 @@ namespace clitk
     std::vector<ParametersType>                     m_parameters;
     mutable std::vector<CoefficientImagePointer>    m_CoefficientImages;
     mutable int                                     m_LastJacobian;
+#if ITK_VERSION_MAJOR >= 4
+    mutable JacobianType                            m_SharedDataBSplineJacobian;
+#endif
 
     void InitJacobian();
     // FIXME it seems not used
index 0ec20aa2bdf29398a97a267b81cf21d6dd800f46..32ebced48447e08923ce6baefec63dbdb4253716 100644 (file)
@@ -29,7 +29,11 @@ namespace clitk
   // Constructor with default arguments
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+#if ITK_VERSION_MAJOR >= 4
+  ::MultipleBSplineDeformableTransform() : Superclass(0)
+#else
   ::MultipleBSplineDeformableTransform() : Superclass(OutputDimension, 0)
+#endif
   {
     m_nLabels = 1;
     m_labels = 0;
@@ -425,15 +429,38 @@ namespace clitk
     return m_trans[lidx]->DeformablyTransformPoint(inputPoint);
   }
 
+#if ITK_VERSION_MAJOR >= 4
+  template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
+  inline void
+  MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+  ::ComputeJacobianWithRespectToParameters (const InputPointType &point, JacobianType &jacobian) const
+  {
+    if (m_LastJacobian != -1)
+      m_trans[m_LastJacobian]->ResetJacobian();
+
+    int lidx = 0;
+    if (m_labels)
+      lidx = m_labelInterpolator->Evaluate(point) - 1;
+    if (lidx == -1)
+    {
+      m_LastJacobian = lidx;
+      jacobian = this->m_SharedDataBSplineJacobian;
+      return;
+    }
+
+    JacobianType unused;
+    m_trans[lidx]->ComputeJacobianWithRespectToParameters(point, unused);
+    m_LastJacobian = lidx;
+
+    jacobian = this->m_SharedDataBSplineJacobian;
+  }
+
+#else
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   inline const typename MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>::JacobianType &
   MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
   ::GetJacobian( const InputPointType & point ) const
   {
-    /*
-    for (unsigned i = 0; i < m_nLabels; ++i)
-      m_trans[i]->ResetJacobian();
-      */
     if (m_LastJacobian != -1)
       m_trans[m_LastJacobian]->ResetJacobian();
 
@@ -451,6 +478,7 @@ namespace clitk
 
     return this->m_Jacobian;
   }
+#endif
 
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   inline void
@@ -465,8 +493,13 @@ namespace clitk
   MultipleBSplineDeformableTransform<TCoordRep, NInputDimensions,NOutputDimensions>::InitJacobian()
   {
     unsigned numberOfParameters = this->GetNumberOfParameters();
+#if ITK_VERSION_MAJOR >= 4
+    this->m_SharedDataBSplineJacobian.set_size(OutputDimension, numberOfParameters);
+    JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_SharedDataBSplineJacobian.data_block());
+#else
     this->m_Jacobian.set_size(OutputDimension, numberOfParameters);
     JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_Jacobian.data_block());
+#endif
     memset(jacobianDataPointer, 0,  numberOfParameters * sizeof (JacobianPixelType));
 
     unsigned tot = 0;
index 3708f103ed8391866c17db471e6b0dac444603ae..342549ee72ea276bc0cde8610221b6052cf2d768 100644 (file)
@@ -251,8 +251,13 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
       const RealType fixedValue   = ti.Get();
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
       // Get the gradient by NearestNeighboorInterpolation:
       // which is equivalent to round up the point components.
@@ -427,8 +432,13 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
       const RealType fixedValue     = ti.Get();
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
       // Get the gradient by NearestNeighboorInterpolation:
       // which is equivalent to round up the point components.
index 511f97392259cdda3a4927e7909bab8ee9b8a18a..7290bd49fb1fb2cd3c701e12a7db24815503573b 100644 (file)
@@ -251,8 +251,13 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
       const RealType fixedValue   = ti.Get();
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
       // Get the gradient by NearestNeighboorInterpolation:
       // which is equivalent to round up the point components.
@@ -427,8 +432,13 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
       const RealType fixedValue     = ti.Get();
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
+#endif
 
       // Get the gradient by NearestNeighboorInterpolation:
       // which is equivalent to round up the point components.
index 9fbd7d21a6690cca49be5df435e88d1e13db7baa..d98c525d6abd3c114454c6e4fccba22dfeec968e 100644 (file)
@@ -117,11 +117,22 @@ namespace clitk
       return OutputCovariantVectorType();
     }
 
+#if ITK_VERSION_MAJOR >= 4
+    virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToParameters" );
+    }
+    virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToPosition" );
+    }
+#else
     virtual const JacobianType& GetJacobian(const InputPointType  &point ) const
     {
       itkExceptionMacro( << "PointListTransform doesn't declare GetJacobian" );
       return this->m_Jacobian;
     }
+#endif
 
   protected:
     PointListTransform();
index 7a7808a2c9f7051798ddef55014886cbbf7fd9b7..a93a309b589284139d8154b33e5d2c97796674d2 100644 (file)
@@ -26,7 +26,11 @@ namespace clitk
   // Constructor
   template<class TScalarType, unsigned int NDimensions, unsigned int NOutputDimensions>
   PointListTransform<TScalarType, NDimensions, NOutputDimensions>
+#if ITK_VERSION_MAJOR >= 4
+  ::PointListTransform():Superclass(1)
+#else
   ::PointListTransform():Superclass(NOutputDimensions,1)
+#endif
   {
     m_PointLists.resize(0);
     m_PointList.resize(1);
index 835123c34d9e78a38a826a677a3c8977d8156f5b..f3071b136c39433e2738063a646b268eadb5bc56 100644 (file)
@@ -263,7 +263,15 @@ namespace clitk
     } 
     
     /** Compute the Jacobian Matrix of the transformation at one point */
+#if ITK_VERSION_MAJOR >= 4
+    virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const;
+    virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
+    {
+      itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented for " << this->GetNameOfClass() );
+    }
+#else
     virtual const JacobianType& GetJacobian(const InputPointType  &point ) const;
+#endif
 
     /** Return the number of parameters that completely define the Transfom */
     virtual unsigned int GetNumberOfParameters(void) const;
@@ -430,6 +438,9 @@ namespace clitk
     // JV Shape
     unsigned int m_TransformShape;
 
+#if ITK_VERSION_MAJOR >= 4
+    mutable JacobianType                            m_SharedDataBSplineJacobian;
+#endif
 
   }; //class ShapedBLUTSpatioTemporalDeformableTransform
 
index ea50aa4d2d27b60918f42fada57225143f4cae4c..cebdb5bae492ec753a7e0e247bf9cf52aa70777b 100644 (file)
@@ -32,7 +32,11 @@ namespace clitk
   // Constructor with default arguments
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
   ShapedBLUTSpatioTemporalDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+#if ITK_VERSION_MAJOR >= 4
+  ::ShapedBLUTSpatioTemporalDeformableTransform():Superclass(0)
+#else
   ::ShapedBLUTSpatioTemporalDeformableTransform():Superclass(OutputDimension,0)
+#endif
   {
     unsigned int i;
     
@@ -802,11 +806,19 @@ namespace clitk
     //=====================================
     //JV Wrap jacobian into OutputDimension X Vectorial images
     //=====================================
+#if ITK_VERSION_MAJOR >= 4
+    this->m_SharedDataBSplineJacobian.set_size( OutputDimension, this->GetNumberOfParameters() );
+#else
     this->m_Jacobian.set_size( OutputDimension, this->GetNumberOfParameters() );
+#endif
 
     // Use memset to set the memory
     // JV four rows of three comps of parameters
+#if ITK_VERSION_MAJOR >= 4
+    JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_SharedDataBSplineJacobian.data_block());
+#else
     JacobianPixelType * jacobianDataPointer = reinterpret_cast<JacobianPixelType *>(this->m_Jacobian.data_block());
+#endif
     memset(jacobianDataPointer, 0,  OutputDimension*numberOfPixels*sizeof(JacobianPixelType));
 
     for (unsigned int j=0; j<OutputDimension; j++)
@@ -2375,11 +2387,17 @@ namespace clitk
   // JV weights are identical as for transformpoint, could be done simultaneously in metric!!!!
   // Compute the Jacobian in one position 
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
+#if ITK_VERSION_MAJOR >= 4
+  void
+  ShapedBLUTSpatioTemporalDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
+  ::ComputeJacobianWithRespectToParameters( const InputPointType & point, JacobianType & jacobian) const
+#else
   const 
   typename ShapedBLUTSpatioTemporalDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
   ::JacobianType & 
   ShapedBLUTSpatioTemporalDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
   ::GetJacobian( const InputPointType & point ) const
+#endif
   {
   
     //========================================================
@@ -2475,7 +2493,12 @@ namespace clitk
     if(m_Mask &&  !(m_Mask->IsInside(point) ) )
       {
        // Outside: no (deformable) displacement
+#if ITK_VERSION_MAJOR >= 4
+        jacobian = m_SharedDataBSplineJacobian;
+        return;
+#else
        return this->m_Jacobian;
+#endif
       }        
 
     // Get index   
@@ -2485,7 +2508,12 @@ namespace clitk
     // we assume zero displacement and return the input point
     if ( !this->InsideValidRegion( m_Index ) )
       {
+#if ITK_VERSION_MAJOR >= 4
+        jacobian = m_SharedDataBSplineJacobian;
+        return;
+#else
        return this->m_Jacobian;
+#endif
       }
 
     // Compute interpolation weights
@@ -2653,7 +2681,11 @@ namespace clitk
       }
 
     // Return the result
+#if ITK_VERSION_MAJOR >= 4
+    jacobian = m_SharedDataBSplineJacobian;
+#else
     return this->m_Jacobian;
+#endif
   }
 
  
index 852583b8373c52a804e9e007b329bf07edd6c645..1b38cae012c10569ca6d8add8bcf8ab490d6fb0c 100644 (file)
@@ -1445,9 +1445,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 +1484,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++ ) {
index 88a71c5a0060c2f82294cb64ad3ab3311d974792..ec4b7ba6ed9c738edd3c15cdb4912311e2e32a79 100644 (file)
@@ -197,9 +197,13 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
-
+#endif
 
       const RealType fixedValue     = ti.Value();
       this->m_NumberOfPixelsCounted++;
@@ -311,9 +315,13 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) ) {
       const RealType movingValue  = this->m_Interpolator->Evaluate( transformedPoint );
 
+#if ITK_VERSION_MAJOR >= 4
+      TransformJacobianType jacobian;
+      this->m_Transform->ComputeJacobianWithRespectToParameters( inputPoint, jacobian );
+#else
       const TransformJacobianType & jacobian =
         this->m_Transform->GetJacobian( inputPoint );
-
+#endif
 
       const RealType fixedValue     = ti.Value();
       this->m_NumberOfPixelsCounted++;