diff --git a/Code/Radiometry/otbSIXSTraits.cxx b/Code/Radiometry/otbSIXSTraits.cxx index 144307422a5837945b0132e6beceac989f442309..d0cec0b1da34a944cf241bebdbb5a20cc13b59c2 100644 --- a/Code/Radiometry/otbSIXSTraits.cxx +++ b/Code/Radiometry/otbSIXSTraits.cxx @@ -74,7 +74,7 @@ SIXSTraits::ComputeAtmosphericParameters( try { // 6S official Wavelenght Spectral Band step value - const double SIXSStepOfWavelenghtSpectralBandValues = .0025; + const float SIXSStepOfWavelenghtSpectralBandValues = .0025; // Generate 6s Wavelenght Spectral Band with the offcicial step value ComputeWavelenghtSpectralBandValuesFor6S( SIXSStepOfWavelenghtSpectralBandValues, WavelenghtSpectralBand // Update @@ -83,8 +83,11 @@ SIXSTraits::ComputeAtmosphericParameters( // 6S official tab size Wavelenght Spectral const unsigned int S_6S_SIZE=1501; // Generate WavelenghtSpectralBand in 6S compatible buffer s[1501] - otb_6s_integer iinf = static_cast<otb_6s_integer>((WavelenghtSpectralBand->GetMinSpectralValue() - (double).25) / SIXSStepOfWavelenghtSpectralBandValues + (double)1.5); - otb_6s_integer isup = static_cast<otb_6s_integer>((WavelenghtSpectralBand->GetMaxSpectralValue() - (double).25) / SIXSStepOfWavelenghtSpectralBandValues + (double)1.5); + wlinf = static_cast<otb_6s_real>(WavelenghtSpectralBand->GetMinSpectralValue()); + wlsup = static_cast<otb_6s_real>(WavelenghtSpectralBand->GetMaxSpectralValue()); + + otb_6s_integer iinf = static_cast<otb_6s_integer>((wlinf - (float).25) / SIXSStepOfWavelenghtSpectralBandValues + (float)1.5); + otb_6s_integer isup = static_cast<otb_6s_integer>((wlsup - (float).25) / SIXSStepOfWavelenghtSpectralBandValues + (float)1.5); otb_6s_integer cpt=iinf-1; otb_6s_real * s(NULL); @@ -148,7 +151,7 @@ SIXSTraits::ComputeWavelenghtSpectralBandValuesFor6S( double value(0.); // Generate WavelenghtSpectralBand if the step is not the offical 6S step value - if( vcl_abs(L_userStep-SIXSStepOfWavelenghtSpectralBandValues) > .00000001 ) + if( vcl_abs(L_userStep-SIXSStepOfWavelenghtSpectralBandValues) > .000001 ) { ValuesVectorType values(1, FilterFunctionValues[0]); //vector size 1 with the value vect[0] diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt index 22fb994eeb8f52ef9b6e7f8249de87b6de810ee4..63382dd76d88d22ef7c3fab2fdf98acf67aee845 100755 --- a/Testing/Code/Radiometry/CMakeLists.txt +++ b/Testing/Code/Radiometry/CMakeLists.txt @@ -356,9 +356,10 @@ ADD_TEST(raTvFilterFunctionValuesTest ${RADIOMETRY_TESTS} ) +########## otb::SIXSTraits ------------------- ADD_TEST(raTvSIXSTraitsComputeAtmosphericParametersTest ${RADIOMETRY_TESTS} -# --compare-ascii ${TOL} ${BASELINE_FILES}/raTvFilterFunctionValuesTest.txt -# ${TEMP}/raTvFilterFunctionValuesTest.txt + --compare-ascii ${TOL} ${BASELINE_FILES}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt + ${TEMP}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt otbSIXSTraitsComputeAtmosphericParametersTest ${INPUTDATA}/in6S_otb ${TEMP}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt diff --git a/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx b/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx index 44d439442af1e0e921a4b833304f1e0b3c96ed0a..6c32926ceeac60c4294414776a191e703f1faad1 100644 --- a/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx +++ b/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx @@ -131,11 +131,6 @@ int otbSIXSTraitsComputeAtmosphericParametersTest(int argc, char * argv[]) fout << " -----> MinSpectralValue : "<<MinSpectralValue<<std::endl; fout << " -----> MaxSpectralValue : "<<MaxSpectralValue<<std::endl; fout << " -----> UserStep : "<<functionValues->GetUserStep()<<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 << "Outputs values:"<<std::endl; fout << " -----> atmospheric reflectance : "<<AtmosphericReflectance<<std::endl; @@ -145,10 +140,17 @@ int otbSIXSTraitsComputeAtmosphericParametersTest(int argc, char * argv[]) fout << " -----> upward transmittance : "<<UpwardTransmittance<<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<< " "<<functionValues->GetFilterFunctionValues6S()[i] <<std::endl; } fout<<std::endl; fout.close();