]> Creatis software - clitk.git/blobdiff - tools/clitkInvertVFGenericFilter.txx
Set the Root Tree maximum size to 1TB instead of 1GB
[clitk.git] / tools / clitkInvertVFGenericFilter.txx
index 558b34177d48357acd174f7c6fc14f669e20e428..a18a6417c6b0ad26c3efc14225fba5d1c7444153 100644 (file)
@@ -19,6 +19,7 @@
 #define clitkInvertVFGenericFilter_txx
 
 #include "itkVectorResampleImageFilter.h"
+#include "clitkConvertBLUTCoeffsToVFFilter.h"
 
 /* =================================================
  * @file   clitkInvertVFGenericFilter.txx
@@ -172,12 +173,39 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
   }
 
   case 1: {
+    // Create the InvertVFFilter
+    typedef clitk::InvertVFFilter<InputImageType,OutputImageType> FilterType;
+    typename FilterType::Pointer filter =FilterType::New();
+    if (m_ArgsInfo.like_given) {
+      typedef ConvertBLUTCoeffsToVFFilter<InputImageType> 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.pad_given) {
+      PixelType pad;
+      if (m_ArgsInfo.pad_given !=  (pad.GetNumberOfComponents()) )
+        pad.Fill(m_ArgsInfo.pad_arg[0]);
+      else
+        for(unsigned int i=0; i<Dimension; i++)
+          pad[i]=m_ArgsInfo.pad_arg[i];
+    }
+    filter->SetThreadSafe(m_ArgsInfo.threadSafe_flag);
+    filter->Update();
+    output=filter->GetOutput();
+
+    break;
+  }
+
+  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());
@@ -190,6 +218,7 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     break;
   }
 
+    
   }
 
   // Output