]> Creatis software - clitk.git/commitdiff
itk4 migration
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 18 May 2011 08:52:57 +0000 (10:52 +0200)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 18 May 2011 08:52:57 +0000 (10:52 +0200)
- BinaryFunctorImageFilters taking constant were removed from itk by
  adding SetConstant method to their Image x Image counterpart.

itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx

index a9f8a910893efd4049270c3dbfeb8bf2b794524e..54f431109728bd8b31b4bdbd8b5d09cc9679e441 100644 (file)
 #include <itkBinaryErodeImageFilter.h>
 #include <itkBinaryBallStructuringElement.h>
 #include <itkAddImageFilter.h>
-#include <itkDivideByConstantImageFilter.h>
+#if ITK_VERSION_MAJOR >= 4
+  #include <itkDivideImageFilter.h>
+#else
+  #include <itkDivideByConstantImageFilter.h>
+#endif
 
 // itk [Bloch et al] 
 #include "RelativePositionPropImageFilter.h"
@@ -359,10 +363,16 @@ GenerateData()
 
   // Divide by the number of relpos
   if (GetNumberOfAngles() != 1) {
+#if ITK_VERSION_MAJOR >= 4
+    typedef itk::DivideImageFilter<FloatImageType, FloatImageType, FloatImageType> DivideFilter;
+    typename DivideFilter::Pointer divideFilter = DivideFilter::New();
+    divideFilter->SetConstant2(GetNumberOfAngles());
+#else
     typedef itk::DivideByConstantImageFilter<FloatImageType, float, FloatImageType> DivideFilter;
     typename DivideFilter::Pointer divideFilter = DivideFilter::New();
-    divideFilter->SetInput(m_FuzzyMap);
     divideFilter->SetConstant(GetNumberOfAngles());
+#endif
+    divideFilter->SetInput(m_FuzzyMap);
     divideFilter->Update();
     m_FuzzyMap = divideFilter->GetOutput();
   }