From: Vivien Delmon Date: Mon, 12 Sep 2011 14:45:03 +0000 (+0200) Subject: itk4 Remove ITK_USE_OPTIMIZED_REGISTRATION_METHODS X-Git-Tag: v1.3.0~215^2~11 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=05736c934c5ecc1c43179f93db6aa778272d5aa9;p=clitk.git itk4 Remove ITK_USE_OPTIMIZED_REGISTRATION_METHODS - Bypass all ITK_USE_OPTIMIZED_REGISTRATION_METHODS with ITK 4. All optimized version are now the normal version in itk4. - Include itkImageToImageMetric.h instead of itkOptImageToImageMetric.h - Rename GetJacobian to ComputeJacobianWithRespectToParameters. --- diff --git a/registration/clitkAffineRegistrationGenericFilter.cxx b/registration/clitkAffineRegistrationGenericFilter.cxx index 0c93f78..3f0145e 100644 --- a/registration/clitkAffineRegistrationGenericFilter.cxx +++ b/registration/clitkAffineRegistrationGenericFilter.cxx @@ -176,7 +176,7 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType() //typedef typename InputImageType::ImageDimension Dimension; -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 bool threadsGiven=m_ArgsInfo.threads_given; int threads=m_ArgsInfo.threads_arg; #endif @@ -396,7 +396,7 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType() typename MetricType::Pointer metric=genericMetric->GetMetricPointer(); if (movingMask) metric->SetMovingImageMask(movingMask); -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 if (threadsGiven) metric->SetNumberOfThreads( threads ); #else if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<GetMetricPointer(); if (movingMask) metric->SetMovingImageMask(movingMask); -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 if (threadsGiven) { metric->SetNumberOfThreads( threads ); if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl; diff --git a/registration/clitkGenericMetric.h b/registration/clitkGenericMetric.h index 5f6eb51..ad03c71 100644 --- a/registration/clitkGenericMetric.h +++ b/registration/clitkGenericMetric.h @@ -143,7 +143,7 @@ private: typename FixedImageType::Pointer m_FixedImage; typename FixedImageMaskType::ConstPointer m_FixedImageMask; -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 FixedImagePixelType m_FixedImageSamplesIntensityThreshold; bool m_UseFixedImageSamplesIntensityThreshold; #endif diff --git a/registration/clitkGenericMetric.txx b/registration/clitkGenericMetric.txx index e73644c..cbbcaa0 100644 --- a/registration/clitkGenericMetric.txx +++ b/registration/clitkGenericMetric.txx @@ -35,7 +35,7 @@ GenericMetric::GenericMetric() m_Maximize=false; m_Verbose=false; m_FixedImageRegionGiven=false; -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 m_FixedImageSamplesIntensityThreshold=0; m_UseFixedImageSamplesIntensityThreshold=false; #endif @@ -274,7 +274,7 @@ GenericMetric::GetMetricPointer( //m_Metric->SetFixedImageRegion(mask_region); -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 //============================================================================ // Set the lower intensity threshold diff --git a/registration/clitkNormalizedCorrelationImageToImageMetric.h b/registration/clitkNormalizedCorrelationImageToImageMetric.h index 053a497..e6b704b 100644 --- a/registration/clitkNormalizedCorrelationImageToImageMetric.h +++ b/registration/clitkNormalizedCorrelationImageToImageMetric.h @@ -24,7 +24,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 "clitkOptNormalizedCorrelationImageToImageMetric.h" #else diff --git a/registration/clitkNormalizedCorrelationImageToImageMetric.txx b/registration/clitkNormalizedCorrelationImageToImageMetric.txx index d87bd0b..69aa81f 100644 --- a/registration/clitkNormalizedCorrelationImageToImageMetric.txx +++ b/registration/clitkNormalizedCorrelationImageToImageMetric.txx @@ -24,7 +24,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 "clitkOptNormalizedCorrelationImageToImageMetric.txx" #else diff --git a/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h b/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h index f7a40df..7a7d2b1 100644 --- a/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h +++ b/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h @@ -24,7 +24,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 "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h" #else diff --git a/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx b/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx index 8aa553f..16ecec4 100644 --- a/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/clitkNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx @@ -24,7 +24,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 "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx" #else diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h index 6ea6572..83448af 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h @@ -19,7 +19,11 @@ #ifndef __clitkOptNormalizedCorrelationImageToImageMetric_h #define __clitkOptNormalizedCorrelationImageToImageMetric_h -#include "itkOptImageToImageMetric.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkImageToImageMetric.h" +#else + #include "itkOptImageToImageMetric.h" +#endif #include "itkCovariantVector.h" #include "itkPoint.h" #include "itkIndex.h" diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx index ea5d9a5..e8d4c27 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx @@ -381,8 +381,13 @@ NormalizedCorrelationImageToImageMetric } // Jacobian should be evaluated at the unmapped (fixed image) point. +#if ITK_VERSION_MAJOR >= 4 + TransformJacobianType jacobian; + transform->ComputeJacobianWithRespectToParameters(fixedImagePoint, jacobian); +#else const TransformJacobianType & jacobian = transform ->GetJacobian( fixedImagePoint ); +#endif for(unsigned int par=0; parm_NumberOfParameters; par++) { RealType sumF = itk::NumericTraits< RealType >::Zero; diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h index 69ac6f1..65559c2 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h @@ -19,7 +19,11 @@ #ifndef __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h #define __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h -#include "itkOptImageToImageMetric.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkImageToImageMetric.h" +#else + #include "itkOptImageToImageMetric.h" +#endif #include "itkCovariantVector.h" #include "itkPoint.h" #include "itkIndex.h" diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx index de0366e..643b802 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx @@ -381,7 +381,12 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD } // Jacobian should be evaluated at the unmapped (fixed image) point. +#if ITK_VERSION_MAJOR >= 4 + TransformJacobianType jacobian; + transform->ComputeJacobianWithRespectToParameters( fixedImagePoint, jacobian ); +#else const TransformJacobianType & jacobian = transform->GetJacobian( fixedImagePoint ); +#endif // for(unsigned int par=0; parm_NumberOfParameters; par++) // { diff --git a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx index 963fb78..0ef06ab 100644 --- a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx +++ b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx @@ -623,7 +623,7 @@ namespace clitk typename MetricType::Pointer metric=genericMetric->GetMetricPointer(); if (movingMask) metric->SetMovingImageMask(movingMask); -#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS +#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 if (threadsGiven) metric->SetNumberOfThreads( threads ); #else if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<= 4 #include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h" #else diff --git a/registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx b/registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx index 7e50dc9..9391dc2 100644 --- a/registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx @@ -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 diff --git a/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h b/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h index e2cfdbd..f6d745d 100644 --- a/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h +++ b/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.h @@ -40,7 +40,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 "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h" #else diff --git a/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx b/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx index 89343e9..d6793e5 100644 --- a/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkMeanSquaresImageToImageMetricFor3DBLUTFFD.txx @@ -40,7 +40,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 "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx" #else diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h index d29260a..7cfe51e 100644 --- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h +++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h @@ -35,7 +35,11 @@ #ifndef __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h #define __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h -#include "itkOptImageToImageMetric.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkImageToImageMetric.h" +#else + #include "itkOptImageToImageMetric.h" +#endif #include "itkCovariantVector.h" #include "itkPoint.h" #include "itkIndex.h" diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx index 724f2bf..9099ca4 100644 --- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx @@ -1152,8 +1152,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD transform = this->m_Transform; } +#if ITK_VERSION_MAJOR >= 4 + JacobianType jacobian; + transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[sampleNumber].point, jacobian); +#else const JacobianType& jacobian = transform->GetJacobian( this->m_FixedImageSamples[sampleNumber].point ); +#endif // for ( unsigned int mu = 0; mu < this->m_NumberOfParameters; mu++ ) // { @@ -1221,9 +1226,15 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD indicesHelper = &(this->m_BSplineTransformIndices); } +#if ITK_VERSION_MAJOR >= 4 + this->m_BSplineTransform->ComputeJacobianFromBSplineWeightsWithRespectToPosition( + this->m_FixedImageSamples[sampleNumber].point, + *weightsHelper, *indicesHelper ); +#else this->m_BSplineTransform->GetJacobian( this->m_FixedImageSamples[sampleNumber].point, *weightsHelper, *indicesHelper ); +#endif } for( unsigned int dim = 0; dim < Superclass::FixedImageDimension; dim++ ) { diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h index 4e82085..acb0b1b 100644 --- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h +++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h @@ -35,7 +35,11 @@ #ifndef __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h #define __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h -#include "itkOptImageToImageMetric.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkImageToImageMetric.h" +#else + #include "itkOptImageToImageMetric.h" +#endif #include "itkCovariantVector.h" #include "itkPoint.h" #include "itkIndex.h" diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx index dcc98f6..feaeaaf 100644 --- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx @@ -213,7 +213,12 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD } // Jacobian should be evaluated at the unmapped (fixed image) point. +#if ITK_VERSION_MAJOR >= 4 + TransformJacobianType jacobian; + transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[fixedImageSample].point, jacobian); +#else const TransformJacobianType & jacobian = transform ->GetJacobian( this->m_FixedImageSamples[fixedImageSample].point ); +#endif //double sum; unsigned int par, dim; for( par=0; parm_NumberOfParameters; par+=3) {