]> Creatis software - clitk.git/blobdiff - filters/clitkImageResampleGenericFilter.cxx
replace "RegionOfInterest" filter with "ExtractImage" (keep origin and so on)
[clitk.git] / filters / clitkImageResampleGenericFilter.cxx
index 81d0d6197d3b046c7ba80f9d1751249398f6dfaa..ab8e1131dad78ff1bd86f13ea6a3609c55286f3f 100644 (file)
@@ -38,6 +38,7 @@
 #include "itkResampleImageFilter.h"
 #include "itkAffineTransform.h"
 #include "itkNearestNeighborInterpolateImageFunction.h"
+#include "itkWindowedSincInterpolateImageFunction.h"
 #include "itkLinearInterpolateImageFunction.h"
 #include "itkBSplineInterpolateImageFunction.h"
 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
@@ -141,22 +142,28 @@ void clitk::ImageResampleGenericFilter::UpdateWithInputImageType()
       typename InterpolatorType::Pointer interpolator =  InterpolatorType::New();
       filter->SetInterpolator(interpolator);
     } else {
-      if (mInterpolatorName == "bspline") {
-        typedef itk::BSplineInterpolateImageFunction<InputImageType, double> InterpolatorType;
-        typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
-        interpolator->SetSplineOrder(mBSplineOrder);
+      if (mInterpolatorName == "windowed sinc") {
+        typedef itk::WindowedSincInterpolateImageFunction<InputImageType, 4> InterpolatorType;
+        typename InterpolatorType::Pointer interpolator =  InterpolatorType::New();
         filter->SetInterpolator(interpolator);
       } else {
-        if (mInterpolatorName == "blut") {
-          typedef itk::BSplineInterpolateImageFunctionWithLUT<InputImageType, double> InterpolatorType;
+        if (mInterpolatorName == "bspline") {
+          typedef itk::BSplineInterpolateImageFunction<InputImageType, double> InterpolatorType;
           typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
           interpolator->SetSplineOrder(mBSplineOrder);
-          interpolator->SetLUTSamplingFactor(mSamplingFactors[0]);
-          filter->SetInterpolator(interpolator);
+          filter->SetInterpolator(interpolator); 
         } else {
-          std::cerr << "Sorry, I do not know the interpolator '" << mInterpolatorName
-                    << "'. Known interpolators are :  nn, linear, bspline, blut" << std::endl;
-          exit(0);
+          if (mInterpolatorName == "blut") {
+            typedef itk::BSplineInterpolateImageFunctionWithLUT<InputImageType, double> InterpolatorType;
+            typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
+            interpolator->SetSplineOrder(mBSplineOrder);
+            interpolator->SetLUTSamplingFactor(mSamplingFactors[0]);
+            filter->SetInterpolator(interpolator);
+          } else {
+            std::cerr << "Sorry, I do not know the interpolator '" << mInterpolatorName
+              << "'. Known interpolators are :  nn, linear, bspline, blut" << std::endl;
+            exit(0);
+          }
         }
       }
     }
@@ -187,7 +194,7 @@ void clitk::ImageResampleGenericFilter::UpdateWithInputImageType()
   try {
     filter->Update();
   } catch( itk::ExceptionObject & err ) {
-    std::cerr << "Error while filtering " << mInputFilenames[0].c_str()
+    std::cerr << "Error while filtering " << m_InputFilenames[0].c_str()
               << " " << err << std::endl;
     exit(0);
   }