From f58900a5ab6b2fafc7e0fb8eeb543621cbb85554 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Tue, 5 Jan 2010 16:34:58 +0100
Subject: [PATCH] ENH : coreect TSX Brightness functor test

---
 Testing/Code/Radiometry/CMakeLists.txt             |  7 ++++---
 .../otbTerraSarBrightnessImageFunctor.cxx          | 14 ++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt
index b3bba93307..37449a3cb1 100644
--- a/Testing/Code/Radiometry/CMakeLists.txt
+++ b/Testing/Code/Radiometry/CMakeLists.txt
@@ -1058,9 +1058,10 @@ ADD_TEST(raTvTerraSarBrightnessImageFunctor ${RADIOMETRY_TESTS9}
                                ${BASELINE_FILES}/raTvTerraSarBrightnessImageFunctor.txt
                                ${TEMP}/raTvTerraSarBrightnessImageFunctor.txt
         otbTerraSarBrightnessImageFunctor
-		12
-		12
-		0
+		12 # real pixel
+		12 # complex real part pixel
+		0  # complex imaginary part pixel
+		1  # calFactor
 		${TEMP}/raTvTerraSarBrightnessImageFunctor.txt
 )
 
diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx
index f27a40353b..ce6817684b 100644
--- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx
+++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageFunctor.cxx
@@ -23,23 +23,21 @@
 
 int otbTerraSarBrightnessImageFunctor(int argc, char * argv[])
 {
+  char *outFilename = argv[5];
+  double calFact =  atof(argv[4]);
+
   typedef double                   ScalarType;
   typedef std::complex<ScalarType> ComplexType;
 
   typedef otb::Functor::TerraSarBrightnessImageFunctor<ScalarType, ScalarType>   FunctorType;
 
   FunctorType funct;
-  
-  if(argc!=5)
-  {
-    std::cout << "argv[0] <Scalar pixel> <Complex pixel (re part)> <Complex pixel (im part)> <output filename>" << std::endl;
-
-    return EXIT_FAILURE;
-  }
+  funct.SetCalFactor(calFact);
 
   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);
 
-- 
GitLab