]> Creatis software - clitk.git/blobdiff - registration/clitkBSplineDeformableTransform.txx
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkBSplineDeformableTransform.txx
index 1a2dfd3ccab98b4e60deef7e064edf18de99a474..151c25978d222fe6cd14dc65d57e441ca8eac693 100644 (file)
@@ -16,7 +16,7 @@
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================**/
 #ifndef __clitkBSplineDeformableTransform_txx
-#define __clitkBSplineDeformableTransform_tx
+#define __clitkBSplineDeformableTransform_txx
 #include "clitkBSplineDeformableTransform.h"
 
 //itk
@@ -31,12 +31,7 @@ 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
+  BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>::BSplineDeformableTransform():Superclass(0)
   {
     unsigned int i;
     
@@ -255,7 +250,7 @@ namespace clitk
 
   // Get the number of parameters
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
-  unsigned int
+  typename BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>::NumberOfParametersType
   BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
   ::GetNumberOfParameters(void) const
   {
@@ -301,7 +296,7 @@ namespace clitk
        // when spline order is even.
        // The valid interval for evaluation is [start+offset, last-offset)
        // when spline order is odd.
-       // Where offset = vcl_floor(spline / 2 ).
+       // Where offset = std::floor(spline / 2 ).
        // Note that the last pixel is not included in the valid region
        // with odd spline orders.
        typename RegionType::SizeType size = m_GridRegion.GetSize();
@@ -580,18 +575,11 @@ 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;
@@ -916,7 +904,6 @@ 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>
@@ -978,76 +965,7 @@ namespace clitk
     jacobian = m_SharedDataBSplineJacobian;
 
   }
-#else
-  template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>
-  const 
-  typename BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
-  ::JacobianType & 
-  BSplineDeformableTransform<TCoordRep, NInputDimensions, NOutputDimensions>
-  ::GetJacobian( const InputPointType & point ) const
-  {
-    // Can only compute Jacobian if parameters are set via
-    // SetParameters or SetParametersByValue
-    //     if( m_InputParametersPointer == NULL )
-    //       {
-    //         itkExceptionMacro( <<"Cannot compute Jacobian: parameters not set" );
-    //       }
-
-    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
-       return this->m_Jacobian;
-      }        
-
-    //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 ) )
-      {
-       return this->m_Jacobian;
-      }
-
-    //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
-    return this->m_Jacobian;
-
-  }
-#endif
 
 
   template<class TCoordRep, unsigned int NInputDimensions, unsigned int NOutputDimensions>