Skip to content
Snippets Groups Projects
Commit 2d4027c2 authored by Mickael Savinaud's avatar Mickael Savinaud
Browse files

ENH: reactivate the adjency effect computation

by default no adjency effect is computed (as previous even if the checkbox is set by default
correct some strange mistake about the name of parameters
parent cc25a406
No related branches found
No related tags found
No related merge requests found
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter<DoubleVectorImageType,DoubleVectorImageType> typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter<DoubleVectorImageType,DoubleVectorImageType>
SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; SurfaceAdjacencyEffect6SCorrectionSchemeFilterType;
typedef otb::GroundSpacingImageFunction<DoubleVectorImageType> GroundSpacingImageType; typedef otb::GroundSpacingImageFunction<FloatVectorImageType> GroundSpacingImageType;
typedef DoubleVectorImageType::IndexType IndexType; typedef DoubleVectorImageType::IndexType IndexType;
typedef GroundSpacingImageType::FloatType FloatType; typedef GroundSpacingImageType::FloatType FloatType;
...@@ -284,6 +284,7 @@ private: ...@@ -284,6 +284,7 @@ private:
SetParameterDescription("atmo.radius","Window radius for adjacency effects corrections"); SetParameterDescription("atmo.radius","Window radius for adjacency effects corrections");
MandatoryOff("atmo.radius"); MandatoryOff("atmo.radius");
SetDefaultParameterInt("atmo.radius", 2); SetDefaultParameterInt("atmo.radius", 2);
DisableParameter("atmo.radius");
// Doc example parameter settings // Doc example parameter settings
SetDocExampleParameterValue("in", "QB_1_ortho.tif"); SetDocExampleParameterValue("in", "QB_1_ortho.tif");
...@@ -439,7 +440,7 @@ private: ...@@ -439,7 +440,7 @@ private:
m_ScaleFilter->InPlaceOn(); m_ScaleFilter->InPlaceOn();
m_ClampFilter = ClampFilterType::New(); m_ClampFilter = ClampFilterType::New();
FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in"); FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in");
// Set (Date and Day) OR FluxNormalizationCoef to corresponding filters // Set (Date and Day) OR FluxNormalizationCoef to corresponding filters
if ( !IsParameterEnabled("acquisition.fluxnormalizationcoefficient") ) if ( !IsParameterEnabled("acquisition.fluxnormalizationcoefficient") )
...@@ -647,9 +648,9 @@ private: ...@@ -647,9 +648,9 @@ private:
m_AtmosphericParam->SetAerosolOptical(GetParameterFloat("atmo.opt")); m_AtmosphericParam->SetAerosolOptical(GetParameterFloat("atmo.opt"));
// Relative Spectral Response File // Relative Spectral Response File
if (IsParameterEnabled("rsr")) if (IsParameterEnabled("atmo.rsr"))
{ {
m_ReflectanceToSurfaceReflectanceFilter->SetFilterFunctionValuesFileName(GetParameterString("rsr")); m_ReflectanceToSurfaceReflectanceFilter->SetFilterFunctionValuesFileName(GetParameterString("atmo.rsr"));
} }
// Aeronet file // Aeronet file
...@@ -679,51 +680,62 @@ private: ...@@ -679,51 +680,62 @@ private:
GetLogger()->Info("Atmospheric correction parameters compute by 6S : " + oss.str()); GetLogger()->Info("Atmospheric correction parameters compute by 6S : " + oss.str());
//Compute adjacency effect bool adjComputation=false;
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter if (IsParameterEnabled("atmo.radius"))
// = SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); {
adjComputation=true;
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); //Compute adjacency effect
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter-> m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter
// SetAtmosphericRadiativeTerms( = SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New();
// m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms());
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle( m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput());
// m_AtmosphericParam->GetViewingZenithalAngle()); m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetWindowRadius(GetParameterInt("radius")); SetAtmosphericRadiativeTerms(
m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms());
// //estimate ground spacing in kilometers m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle(
// GroundSpacingImageType::Pointer groundSpacing = GroundSpacingImageType::New(); m_AtmosphericParam->GetViewingZenithalAngle());
m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetWindowRadius(GetParameterInt("atmo.radius"));
// groundSpacing->SetInputImage(inImage);
// IndexType index; //Estimate ground spacing in kilometers
GroundSpacingImageType::Pointer groundSpacing = GroundSpacingImageType::New();
// vnl_random rand;
groundSpacing->SetInputImage(inImage);
// index[0] = static_cast<IndexValueType>(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[0])); IndexType index;
// index[1] = static_cast<IndexValueType>(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[1])); vnl_random rand;
// FloatType tmpSpacing = groundSpacing->EvaluateAtIndex(index);
index[0] = static_cast<IndexValueType>(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[0]));
// const float spacingInKilometers = (std::max(tmpSpacing[0], tmpSpacing[1])) / 1000.; index[1] = static_cast<IndexValueType>(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[1]));
// // std::ostringstream oss2; FloatType tmpSpacing = groundSpacing->EvaluateAtIndex(index);
// // oss2.str("");
// // oss2 << spacingInKilometers; const float spacingInKilometers = (std::max(tmpSpacing[0], tmpSpacing[1])) / 1000.;
// // GetLogger()->Info("Spacing in kilometers " + oss2.str()); // std::ostringstream oss2;
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter-> // oss2.str("");
// SetPixelSpacingInKilometers(spacingInKilometers); // oss2 << spacingInKilometers;
// GetLogger()->Info("Spacing in kilometers " + oss2.str());
m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->
SetPixelSpacingInKilometers(spacingInKilometers);
// //rescale the surface reflectance in milli-reflectance
// m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->UpdateOutputInformation(); m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->UpdateOutputInformation();
// //m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->Update(); }
// m_ScaleFilter->SetInput(m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput());
//Rescale the surface reflectance in milli-reflectance
if (!IsParameterEnabled("clamp")) if (!IsParameterEnabled("clamp"))
{ {
m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); if (!adjComputation)
m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput());
else
m_ScaleFilter->SetInput(m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput());
} }
else else
{ {
GetLogger()->Info("Clamp values between [0, 100]"); GetLogger()->Info("Clamp values between [0, 100]");
m_ClampFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput());
if (!adjComputation)
m_ClampFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput());
else
m_ClampFilter->SetInput(m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput());
m_ClampFilter->ClampOutside(0.0, 1.0); m_ClampFilter->ClampOutside(0.0, 1.0);
m_ScaleFilter->SetInput(m_ClampFilter->GetOutput()); m_ScaleFilter->SetInput(m_ClampFilter->GetOutput());
} }
......
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