From 18d60678b7fd01e3e91e4b5621f117c98f1f7aaa Mon Sep 17 00:00:00 2001 From: Patrick Imbo <patrick.imbo@c-s.fr> Date: Tue, 12 Sep 2006 12:34:03 +0000 Subject: [PATCH] =?UTF-8?q?otbForwardFourierMellinTransformImageFilter=20:?= =?UTF-8?q?=20impl=C3=A9mentation=20de=20la=20classe=20+=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Testing/Code/FeatureExtraction/CMakeLists.txt | 17 +++- .../otbFeatureExtractionTests.cxx | 1 + .../otbFourierMellinImageFilterTestFFT.cxx | 77 +++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt index 0668fe362e..0d55e0f480 100755 --- a/Testing/Code/FeatureExtraction/CMakeLists.txt +++ b/Testing/Code/FeatureExtraction/CMakeLists.txt @@ -385,10 +385,22 @@ ADD_TEST(feTvExtractSegments ${FEATUREEXTRACTION_TESTS} ADD_TEST(feTuForwardFourierMellinImageFilterNew ${FEATUREEXTRACTION_TESTS} otbFourierMellinImageFilterNew) -ADD_TEST(feTuForwardFourierMellinImageFilter ${FEATUREEXTRACTION_TESTS} +ADD_TEST(feTuForwardFourierMellinImageFilterTestFFT ${FEATUREEXTRACTION_TESTS} + otbFourierMellinImageFilterTestFFT + ${INPUTDATA}/TestFFT.hdr + ${TEMP}/feFFTTest.hdr) + +ADD_TEST(feTuForwardFourierMellinImageFilterTestFFT3Croix ${FEATUREEXTRACTION_TESTS} + otbFourierMellinImageFilterTestFFT + ${INPUTDATA}/TestFFT3Croix.hdr + ${TEMP}/feFFTTest3Croix.hdr) + +ADD_TEST(feTvForwardFourierMellinImageFilter ${FEATUREEXTRACTION_TESTS} +# --compare-image ${TOL} ${BASELINE}/feForwardFourierMellinImageFilter.hdr +# ${TEMP}/feForwardFourierMellinImageFilter.hdr otbFourierMellinImageFilter ${INPUTDATA}/DeuxCercles.hdr - ${TEMP}/feTuForwardFourierMellinImageFilter.hdr) + ${TEMP}/feForwardFourierMellinImageFilter.hdr) # ----------------------------------------------------------------------- @@ -446,6 +458,7 @@ otbLocalHoughDraw.cxx otbExtractSegmentsNew.cxx otbExtractSegments.cxx otbFourierMellinImageFilterNew.cxx +otbFourierMellinImageFilterTestFFT.cxx otbFourierMellinImageFilter.cxx ) diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx index ee9b40c768..5bb1b2b81e 100755 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx @@ -77,5 +77,6 @@ REGISTER_TEST(otbLocalHoughDraw); REGISTER_TEST(otbExtractSegmentsNew); REGISTER_TEST(otbExtractSegments); REGISTER_TEST(otbFourierMellinImageFilterNew); +REGISTER_TEST(otbFourierMellinImageFilterTestFFT); REGISTER_TEST(otbFourierMellinImageFilter); } diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx new file mode 100644 index 0000000000..3fceb679c6 --- /dev/null +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterTestFFT.cxx @@ -0,0 +1,77 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#include "otbImage.h" +#endif + +#define MAIN + +#include "otbImage.h" +#include "itkImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVnlFFTRealToComplexConjugateImageFilter.h" + +int otbFourierMellinImageFilterTestFFT(int argc, char* argv[]) +{ + try + { + + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + typedef double InputPixelType; + typedef std::complex<InputPixelType> OutputPixelType; + const unsigned int Dimension = 2; + + typedef itk::VnlFFTRealToComplexConjugateImageFilter<InputPixelType,Dimension> FourierImageFilterType; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + FourierImageFilterType::Pointer FourierTransform = FourierImageFilterType::New(); + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + FourierTransform->SetInput( reader->GetOutput() ); + writer->SetInput( FourierTransform->GetOutput() ); + + writer->Update(); + + } + catch( itk::ExceptionObject & err ) + { + std::cerr << "itk::Exception detected: " << err.GetDescription(); + return EXIT_FAILURE; + } + catch( ... ) + { + std::cout << "unknown exception detected !" << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} -- GitLab