diff --git a/Code/Radiometry/otbTerraSarFunctors.txx b/Code/Radiometry/otbTerraSarFunctors.txx index 01c5baf1bc64f3b582fd374596751271a80e3e38..20ee8aab463e2a44e2593df28a7aa32976a43957 100644 --- a/Code/Radiometry/otbTerraSarFunctors.txx +++ b/Code/Radiometry/otbTerraSarFunctors.txx @@ -59,7 +59,7 @@ TerraSarBrightnessImageFunctor<TInput, TOutput> double beta = operator()(static_cast<double>(std::abs(inPix))); // Phase - double phase = std::arg(inPix); + double phase = static_cast<double>(std::arg(inPix)); // We retrieve the complex value from the modulus and the phase. std::complex<TOutput> res = std::complex<TOutput>(beta*vcl_cos(phase), beta*vcl_sin(phase) ); diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt index 32abecab26203926f6f341811c2b91b7bb7abd82..599ea0d7f7207897d2f0c0300e1092b93ae51b44 100644 --- a/Testing/Code/Radiometry/CMakeLists.txt +++ b/Testing/Code/Radiometry/CMakeLists.txt @@ -1054,12 +1054,14 @@ ADD_TEST(raTvTerraSarCalibrationImageFilterTest ${RADIOMETRY_TESTS9} # ------- TerraSarBrightnessImageFunctor ------------------------------ ADD_TEST(raTvTerraSarBrightnessImageFunctor ${RADIOMETRY_TESTS9} -# --compare-image ${EPSILON} -# ${BASELINE}/raTvTerraSarBrightnessImageFunctor.tif -# ${TEMP}/raTvTerraSarBrightnessImageFunctor.tif + --compare-ascii ${EPSILON} + ${BASELINE_FILES}/raTvTerraSarBrightnessImageFunctor.txt + ${TEMP}/raTvTerraSarBrightnessImageFunctor.txt otbTerraSarBrightnessImageFunctor -# ${INPUTDATA}/ExtractIMAGE_HH_SRA_strip_012.tif -# ${TEMP}/raTvTerraSarBrightnessImageFunctor.tif + 12 + 12 + 0 + ${TEMP}/raTvTerraSarBrightnessImageFunctor.txt ) # ------- TerraSarBrightnessImageFilter ------------------------------ diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx index f1f64b748a1ba53c35f7646073a5ac76f7ad7a1d..f27a40353bd9b9163a10eff9ae749b5c160e448a 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx @@ -15,6 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#include <fstream> +#include <iomanip> #include "itkExceptionObject.h" #include "otbTerraSarFunctors.h" @@ -28,11 +30,26 @@ int otbTerraSarBrightnessImageFunctor(int argc, char * argv[]) FunctorType funct; - ScalarType inPix = 150.2; - std::cout << inPix << " -> " << funct.operator()(inPix) << std::endl; + if(argc!=5) + { + std::cout << "argv[0] <Scalar pixel> <Complex pixel (re part)> <Complex pixel (im part)> <output filename>" << std::endl; - ComplexType inCplxPix(12, 180); - std::cout << inCplxPix << " -> " << funct.operator()(inCplxPix) << std::endl; + return EXIT_FAILURE; + } + + ScalarType inPix = static_cast<ScalarType>(atof(argv[1])); + ComplexType inCplxPix(static_cast<ScalarType>(atof(argv[2])), static_cast<ScalarType>(atof(argv[3]))); + char *outFilename = argv[4]; + std::ofstream file; + file.open(outFilename); + + file << std::fixed << std::setprecision(10); + + file << "Scalar pixel : " << inPix << " -> " << funct.operator()(inPix) << std::endl; + + file << "Complex pixel : " << inCplxPix << " -> " << funct.operator()(inCplxPix) << std::endl; + + file.close(); return EXIT_SUCCESS; }