From 349758beccea2d028231dbf847dafccbccb44be1 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 15 Feb 2019 16:38:17 +0100 Subject: [PATCH] Remove vnl_math dependency into registration codes Necessary because ITK5 remove vnl_math dependency --- .../clitkCorrelationRatioImageToImageMetric.txx | 4 ++-- .../clitkMultiResolutionPDEDeformableRegistration.txx | 9 ++++----- ...SpatioTemporalMultiResolutionPyramidImageFilter.txx | 10 ++++------ ...SpatioTemporalMultiResolutionPyramidImageFilter.txx | 8 +++----- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/registration/clitkCorrelationRatioImageToImageMetric.txx b/registration/clitkCorrelationRatioImageToImageMetric.txx index f6b5af1..d76f020 100644 --- a/registration/clitkCorrelationRatioImageToImageMetric.txx +++ b/registration/clitkCorrelationRatioImageToImageMetric.txx @@ -289,7 +289,7 @@ CorrelationRatioImageToImageMetric typename MovingImageType::IndexType mappedIndex; for( unsigned int j = 0; j < MovingImageType::ImageDimension; j++ ) { - mappedIndex[j] = static_cast( vnl_math_rnd( tempIndex[j] ) ); + mappedIndex[j] = static_cast( std::round( tempIndex[j] ) ); } const GradientPixelType gradient = @@ -409,7 +409,7 @@ CorrelationRatioImageToImageMetric typename MovingImageType::IndexType mappedIndex; for( unsigned int j = 0; j < MovingImageType::ImageDimension; j++ ) { - mappedIndex[j] = static_cast( vnl_math_rnd( tempIndex[j] ) ); + mappedIndex[j] = static_cast( std::round( tempIndex[j] ) ); } const GradientPixelType gradient = diff --git a/registration/clitkMultiResolutionPDEDeformableRegistration.txx b/registration/clitkMultiResolutionPDEDeformableRegistration.txx index c8312e6..73cb497 100644 --- a/registration/clitkMultiResolutionPDEDeformableRegistration.txx +++ b/registration/clitkMultiResolutionPDEDeformableRegistration.txx @@ -21,7 +21,6 @@ #include "itkRecursiveMultiResolutionPyramidImageFilter.h" #include "itkImageRegionIterator.h" -#include "vnl/vnl_math.h" namespace clitk { @@ -260,10 +259,10 @@ MultiResolutionPDEDeformableRegistrationGetNumberOfLevels() ); - 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 @@ MultiResolutionPDEDeformableRegistrationGetNumberOfLevels() ); - 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. diff --git a/registration/clitkRecursiveSpatioTemporalMultiResolutionPyramidImageFilter.txx b/registration/clitkRecursiveSpatioTemporalMultiResolutionPyramidImageFilter.txx index 12e90f8..822c4ef 100644 --- a/registration/clitkRecursiveSpatioTemporalMultiResolutionPyramidImageFilter.txx +++ b/registration/clitkRecursiveSpatioTemporalMultiResolutionPyramidImageFilter.txx @@ -27,8 +27,6 @@ #include "itkShrinkImageFilter.h" #include "itkIdentityTransform.h" -#include "vnl/vnl_math.h" - namespace clitk { @@ -147,7 +145,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilterGetSchedule()[ilevel][idim] / this->GetSchedule()[ilevel+1][idim]; } - variance[idim] = vnl_math_sqr( 0.5 * + variance[idim] = std::sqr( 0.5 * static_cast( factors[idim] ) ); if( factors[idim] != 1 ) { @@ -314,7 +312,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter 1 ) { oper->SetDirection( idim ); - oper->SetVariance( vnl_math_sqr( 0.5 * + oper->SetVariance( std::sqr( 0.5 * static_cast( factors[idim] ) ) ); oper->CreateDirectional(); radius[idim] = oper->GetRadius()[idim]; @@ -352,7 +350,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilter 1 ) { oper->SetDirection( idim ); - oper->SetVariance( vnl_math_sqr( 0.5 * + oper->SetVariance( std::sqr( 0.5 * static_cast( factors[idim] ) ) ); oper->CreateDirectional(); radius[idim] = oper->GetRadius()[idim]; @@ -450,7 +448,7 @@ RecursiveSpatioTemporalMultiResolutionPyramidImageFilterSetDirection(idim); - oper->SetVariance( vnl_math_sqr( 0.5 * static_cast( + oper->SetVariance( std::sqr( 0.5 * static_cast( this->GetSchedule()[refLevel][idim] ) ) ); oper->SetMaximumError( this->GetMaximumError() ); oper->CreateDirectional(); diff --git a/registration/clitkSpatioTemporalMultiResolutionPyramidImageFilter.txx b/registration/clitkSpatioTemporalMultiResolutionPyramidImageFilter.txx index 7c702b2..d6b3c88 100644 --- a/registration/clitkSpatioTemporalMultiResolutionPyramidImageFilter.txx +++ b/registration/clitkSpatioTemporalMultiResolutionPyramidImageFilter.txx @@ -26,8 +26,6 @@ #include "itkShrinkImageFilter.h" #include "itkIdentityTransform.h" -#include "vnl/vnl_math.h" - namespace clitk { @@ -218,7 +216,7 @@ SpatioTemporalMultiResolutionPyramidImageFilter // 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 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( factors[idim] ) ); } @@ -605,7 +603,7 @@ SpatioTemporalMultiResolutionPyramidImageFilter for( idim = 0; idim < TInputImage::ImageDimension; idim++ ) { oper->SetDirection(idim); - oper->SetVariance( vnl_math_sqr( 0.5 * static_cast( + oper->SetVariance( std::sqr( 0.5 * static_cast( m_Schedule[refLevel][idim] ) ) ); oper->SetMaximumError( m_MaximumError ); oper->CreateDirectional(); -- 2.47.1