]> Creatis software - clitk.git/commitdiff
Remove vnl_math dependency into registration codes
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 15 Feb 2019 15:38:17 +0000 (16:38 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 15 Feb 2019 15:56:57 +0000 (16:56 +0100)
Necessary because ITK5 remove vnl_math dependency

registration/clitkCorrelationRatioImageToImageMetric.txx
registration/clitkMultiResolutionPDEDeformableRegistration.txx
registration/clitkRecursiveSpatioTemporalMultiResolutionPyramidImageFilter.txx
registration/clitkSpatioTemporalMultiResolutionPyramidImageFilter.txx

index f6b5af11cb7abae02d367d9fc80dce70257ceaae..d76f020e586f6471d0d2089f8d4d3d96cb82384e 100644 (file)
@@ -289,7 +289,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 
       typename MovingImageType::IndexType mappedIndex;
       for( unsigned int j = 0; j < MovingImageType::ImageDimension; j++ ) {
-        mappedIndex[j] = static_cast<long>( vnl_math_rnd( tempIndex[j] ) );
+        mappedIndex[j] = static_cast<long>( std::round( tempIndex[j] ) );
       }
 
       const GradientPixelType gradient =
@@ -409,7 +409,7 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 
       typename MovingImageType::IndexType mappedIndex;
       for( unsigned int j = 0; j < MovingImageType::ImageDimension; j++ ) {
-        mappedIndex[j] = static_cast<long>( vnl_math_rnd( tempIndex[j] ) );
+        mappedIndex[j] = static_cast<long>( std::round( tempIndex[j] ) );
       }
 
       const GradientPixelType gradient =
index c8312e6e173085225a1a53181e01897c83123a6c..73cb497f90607af1fdf4f599ac8c16482bb2e347 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "itkRecursiveMultiResolutionPyramidImageFilter.h"
 #include "itkImageRegionIterator.h"
-#include "vnl/vnl_math.h"
 
 namespace clitk {
 
@@ -260,10 +259,10 @@ MultiResolutionPDEDeformableRegistration<TFixedImage,TMovingImage,TDeformationFi
   m_CurrentLevel = 0;
   m_StopRegistrationFlag = false;
 
-  unsigned int movingLevel = vnl_math_min( (int) m_CurrentLevel, 
+  unsigned int movingLevel = std::min( (int) m_CurrentLevel,
                                           (int) m_MovingImagePyramid->GetNumberOfLevels() );
 
-  unsigned int fixedLevel = vnl_math_min( (int) m_CurrentLevel, 
+  unsigned int fixedLevel = std::min( (int) m_CurrentLevel,
                                          (int) m_FixedImagePyramid->GetNumberOfLevels() );
 
   DeformationFieldPointer tempField = ITK_NULLPTR;
@@ -387,9 +386,9 @@ MultiResolutionPDEDeformableRegistration<TFixedImage,TMovingImage,TDeformationFi
 
     // Increment level counter.  
     m_CurrentLevel++;
-    movingLevel = vnl_math_min( (int) m_CurrentLevel, 
+    movingLevel = std::min( (int) m_CurrentLevel,
                                (int) m_MovingImagePyramid->GetNumberOfLevels() );
-    fixedLevel = vnl_math_min( (int) m_CurrentLevel, 
+    fixedLevel = std::min( (int) m_CurrentLevel,
                               (int) m_FixedImagePyramid->GetNumberOfLevels() );
 
     // We can release data from pyramid which are no longer required.
index 12e90f8936d6269b27c0c5381dad2c09b5eea9d0..822c4ef7710b9385611f8e9f3969b52569d78886 100644 (file)
@@ -27,8 +27,6 @@
 #include "itkShrinkImageFilter.h"
 #include "itkIdentityTransform.h"
 
-#include "vnl/vnl_math.h"
-
 namespace clitk
 {
 
@@ -147,7 +145,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputIma
         factors[idim] = this->GetSchedule()[ilevel][idim] /
           this->GetSchedule()[ilevel+1][idim];
         }
-      variance[idim] = vnl_math_sqr( 0.5 * 
+      variance[idim] = std::sqr( 0.5 *
                                      static_cast<float>( factors[idim] ) );
       if( factors[idim] != 1 ) 
         { 
@@ -314,7 +312,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputIma
       if( factors[idim] > 1 )
         {
         oper->SetDirection( idim );
-        oper->SetVariance( vnl_math_sqr( 0.5 * 
+        oper->SetVariance( std::sqr( 0.5 *
                                          static_cast<float>( factors[idim] ) ) );
         oper->CreateDirectional();
         radius[idim] = oper->GetRadius()[idim];
@@ -352,7 +350,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputIma
       if( factors[idim] > 1 )
         {
         oper->SetDirection( idim );
-        oper->SetVariance( vnl_math_sqr( 0.5 * 
+        oper->SetVariance( std::sqr( 0.5 *
                                          static_cast<float>( factors[idim] ) ) );
         oper->CreateDirectional();
         radius[idim] = oper->GetRadius()[idim];
@@ -450,7 +448,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputIma
   for( idim = 0; idim < TInputImage::ImageDimension; idim++ )
     {
     oper->SetDirection(idim);
-    oper->SetVariance( vnl_math_sqr( 0.5 * static_cast<float>(
+    oper->SetVariance( std::sqr( 0.5 * static_cast<float>(
                                        this->GetSchedule()[refLevel][idim] ) ) );
     oper->SetMaximumError( this->GetMaximumError() );
     oper->CreateDirectional();
index 7c702b2869981629eeca47c6457186f3b39f5fb0..d6b3c880a47ccdf0643ce53c6585abebb5994655 100644 (file)
@@ -26,8 +26,6 @@
 #include "itkShrinkImageFilter.h"
 #include "itkIdentityTransform.h"
 
-#include "vnl/vnl_math.h"
-
 namespace clitk
 {
 
@@ -218,7 +216,7 @@ SpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputImage>
          //  schedule[level-1] );
          if( level > 0 )
            {
-             m_Schedule[level][dim] = vnl_math_min( m_Schedule[level][dim], m_Schedule[level-1][dim] );
+             m_Schedule[level][dim] = std::min( m_Schedule[level][dim], m_Schedule[level-1][dim] );
            }
          
          if( m_Schedule[level][dim] < 1 )
@@ -331,7 +329,7 @@ SpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputImage>
     for( idim = 0; idim < ImageDimension; idim++ )
       {
       factors[idim] = m_Schedule[ilevel][idim];
-      variance[idim] = vnl_math_sqr( 0.5 *
+      variance[idim] = std::sqr( 0.5 *
                                      static_cast<float>( factors[idim] ) );
       }
 
@@ -605,7 +603,7 @@ SpatioTemporalMultiResolutionPyramidImageFilter<TInputImage, TOutputImage>
   for( idim = 0; idim < TInputImage::ImageDimension; idim++ )
     {
     oper->SetDirection(idim);
-    oper->SetVariance( vnl_math_sqr( 0.5 * static_cast<float>(
+    oper->SetVariance( std::sqr( 0.5 * static_cast<float>(
                                        m_Schedule[refLevel][idim] ) ) );
     oper->SetMaximumError( m_MaximumError );
     oper->CreateDirectional();