Commit e78c76e9 authored by Etienne Bougoin's avatar Etienne Bougoin

ENH : Update Terra Sar Brightness functor test

parent 6b87b4c9
......@@ -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) );
......
......@@ -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 ------------------------------
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment