From d8e6a6c0b380c2e7b542a2b9d922dc982a3d0d85 Mon Sep 17 00:00:00 2001 From: schaerer Date: Thu, 17 Jun 2010 14:39:26 +0000 Subject: [PATCH] ported my changes to the new filter. Need to port the vv tool to use it, and add the automatic gaussian filter stuff will do so a day when simon + david are available :) --- filters/clitkResampleImageGenericFilter.txx | 10 +++++++--- itk/clitkResampleImageWithOptionsFilter.h | 3 ++- itk/clitkResampleImageWithOptionsFilter.txx | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/filters/clitkResampleImageGenericFilter.txx b/filters/clitkResampleImageGenericFilter.txx index 3b57f76..fb4c80d 100644 --- a/filters/clitkResampleImageGenericFilter.txx +++ b/filters/clitkResampleImageGenericFilter.txx @@ -146,9 +146,13 @@ clitk::ResampleImageGenericFilter::UpdateWithInputImageType() if (interp == "blut") { filter->SetInterpolationType(ResampleImageFilterType::B_LUT); } else { - std::cerr << "Error. I do not know interpolation '" << mArgsInfo.interp_arg - << "'. Choose among: nn, linear, bspline, blut" << std::endl; - exit(0); + if (interp == "windowed sinc") { + filter->SetInterpolationType(ResampleImageFilterType::WSINC); + } else { + std::cerr << "Error. I do not know interpolation '" << mArgsInfo.interp_arg + << "'. Choose among: nn, linear, bspline, blut, windowed sinc" << std::endl; + exit(0); + } } } } diff --git a/itk/clitkResampleImageWithOptionsFilter.h b/itk/clitkResampleImageWithOptionsFilter.h index d997a3d..d90c724 100644 --- a/itk/clitkResampleImageWithOptionsFilter.h +++ b/itk/clitkResampleImageWithOptionsFilter.h @@ -80,7 +80,8 @@ namespace clitk { NearestNeighbor = 0, Linear = 1, BSpline = 2, - B_LUT = 3 + B_LUT = 3, + WSINC } InterpolationTypeEnumeration; /** Input : image to resample */ diff --git a/itk/clitkResampleImageWithOptionsFilter.txx b/itk/clitkResampleImageWithOptionsFilter.txx index b9969da..aa09f71 100644 --- a/itk/clitkResampleImageWithOptionsFilter.txx +++ b/itk/clitkResampleImageWithOptionsFilter.txx @@ -28,6 +28,7 @@ #include "itkResampleImageFilter.h" #include "itkAffineTransform.h" #include "itkNearestNeighborInterpolateImageFunction.h" +#include "itkWindowedSincInterpolateImageFunction.h" #include "itkLinearInterpolateImageFunction.h" #include "itkBSplineInterpolateImageFunction.h" #include "itkBSplineInterpolateImageFunctionWithLUT.h" @@ -213,6 +214,7 @@ GenerateData() case Linear: std::cout << "Linear" << std::endl; break; case BSpline: std::cout << "BSpline " << m_BSplineOrder << std::endl; break; case B_LUT: std::cout << "B-LUT " << m_BSplineOrder << " " << m_BLUTSamplingFactor << std::endl; break; + case WSINC: std::cout << "Windowed Sinc" << std::endl; break; } std::cout << "Threads = " << this->GetNumberOfThreads() << std::endl; std::cout << "LastDimIsTime = " << m_LastDimensionIsTime << std::endl; @@ -257,6 +259,12 @@ GenerateData() filter->SetInterpolator(interpolator); break; } + case WSINC: { + typedef itk::WindowedSincInterpolateImageFunction InterpolatorType; + typename InterpolatorType::Pointer interpolator = InterpolatorType::New(); + filter->SetInterpolator(interpolator); + break; + } } // Initial Gaussian blurring if needed -- 2.47.1