diff --git a/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx b/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx index 31aca39b7dd45ddc57618f44e9de4cc469856415..85960f14ee6783453983b5f2b8b61ca130a5b7f6 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 2e15ed96c7bfb10bc74fc033ec5372dc658729a8..0668fe362e145f30cc7877b42ff2bd98e38c4b52 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 7d4ec351821c0288b944ff09a54908afb966c0e5..ee9b40c7684ad025c16d1a114ef72d743ae15591 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 0000000000000000000000000000000000000000..94798b40b8072c342a1c227915aa627c0d92cd84 --- /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 a348f68d526ff81d856b480cc99a41c7c99598f0..229700ba5ea574f199114ffc10aadd4eb777e8a1 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"