Skip to content
Snippets Groups Projects
Commit efc5a2a8 authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

BUG: Segfault correction for AtmosphericCorrectionSequencement example: add...

BUG: Segfault correction for AtmosphericCorrectionSequencement example: add Update for AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms variable.
parent c97c7030
No related branches found
No related tags found
No related merge requests found
......@@ -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]
......
......@@ -419,6 +419,8 @@ int main( int argc, char *argv[] )
filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput(
dataAtmosphericCorrectionParameters );
filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment