]> Creatis software - clitk.git/blobdiff - tools/clitkInvertVFGenericFilter.txx
With ITKv5, change VectorResample and VectorCast Image Filter to Resample and Cast...
[clitk.git] / tools / clitkInvertVFGenericFilter.txx
index 812ed0c69db5737b56b0eccc26e68c48dab90f3b..93ad21f9aca5c3862c5ec905bb70d5cbf9c97a1f 100644 (file)
 #ifndef clitkInvertVFGenericFilter_txx
 #define clitkInvertVFGenericFilter_txx
 
+#if ( ITK_VERSION_MAJOR < 5 )
 #include "itkVectorResampleImageFilter.h"
+#else
+#include "itkResampleImageFilter.h"
+#endif
 #include "clitkConvertBLUTCoeffsToVFFilter.h"
 
 /* =================================================
@@ -140,7 +144,11 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
         spacing[i] = header->GetSpacing(i);
       }
 
+#if ( ITK_VERSION_MAJOR < 5 )
       typedef itk::VectorResampleImageFilter<InputImageType, OutputImageType> ResampleFilterType;
+#else
+      typedef itk::ResampleImageFilter<InputImageType, OutputImageType> ResampleFilterType;
+#endif
       typename ResampleFilterType::Pointer resampler = ResampleFilterType::New();
       resampler->SetInput(input);
       resampler->SetOutputOrigin(input->GetOrigin());
@@ -156,7 +164,13 @@ InvertVFGenericFilter<args_info_type>::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()) )
@@ -187,7 +201,13 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     }
 
     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()) )
@@ -205,11 +225,7 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
 
   case 2: {
     // Create the InverseDeformationFieldFilter
-#if ITK_VERSION_MAJOR >= 4
     typedef itk::InverseDisplacementFieldImageFilter<InputImageType,OutputImageType> FilterType;
-#else
-    typedef itk::InverseDeformationFieldImageFilter<InputImageType,OutputImageType> FilterType;
-#endif
     typename FilterType::Pointer filter =FilterType::New();
     filter->SetInput(input);
     filter->SetOutputOrigin(input->GetOrigin());