From 3a73e5464c91a2ab6802e031509dfca9a076d014 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Fri, 7 Dec 2007 10:56:33 +0000
Subject: [PATCH] Test sur la classe AtmoParToAtoRadiative.

---
 .../otbAtmosphericCorrectionParameters.h      |  10 +-
 ...arametersTo6SAtmosphericRadiativeTerms.cxx |  65 ++++---
 ...nParametersTo6SAtmosphericRadiativeTerms.h |   3 +
 .../otbAtmosphericRadiativeTerms.cxx          |  57 +++++-
 .../Radiometry/otbAtmosphericRadiativeTerms.h |   5 +
 Testing/Code/Radiometry/CMakeLists.txt        |  70 ++++---
 ...arametersTo6SAtmosphericRadiativeTerms.cxx | 177 ++++++++++++++++--
 7 files changed, 309 insertions(+), 78 deletions(-)

diff --git a/Code/Radiometry/otbAtmosphericCorrectionParameters.h b/Code/Radiometry/otbAtmosphericCorrectionParameters.h
index c15c7fbe14..e07c19f7ae 100644
--- a/Code/Radiometry/otbAtmosphericCorrectionParameters.h
+++ b/Code/Radiometry/otbAtmosphericCorrectionParameters.h
@@ -202,12 +202,20 @@ public:
   itkSetMacro(AerosolOptical,double); 
   itkGetMacro(AerosolOptical,double); 
 
+  /**
+   * Set/Get the wavelenght spectral band.
+   */
+  void SetWavelenghtSpectralBand( const WavelenghtSpectralBandVectorType & waveband){ m_WavelenghtSpectralBand = waveband; }; 
+  WavelenghtSpectralBandVectorType GetWavelenghtSpectralBand(){ return m_WavelenghtSpectralBand; }; 
+  WavelenghtSpectralBandVectorType * GetWavelenghtSpectralBandRef(){ return &m_WavelenghtSpectralBand; }; 
 
-protected:
   /** Constructor */
   AtmosphericCorrectionParameters();
   /** Destructor */
   ~AtmosphericCorrectionParameters(){};
+
+protected:
+
   /**PrintSelf method */
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
diff --git a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
index 0c7354b1b2..7dadbf40b0 100644
--- a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
+++ b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
@@ -16,6 +16,7 @@ PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
 #include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h"
+#include "otbSIXSTraits.h"
 
 namespace otb
 {
@@ -132,7 +133,7 @@ AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
     (this->itk::ProcessObject::GetInput(0) );
 }
 
-#if 0
+
 void
 AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
 ::GenerateData()
@@ -141,24 +142,24 @@ AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
         AtmosphericCorrectionParametersPointer input = this->GetInput();
         AtmosphericRadiativeTermsPointer output = this->GetOutput();
         
-        output->GetVector().clear();
+        output->GetValues().clear();
         typedef AtmosphericCorrectionParameters::WavelenghtSpectralBandVectorType WavelenghtSpectralBandVectorType;
         WavelenghtSpectralBandVectorType WavelenghtSpectralBandVector = input->GetWavelenghtSpectralBand();
         unsigned int NbBand = WavelenghtSpectralBandVector.size();
-        
-        double AtmosphericReflectance(0.);
-        double AtmosphericSphericalAlbedo(0.);
-        double TotalGaseousTransmission(0.);
-        double DownwardTransmittance(0.);
-        double UpwardTransmittance(0.);
+
+        double atmosphericReflectance(0.);
+        double atmosphericSphericalAlbedo(0.);
+        double totalGaseousTransmission(0.);
+        double downwardTransmittance(0.);
+        double upwardTransmittance(0.);
                 
         for(unsigned int i=0 ; i<NbBand ; i++)
         {
-                AtmosphericReflectance = 0.;
-                AtmosphericSphericalAlbedo = 0.;
-                TotalGaseousTransmission = 0.;
-                DownwardTransmittance = 0.;
-                UpwardTransmittance = 0.;
+	  atmosphericReflectance = 0.;
+                atmosphericSphericalAlbedo = 0.;
+                totalGaseousTransmission = 0.;
+                downwardTransmittance = 0.;
+                upwardTransmittance = 0.;
                 SIXSTraits::ComputeAtmosphericParameters(
                         input->GetSolarZenithalAngle(),                 /** The Solar zenithal angle */
                         input->GetSolarAzimutalAngle(),                 /** The Solar azimutal angle */
@@ -171,27 +172,35 @@ AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
                         input->GetOzoneAmount(),                        /** The Ozone amount (Stratospheric ozone layer content) */
                         input->GetAerosolModel(),                       /** The Aerosol model */
                         input->GetAerosolOptical(),                     /** The Aerosol optical (radiative impact of aerosol for the reference wavelenght 550-nm) */
-                        input->GetWavelenghtSpectralBand(),             /** Wavelenght for the spectral band definition */
+                        input->GetWavelenghtSpectralBand()[i],          /** Wavelenght for the spectral band definition */
                                                                         /** Note : The Max wavelenght spectral band value must be updated ! */
-                        AtmosphericReflectance,                         /** Atmospheric reflectance */     
-                        AtmosphericSphericalAlbedo,                     /** atmospheric spherical albedo */
-                        TotalGaseousTransmission,                       /** Total gaseous transmission */
-                        DownwardTransmittance,                          /** downward transmittance */      
-                        UpwardTransmittance )                           /** upward transmittance */
+                        atmosphericReflectance,                         /** Atmospheric reflectance */     
+                        atmosphericSphericalAlbedo,                     /** atmospheric spherical albedo */
+                        totalGaseousTransmission,                       /** Total gaseous transmission */
+                        downwardTransmittance,                          /** downward transmittance */      
+                        upwardTransmittance );                          /** upward transmittance */
                 
-                        atmRadiativeTerm = New();
-                        atmRadiativeTerm->SetAtmosphericReflectance(AtmosphericReflectance);
-                        atmRadiativeTerm->SetAtmosphericSphericalAlbedo(AtmosphericSphericalAlbedo);
-                        atmRadiativeTerm->SetTotalGaseousTransmission(TotalGaseousTransmission);
-                        atmRadiativeTerm->SetDownwardTransmittance(DownwardTransmittance);
-                        atmRadiativeTerm->SetUpwardTransmittance(UpwardTransmittance); 
-                        //output->Get...().push_back(atmRadiativeTerm);
-			output->SetValueByIndex(i, atmRadiativeTerm);
+		/*
+		  atmRadiativeTerm = New();
+		  atmRadiativeTerm->SetAtmosphericReflectances(AtmosphericReflectance);
+		  atmRadiativeTerm->SetAtmosphericSphericalAlbedo(AtmosphericSphericalAlbedo);
+		  atmRadiativeTerm->SetTotalGaseousTransmission(TotalGaseousTransmission);
+		  atmRadiativeTerm->SetDownwardTransmittance(DownwardTransmittance);
+		  atmRadiativeTerm->SetUpwardTransmittance(UpwardTransmittance); 
+		  //output->Get...().push_back(atmRadiativeTerm);
+		  output->SetValueByIndex(i, atmRadiativeTerm);
+		*/
+		output->SetIntrinsicAtmosphericReflectances(i, atmosphericReflectance);
+		output->SetSphericalAlbedos(i, atmosphericSphericalAlbedo);
+		output->SetTotalGaseousTransmissions(i, totalGaseousTransmission);
+		output->SetDownwardTransmittances(i, downwardTransmittance);
+		output->SetUpwardTransmittances(i, upwardTransmittance);
+
         }
         
 
 }
-#endif        
+        
 
 /**
  * PrintSelf Method
diff --git a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h
index 931139efdb..959828b38c 100644
--- a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h
+++ b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h
@@ -67,6 +67,9 @@ class ITK_EXPORT AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
   virtual AtmosphericRadiativeTermsType * GetOutput(void);
   virtual AtmosphericRadiativeTermsType * GetOutput(unsigned int idx);
 
+  /** Generate the output.*/
+  virtual void GenerateData();
+
  protected:
   /** Constructor */
   AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms();
diff --git a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx
index 9e3c378aab..739945fde5 100644
--- a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx
+++ b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx
@@ -141,8 +141,61 @@ AtmosphericRadiativeTerms
       itkExceptionMacro(<< "Can't insert value before iniatilizing vector value..."<<std::endl);
     }
 }
-
-
+void 
+AtmosphericRadiativeTerms
+::SetIntrinsicAtmosphericReflectances(unsigned int id, const double & val)
+{
+  if ( m_Values.size()<id+1 )
+    { 
+      ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
+      m_Values.push_back(temp);
+    }
+  m_Values[id]->SetIntrinsicAtmosphericReflectance(val);
+} 
+void
+AtmosphericRadiativeTerms
+::SetSphericalAlbedos(unsigned int id, const double & val)
+{
+  if ( m_Values.size()<id+1 )
+    { 
+      ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
+      m_Values.push_back(temp);
+    }
+  m_Values[id]->SetSphericalAlbedo(val);
+} 
+void 
+AtmosphericRadiativeTerms
+::SetTotalGaseousTransmissions(unsigned int id, const double & val)
+{
+  if ( m_Values.size()<id+1 )
+    { 
+      ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
+      m_Values.push_back(temp);
+    }
+  m_Values[id]->SetTotalGaseousTransmission(val);
+} 
+void 
+AtmosphericRadiativeTerms
+::SetDownwardTransmittances(unsigned int id, const double & val ) 
+{
+ if ( m_Values.size()<id+1 )
+    { 
+      ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
+      m_Values.push_back(temp);
+    }
+  m_Values[id]->SetDownwardTransmittance(val);
+} 
+void 
+AtmosphericRadiativeTerms
+::SetUpwardTransmittances(unsigned int id, const  double & val ) 
+{
+   if ( m_Values.size()<id+1 )
+    { 
+      ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
+      m_Values.push_back(temp);
+    }
+  m_Values[id]->SetUpwardTransmittance(val);
+} 
 
 /** GET ACCESSORS WITH VECTORS. */
 AtmosphericRadiativeTerms::DataVectorType 
diff --git a/Code/Radiometry/otbAtmosphericRadiativeTerms.h b/Code/Radiometry/otbAtmosphericRadiativeTerms.h
index 548a80487c..a75664b91a 100644
--- a/Code/Radiometry/otbAtmosphericRadiativeTerms.h
+++ b/Code/Radiometry/otbAtmosphericRadiativeTerms.h
@@ -156,6 +156,11 @@ public:
   void SetUpwardTransmittances(const DataVectorType & vect); 
   /** Set methods with index. */
   void SetValueByIndex(unsigned int id, const ValueType & val);
+  void SetIntrinsicAtmosphericReflectances(unsigned int id, const double & val); 
+  void SetSphericalAlbedos(unsigned int id, const double & val); 
+  void SetTotalGaseousTransmissions(unsigned int id, const double & val); 
+  void SetDownwardTransmittances(unsigned int id, const double & val ); 
+  void SetUpwardTransmittances(unsigned int id, const  double & val ); 
 
   /** Get methods with vectors. */
   DataVectorType GetIntrinsicAtmosphericReflectances(); 
diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt
index 63382dd76d..1e5f95af91 100755
--- a/Testing/Code/Radiometry/CMakeLists.txt
+++ b/Testing/Code/Radiometry/CMakeLists.txt
@@ -11,7 +11,7 @@ SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary)
 #Tolerance sur diff pixel image
 SET(TOL 0.0)
 SET(EPSILON 0.000000000001)
-
+SET(EPSILON_10e6 0.000001)
 SET(RADIOMETRY_TESTS ${CXX_TEST_PATH}/otbRadiometryTests)
 
 # -------            otb::RAndNIRVegetationIndexImageFilter   ------------------------------
@@ -262,25 +262,25 @@ ADD_TEST(raTvImageToReflectanceImageFilter ${RADIOMETRY_TESTS}
          ) 
 
 ADD_TEST(raTvRomaniaImageToReflectance ${RADIOMETRY_TESTS} 
-  --compare-image ${EPSILON}  ${BASELINE}/raTvRomaniaReflectanceImage
+  --compare-image ${EPSILON}  ${BASELINE}/raTvRomaniaReflectanceImage.tif
                           ${TEMP}/raTvRomaniaReflectanceImage.tif
         otbImageToReflectanceImageFilter
 	${IMAGEDATA}/ROMANIA/S4_20020518.tif 
 	${TEMP}/raTvRomaniaReflectanceImage.tif
-	27.3                    # = 90-62.70 : elevation et azimuth solaire 
-        0.881338*2.24800        #channel 1 alpha
-	0.858713*5.04500        #channel 2 alpha	
-	0.685568*3.38500        #channel 3 alpha	
-	6.19122*1.50500         #channel 4 alpha
-	0                       #channel 1 beta
-	0                       #channel 2 beta
-	0                       #channel 3 beta
-	0                       #channel 4 beta
-	1057.56                 #channel 1 illumination
-	1570.23                 #channel 2 illumination    
-	1842.94                 #channel 3 illumination
-	232.820                 #channel 4 illumination
-	0.9889145564708814      #= sqrt(0.977952) d/d0 corresponding to the date 03/05 
+	27.3                 # = 90-62.70 : elevation et azimuth solaire 
+        1.981247824          #channel 1 alpha = 0.881338*2.24800 
+	4.332207085          #channel 2 alpha = 0.858713*5.04500	
+	2.32064768           #channel 3 alpha = 0.685568*3.38500 	
+	9.3177861            #channel 4 alpha = 6.19122*1.50500
+	0                    #channel 1 beta
+	0                    #channel 2 beta
+	0                    #channel 3 beta
+	0                    #channel 4 beta
+	1057.56              #channel 1 illumination
+	1570.23              #channel 2 illumination    
+	1842.94              #channel 3 illumination
+	232.820              #channel 4 illumination
+	0.9889145564708814   #= sqrt(0.977952) d/d0 corresponding to the date 03/05 
         ) 
 
 ADD_TEST(raTvImageToReflectanceImageFilterDayMounth ${RADIOMETRY_TESTS} 
@@ -418,21 +418,33 @@ ADD_TEST(raTuSurfaceAdjencyEffect6SCorrectionSchemeFilter ${RADIOMETRY_TESTS}
 ADD_TEST(raTuAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew ${RADIOMETRY_TESTS}  
         otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew
 )
-ADD_TEST(raTuAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms ${RADIOMETRY_TESTS}  
+ADD_TEST(raTvAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms ${RADIOMETRY_TESTS}  
+--compare-ascii ${EPSILON_10e6}  
+		${BASELINE_FILES}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt
+                ${TEMP}/raTvCorrectionTo6SRadiative.txt
         otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms
-	#${INPUTDATA}/poupees_sub.png							# input image
+                ${INPUTDATA}/in6S_otb
+                ${TEMP}/raTvCorrectionTo6SRadiative.txt
+		
+	#${IMAGEDATA}/Romania/S4_2002518.tif						# input image
 	#${TEMP}/raTvAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.tif    # output image
-	# wavelet length file for channel 1
-	# wavelet length file for channel 2
-	# wavelet length file for channel 3
-	# wavelet length file for channel 4
-	# solar zenithal angle
-        # solar azimutal angle
-       # viewing zenithal angle
-       # viewing azimutal angle
-       # acquisition month
-       # acquisition day
-# aerosol model type (0 = NO_AEROSOL=0, 1 = CONTINENTAL, 2 = MARITIME, 3 =)NO_AEROSOL=0,CONTINENTAL=1,MARITIME=2,URBAN=3,DESERTIC=5
+	#${INPUTDATA}/RADIO_WAVELENGHT_SPECTRAL_BAND_SPOT4_1_B1.txt  # wavelet length file for channel 1
+	#${INPUTDATA}/RADIO_WAVELENGHT_SPECTRAL_BAND_SPOT4_1_B2.txt  # wavelet length file for channel 2
+	#${INPUTDATA}/RADIO_WAVELENGHT_SPECTRAL_BAND_SPOT4_1_B3.txt  # wavelet length file for channel 3
+	#${INPUTDATA}/RADIO_WAVELENGHT_SPECTRAL_BAND_SPOT4_1_MIR.txt # wavelet length file for channel 4
+	#27.3     # = 90-62.7, solar zenithal angle
+        #152.7    # solar azimutal angle
+        #2        # = 90-88, viewing zenithal angle
+        #-77.0    # viewing azimutal angle
+        #12       # acquisition month
+        #17       # acquisition day
+        #1013.00  # atmospheric pressure     
+        #2.48134  # water vapor amount
+        #0.344000 # ozone amount
+        #1        # aerosol model type (0 = NO_AEROSOL=0, 1 = CONTINENTAL, 2 = MARITIME, 3 =)NO_AEROSOL=0,CONTINENTAL=1,MARITIME=2,URBAN=3,DESERTIC=5 
+        #1.99854  # aerosol opical thichness 
+
+
 )
 
 
diff --git a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
index 7238f2835a..2e0c4e6342 100644
--- a/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
+++ b/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx
@@ -18,34 +18,175 @@
 
 #include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h"
 #include "otbAtmosphericCorrectionParameters.h"
+#include "otbAtmosphericRadiativeTerms.h"
+#include <vector>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
 
 int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms(int argc, char * argv[])
 {
-  typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms  AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType;
-  typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType;
-  typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType;
   /*
+  std::vector<const char *> wavelenghFiles;
+  wavelenghFiles.push_back( argv[3] );
+  wavelenghFiles.push_back( argv[4] );
+  wavelenghFiles.push_back( argv[5] );
+  wavelenghFiles.push_back( argv[6] );
+  */  
+  const char * wavelenghFile  = argv[1];
+  const char * outputFile     = argv[2];
+
+  typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms  CorrectionParametersTo6SRadiativeTermsType;
+  typedef otb::AtmosphericCorrectionParameters                               CorrectionParametersType;
+  typedef otb::AtmosphericRadiativeTerms                                     RadiativeTermsType;
+  typedef CorrectionParametersType::AerosolModelType                         AerosolModelType;
+  typedef otb::FilterFunctionValues                                          FilterFunctionValuesType;
+  typedef FilterFunctionValuesType::WavelenghtSpectralBandType               ValueType;
+  typedef FilterFunctionValuesType::ValuesVectorType                         ValuesVectorType;
+
   // Instantiating object
-  AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::Pointer object = AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::New();
-  AtmosphericCorrectionParametersType param; // =  otbAtmosphericCorrectionParameters::New();
-  AerosolModelType aerosolModel;
+  CorrectionParametersTo6SRadiativeTermsType::Pointer object         = CorrectionParametersTo6SRadiativeTermsType::New();
+  CorrectionParametersType::Pointer                   param          = CorrectionParametersType::New();
+  AerosolModelType                                    aerosolModel;
+  FilterFunctionValuesType::Pointer                   functionValues = FilterFunctionValuesType::New();
+  ValuesVectorType                                    vect;
+  RadiativeTermsType::Pointer                         radiative      = RadiativeTermsType::New();
+
+  ValueType val = 0.0025;
   
+  //for(unsigned int i=0; i<wavelenghFiles.size(); i++)
+  //{
+  //functionValues = FilterFunctionValuesType::New();
+  vect.clear();
+
+  // Filter function values initialization
+  float minSpectralValue(0.);
+  float maxSpectralValue(0.);
+  float value(0.);
+  // Correction parameters initialization
+  double solarZenithalAngle(0.);
+  double solarAzimutalAngle(0.);
+  double viewingZenithalAngle(0.);
+  double viewingAzimutalAngle(0.);
+  unsigned int month(0);
+  unsigned int day(0);
+  double atmosphericPressure(0.);
+  double waterVaporAmount(0.);
+  double ozoneAmount(0.);
+  double aerosolOptical(0.);
+
+
+  std::ifstream fin;
+  std::ofstream fout;
+  //Read input file parameters
+  fin.open(wavelenghFile);
+  fin >> solarZenithalAngle;//asol;
+  fin >> solarAzimutalAngle;//phi0;
+  fin >> viewingZenithalAngle;//avis;
+  fin >> viewingAzimutalAngle;//phiv;
+  fin >> month;//month;
+  fin >> day;//jday;
+  fin >> atmosphericPressure;//pressure;
+  fin >> waterVaporAmount;//uw;
+  fin >> ozoneAmount;//uo3;
+  unsigned int aer(0);
+  fin >> aer;//iaer;
+  aerosolModel = static_cast<AerosolModelType>(aer);
+  fin >> aerosolOptical;//taer55;
+  fin >> minSpectralValue;//wlinf;
+  fin >> maxSpectralValue;//wlsup; 
   
+  //fin.open(wavelenghFiles[i]);
+  while (!fin.eof() && fin.good())
+    {
+      fin >> value;
+      vect.push_back(value);
+    }
+  // Remove the last vector element which is added by fin, and not contains in the original file.
+  //vect.pop_back();
+  fin.close();
+  functionValues->SetFilterFunctionValues(vect);
+  functionValues->SetMinSpectralValue(minSpectralValue);
+  functionValues->SetMaxSpectralValue(maxSpectralValue);
+  functionValues->SetUserStep( val );
+  param->GetWavelenghtSpectralBandRef()->push_back(functionValues);
+
+  //}
+
+  aerosolModel = static_cast<AerosolModelType>(::atoi(argv[16]));
   
-  AerosolModelType AerosolModel;
+  // Set parameters
+  param->SetSolarZenithalAngle(static_cast<double>(solarZenithalAngle));
+  param->SetSolarAzimutalAngle(static_cast<double>(solarAzimutalAngle));
+  param->SetViewingZenithalAngle(static_cast<double>(viewingZenithalAngle));
+  param->SetViewingAzimutalAngle(static_cast<double>(viewingAzimutalAngle));
+  param->SetMonth(month);
+  param->SetDay(day);
+  param->SetAtmosphericPressure(static_cast<double>(atmosphericPressure)); 
+  param->SetWaterVaporAmount(static_cast<double>(waterVaporAmount));
+  param->SetOzoneAmount(static_cast<double>(ozoneAmount));
+  param->SetAerosolModel(aerosolModel);
+  param->SetAerosolOptical(static_cast<double>(aerosolOptical));
+
+  /*
+  aerosolModel = static_cast<AerosolModelType>(::atoi(argv[16]));
   
-  param->SetSolarZenithalAngle(static_cast<double>(::atof(argv[])));
-  param->SetSolarAzimutalAngle(static_cast<double>(::atof(argv[])));
-  param->SetViewingZenithalAngle(static_cast<double>(::atof(argv[])));
-  param->SetViewingAzimutalAngle(static_cast<double>(::atof(argv[])));
-  param->SetMonth(::atoi(argv[]));
-  param->SetDay(::atoi(argv[]));
-  param->SetAtmosphericPressure(static_cast<double>(::atof(argv[]))); 
-  param->SetWaterVaporAmount(static_cast<double>(::atof(argv[])));
-  param->SetOzoneAmount(static_cast<double>(::atof(argv[])));
-  aerosolModel = static_cast<AerosolModelType>(::atoi(argv[]));
+  // Set parameters
+  param->SetSolarZenithalAngle(static_cast<double>(::atof(argv[7])));
+  param->SetSolarAzimutalAngle(static_cast<double>(::atof(argv[8])));
+  param->SetViewingZenithalAngle(static_cast<double>(::atof(argv[9])));
+  param->SetViewingAzimutalAngle(static_cast<double>(::atof(argv[10])));
+  param->SetMonth(::atoi(argv[11]));
+  param->SetDay(::atoi(argv[12]));
+  param->SetAtmosphericPressure(static_cast<double>(::atof(argv[13]))); 
+  param->SetWaterVaporAmount(static_cast<double>(::atof(argv[14])));
+  param->SetOzoneAmount(static_cast<double>(::atof(argv[15])));
   param->SetAerosolModel(aerosolModel);
-  param->SetAerosolOptical(static_cast<double>(::atof(argv[])));
+  param->SetAerosolOptical(static_cast<double>(::atof(argv[17])));
   */
+  object->SetInput( param );
+  object->GenerateData();
+  radiative = object->GetOutput();
+
+  fout.open(outputFile);
+  fout <<" ---------------------------------------------------------"<<std::endl;
+  fout << "Inputs values:"<<std::setprecision(10)<<std::endl;
+  fout << "   ----->  SolarZenithalAngle :                "<<solarZenithalAngle<<std::endl;
+  fout << "   ----->  SolarAzimutalAngle :                "<<solarAzimutalAngle<<std::endl;
+  fout << "   ----->  ViewingZenithalAngle :              "<<viewingZenithalAngle<<std::endl;
+  fout << "   ----->  ViewingAzimutalAngle :              "<<viewingAzimutalAngle<<std::endl;
+  fout << "   ----->  Month :                             "<<month<<std::endl;
+  fout << "   ----->  Day :                               "<<day<<std::endl;
+  fout << "   ----->  AtmosphericPressure :               "<<atmosphericPressure<<std::endl;
+  fout << "   ----->  WaterVaporAmount :                  "<<waterVaporAmount<<std::endl;
+  fout << "   ----->  OzoneAmount :                       "<<ozoneAmount<<std::endl;
+  fout << "   ----->  AerosolModel :                      "<<aer<<std::endl;
+  fout << "   ----->  AerosolOptical :                    "<<aerosolOptical<<std::endl;
+  fout << "   ----->  MinSpectralValue :                  "<<minSpectralValue<<std::endl;
+  fout << "   ----->  MaxSpectralValue :                  "<<maxSpectralValue<<std::endl;
+  fout << "   ----->  UserStep :                          "<<functionValues->GetUserStep()<<std::endl;
+  fout <<" ---------------------------------------------------------"<<std::endl;
+  fout << "Outputs values:"<<std::endl;
+  fout << "   ----->  atmospheric reflectance :           "<<radiative->GetIntrinsicAtmosphericReflectances(0)<<std::endl;
+  fout << "   ----->  atmospheric spherical albedo :      "<<radiative->GetSphericalAlbedos(0)<<std::endl;
+  fout << "   ----->  total gaseous transmission :        "<<radiative->GetTotalGaseousTransmissions(0)<<std::endl;
+  fout << "   ----->  downward transmittance :            "<<radiative->GetDownwardTransmittances(0)<<std::endl;
+  fout << "   ----->  upward transmittance :              "<<radiative->GetUpwardTransmittances(0)<<std::endl;
+  fout << "   ----->  MinSpectralValue update:            "<<functionValues->GetMinSpectralValue()<<std::endl;
+  fout << "   ----->  MaxSpectralValue update :           "<<functionValues->GetMaxSpectralValue()<<std::endl;
+  fout <<" ---------------------------------------------------------"<<std::endl;
+  fout<<"Input wavelenght band values ["<<functionValues->GetFilterFunctionValues().size()<<"]:"<<std::endl;
+  for (unsigned int i=0; i<functionValues->GetFilterFunctionValues().size(); i++)
+    {
+      fout<< "    "<<functionValues->GetFilterFunctionValues()[i] <<std::endl;
+    }
+  fout <<" ---------------------------------------------------------"<<std::endl;
+  fout<<"Output wavelenght band values 6S ["<<functionValues->GetFilterFunctionValues6S().size()<<"]:"<<std::endl;
+  for (unsigned int i=0; i<functionValues->GetFilterFunctionValues6S().size(); i++)
+    {
+      fout<< "            "<<functionValues->GetFilterFunctionValues6S()[i] <<std::endl;
+    } 
+  fout<<std::endl;
+  fout.close();
   return EXIT_SUCCESS;
 }
-- 
GitLab