X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkInvertVFGenericFilter.txx;h=93ad21f9aca5c3862c5ec905bb70d5cbf9c97a1f;hb=998ca9ca987553dc71578e5584e881f6bd537d91;hp=e4b590e060b757c4d298dbabe7d0e33a88e7ec10;hpb=5be83a695bafa815cca85e180c0070e30020fa4c;p=clitk.git diff --git a/tools/clitkInvertVFGenericFilter.txx b/tools/clitkInvertVFGenericFilter.txx index e4b590e..93ad21f 100644 --- a/tools/clitkInvertVFGenericFilter.txx +++ b/tools/clitkInvertVFGenericFilter.txx @@ -18,8 +18,12 @@ #ifndef clitkInvertVFGenericFilter_txx #define clitkInvertVFGenericFilter_txx +#if ( ITK_VERSION_MAJOR < 5 ) #include "itkVectorResampleImageFilter.h" -#include "clitkCoeffsToDVF.h" +#else +#include "itkResampleImageFilter.h" +#endif +#include "clitkConvertBLUTCoeffsToVFFilter.h" /* ================================================= * @file clitkInvertVFGenericFilter.txx @@ -140,7 +144,11 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() spacing[i] = header->GetSpacing(i); } +#if ( ITK_VERSION_MAJOR < 5 ) typedef itk::VectorResampleImageFilter ResampleFilterType; +#else + typedef itk::ResampleImageFilter ResampleFilterType; +#endif typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); resampler->SetInput(input); resampler->SetOutputOrigin(input->GetOrigin()); @@ -156,7 +164,13 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() filter->SetInput(input); filter->SetVerbose(m_Verbose); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); + if (m_ArgsInfo.threads_given) { +#if ITK_VERSION_MAJOR <= 4 + filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); +#else + filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg); +#endif + } if (m_ArgsInfo.pad_given) { PixelType pad; if (m_ArgsInfo.pad_given != (pad.GetNumberOfComponents()) ) @@ -177,11 +191,23 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() typedef clitk::InvertVFFilter FilterType; typename FilterType::Pointer filter =FilterType::New(); if (m_ArgsInfo.like_given) { - filter->SetInput(CoeffsToDVF(m_InputFileName, m_ArgsInfo.like_arg)); + typedef ConvertBLUTCoeffsToVFFilter VFFilterType; + typename VFFilterType::Pointer vf_filter = VFFilterType::New(); + vf_filter->SetInputFileName(m_InputFileName); + vf_filter->SetLikeFileName(m_ArgsInfo.like_arg); + vf_filter->SetVerbose(m_Verbose); + vf_filter->Update(); + filter->SetInput(vf_filter->GetOutput()); } filter->SetVerbose(m_Verbose); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); + if (m_ArgsInfo.threads_given) { +#if ITK_VERSION_MAJOR <= 4 + filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); +#else + filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg); +#endif + } if (m_ArgsInfo.pad_given) { PixelType pad; if (m_ArgsInfo.pad_given != (pad.GetNumberOfComponents()) ) @@ -199,11 +225,7 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() case 2: { // Create the InverseDeformationFieldFilter -#if ITK_VERSION_MAJOR >= 4 typedef itk::InverseDisplacementFieldImageFilter FilterType; -#else - typedef itk::InverseDeformationFieldImageFilter FilterType; -#endif typename FilterType::Pointer filter =FilterType::New(); filter->SetInput(input); filter->SetOutputOrigin(input->GetOrigin());