diff --git a/Code/Radiometry/otbSIXSTraits.cxx b/Code/Radiometry/otbSIXSTraits.cxx index 3c4836a06c751cea92947b0865a077537ea063a0..d707abd3b76ca92c29eb95bca9896cc2c8d09d4b 100644 --- a/Code/Radiometry/otbSIXSTraits.cxx +++ b/Code/Radiometry/otbSIXSTraits.cxx @@ -21,6 +21,8 @@ #include "main_6s.h" #include "otbMacro.h" +#include <iomanip> + namespace otb { @@ -158,6 +160,7 @@ SIXSTraits::ComputeWavelenghtSpectralBandValuesFor6S( WavelenghtSpectralType* WavelenghtSpectralBand ) { + const double epsilon(.000001); const double L_min = static_cast<double>(WavelenghtSpectralBand->GetMinSpectralValue()); const double L_max = static_cast<double>(WavelenghtSpectralBand->GetMaxSpectralValue()); const double L_userStep = static_cast<double>(WavelenghtSpectralBand->GetUserStep()); @@ -172,15 +175,14 @@ SIXSTraits::ComputeWavelenghtSpectralBandValuesFor6S( itkGenericExceptionMacro(<<"The FilterFunctionValues vector must have more than 1 values !"); } //if( vcl_abs((static_cast<double>(FilterFunctionValues.size()-1)*L_userStep)-(L_max-L_min) ) > .000001 ) - if( L_min+static_cast<double>(FilterFunctionValues.size()-1)*L_userStep < L_max ) + if( L_min+static_cast<double>(FilterFunctionValues.size()-1)*L_userStep < (L_max - epsilon )) { - std::cout<<L_min+static_cast<double>(FilterFunctionValues.size()-1)*L_userStep<<" "<<L_max<<std::endl; - itkGenericExceptionMacro(<<"The FilterFunctionValues vector size ( ("<<FilterFunctionValues.size()<<"-1) x userstep ("<<L_userStep<<") must be less than the Max spectral value ("<< L_max-L_min<<") !"); + itkGenericExceptionMacro(<<"The following condition: "<<L_min<<"+("<<FilterFunctionValues.size()<<"-1)*"<<L_userStep<<" < ("<< L_max <<"-"<<epsilon<<") is not respected !"); } // Generate WavelenghtSpectralBand if the step is not the offical 6S step value - if ( vcl_abs(L_userStep-SIXSStepOfWavelenghtSpectralBandValues) > .000001 ) + if ( vcl_abs(L_userStep-SIXSStepOfWavelenghtSpectralBandValues) > epsilon ) { ValuesVectorType values(1, FilterFunctionValues[0]); //vector size 1 with the value vect[0] diff --git a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx index 66cf2d3fcefc03352d3cc9068fd546bd6cbe9e1b..e02e4f5caa01e6ada5811effc8af84a8dc960713 100644 --- a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx +++ b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx @@ -419,6 +419,8 @@ int main( int argc, char *argv[] ) filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput( dataAtmosphericCorrectionParameters ); + + filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex