From 5fb358ef4a08c7295ba3b28dfea224270b997316 Mon Sep 17 00:00:00 2001 From: Patrick Imbo <patrick.imbo@c-s.fr> Date: Fri, 8 Sep 2006 16:09:41 +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 --- ...rwardFourierMellinTransformImageFilter.txx | 4 +- Testing/Code/FeatureExtraction/CMakeLists.txt | 6 ++ .../otbFeatureExtractionTests.cxx | 1 + .../otbFourierMellinImageFilter.cxx | 82 +++++++++++++++++++ .../otbFourierMellinImageFilterNew.cxx | 2 - 5 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx diff --git a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx index 31aca39b7d..85960f14ee 100644 --- a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx +++ b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx @@ -57,7 +57,7 @@ const double ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension > ::GetAngularStep() { - return m_LogPolarResample->GetAngularStep(); + return static_cast<const double>(m_LogPolarResample->GetAngularStep() ); } @@ -104,7 +104,7 @@ const double ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension > ::GetRadialNumberOfSamples( ) { - return m_LogPolarResample->GetRadialNumberOfSamples(); + return static_cast<const double>(m_LogPolarResample->GetRadialNumberOfSamples() ); } template < class TPixel,class TInterpol,unsigned int Dimension > diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt index 2e15ed96c7..0668fe362e 100755 --- a/Testing/Code/FeatureExtraction/CMakeLists.txt +++ b/Testing/Code/FeatureExtraction/CMakeLists.txt @@ -385,6 +385,11 @@ ADD_TEST(feTvExtractSegments ${FEATUREEXTRACTION_TESTS} ADD_TEST(feTuForwardFourierMellinImageFilterNew ${FEATUREEXTRACTION_TESTS} otbFourierMellinImageFilterNew) +ADD_TEST(feTuForwardFourierMellinImageFilter ${FEATUREEXTRACTION_TESTS} + otbFourierMellinImageFilter + ${INPUTDATA}/DeuxCercles.hdr + ${TEMP}/feTuForwardFourierMellinImageFilter.hdr) + # ----------------------------------------------------------------------- @@ -441,6 +446,7 @@ otbLocalHoughDraw.cxx otbExtractSegmentsNew.cxx otbExtractSegments.cxx otbFourierMellinImageFilterNew.cxx +otbFourierMellinImageFilter.cxx ) diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx index 7d4ec35182..ee9b40c768 100755 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx @@ -77,4 +77,5 @@ REGISTER_TEST(otbLocalHoughDraw); REGISTER_TEST(otbExtractSegmentsNew); REGISTER_TEST(otbExtractSegments); REGISTER_TEST(otbFourierMellinImageFilterNew); +REGISTER_TEST(otbFourierMellinImageFilter); } diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx new file mode 100644 index 0000000000..94798b40b8 --- /dev/null +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx @@ -0,0 +1,82 @@ +/*========================================================================= + + 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 ) +#endif + +#define MAIN + +#include "otbImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "otbForwardFourierMellinTransformImageFilter.h" +#include "itkLinearInterpolateImageFunction.h" + +int otbFourierMellinImageFilter(int argc, char* argv[]) +{ + try + { + + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + typedef double InputPixelType; + typedef std::complex<double> OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; + typedef otb::ForwardFourierMellinTransformImageFilter<InputPixelType, + InterpolatorType,Dimension> FourierMellinTransformType; + + FourierMellinTransformType::Pointer FourierMellinTransform = FourierMellinTransformType::New(); + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + FourierMellinTransform->SetInput( reader->GetOutput() ); +// FourierMellinTransform->SetIsOriginAtCenter(true); +// FourierMellinTransform->SetAngularNumberOfSamples(512); +// FourierMellinTransform->SetRadialNumberOfSamples(513); + + writer->SetInput( FourierMellinTransform->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; +} diff --git a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx index a348f68d52..229700ba5e 100644 --- a/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx +++ b/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx @@ -23,8 +23,6 @@ #define MAIN #include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" #include "otbForwardFourierMellinTransformImageFilter.h" #include "itkLinearInterpolateImageFunction.h" -- GitLab