Skip to content

Commit

Permalink
ENH: Increase forward/inverse 1D FFT filters' coverage
Browse files Browse the repository at this point in the history
Increase forward/inverse 1D FFT filters' coverage.

Remove the explicit calls to the `Print` method and rely on the basic
method exercising macro call.
  • Loading branch information
jhlegarreta committed Oct 8, 2021
1 parent 69b7c4e commit 89837f6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
23 changes: 21 additions & 2 deletions Modules/Filtering/FFT/test/itkForward1DFFTImageFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#if defined(ITK_USE_FFTWD) || defined(ITK_USE_FFTWF)
# include "itkFFTWForward1DFFTImageFilter.h"
#endif
#include "itkTestingMacros.h"

template <typename FFTType>
int
Expand Down Expand Up @@ -70,8 +71,6 @@ doTest(const char * inputImage, const char * outputImagePrefix)
return EXIT_FAILURE;
}

fft.Print(std::cout);

return EXIT_SUCCESS;
}

Expand Down Expand Up @@ -105,17 +104,37 @@ itkForward1DFFTImageFilterTest(int argc, char * argv[])
if (backend == 0)
{
using FFTForwardType = itk::Forward1DFFTImageFilter<ImageType, ComplexImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTForwardType::Pointer fft = FFTForwardType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, Forward1DFFTImageFilter, ImageToImageFilter);

itk::SizeValueType sizeGreatestPrimeFactor = 2;
ITK_TEST_SET_GET_VALUE(sizeGreatestPrimeFactor, fft->GetSizeGreatestPrimeFactor());

return doTest<FFTForwardType>(argv[1], argv[2]);
}
else if (backend == 1)
{
using FFTForwardType = itk::VnlForward1DFFTImageFilter<ImageType, ComplexImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTForwardType::Pointer fft = FFTForwardType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, VnlForward1DFFTImageFilter, Forward1DFFTImageFilter);


return doTest<FFTForwardType>(argv[1], argv[2]);
}
else if (backend == 2)
{
#if defined(ITK_USE_FFTWD) || defined(ITK_USE_FFTWF)
using FFTForwardType = itk::FFTWForward1DFFTImageFilter<ImageType, ComplexImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTForwardType::Pointer fft = FFTForwardType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, FFTWForward1DFFTImageFilter, Forward1DFFTImageFilter);


return doTest<FFTForwardType>(argv[1], argv[2]);
#endif
}
Expand Down
24 changes: 22 additions & 2 deletions Modules/Filtering/FFT/test/itkInverse1DFFTImageFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#if defined(ITK_USE_FFTWD) || defined(ITK_USE_FFTWF)
# include "itkFFTWInverse1DFFTImageFilter.h"
#endif
#include "itkTestingMacros.h"

template <typename FFTType>
int
Expand Down Expand Up @@ -65,8 +66,6 @@ doTest(const char * inputRealFullImage, const char * inputImaginaryFullImage, co
return EXIT_FAILURE;
}

fft.Print(std::cout);

return EXIT_SUCCESS;
}

Expand Down Expand Up @@ -104,17 +103,38 @@ itkInverse1DFFTImageFilterTest(int argc, char * argv[])
if (backend == 0)
{
using FFTInverseType = itk::Inverse1DFFTImageFilter<ComplexImageType, ImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTInverseType::Pointer fft = FFTInverseType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, Inverse1DFFTImageFilter, ImageToImageFilter);

itk::SizeValueType sizeGreatestPrimeFactor = 2;
ITK_TEST_SET_GET_VALUE(sizeGreatestPrimeFactor, fft->GetSizeGreatestPrimeFactor());


return doTest<FFTInverseType>(argv[1], argv[2], argv[3]);
}
else if (backend == 1)
{
using FFTInverseType = itk::VnlInverse1DFFTImageFilter<ComplexImageType, ImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTInverseType::Pointer fft = FFTInverseType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, VnlInverse1DFFTImageFilter, Inverse1DFFTImageFilter);


return doTest<FFTInverseType>(argv[1], argv[2], argv[3]);
}
else if (backend == 2)
{
#if defined(ITK_USE_FFTWD) || defined(ITK_USE_FFTWF)
using FFTInverseType = itk::FFTWInverse1DFFTImageFilter<ComplexImageType, ImageType>;

// Instantiate a filter to exercise basic object methods
typename FFTInverseType::Pointer fft = FFTInverseType::New();
ITK_EXERCISE_BASIC_OBJECT_METHODS(fft, FFTWInverse1DFFTImageFilter, Inverse1DFFTImageFilter);


return doTest<FFTInverseType>(argv[1], argv[2], argv[3]);
#endif
}
Expand Down

0 comments on commit 89837f6

Please sign in to comment.