Skip to content
Snippets Groups Projects
Commit 7d3655a1 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ENH : TOAToTOC automatization in progress

parent 3f6dfdf4
Branches
Tags
No related merge requests found
......@@ -59,7 +59,18 @@ FilterFunctionValues
AtmosphericCorrectionParameters
::AtmosphericCorrectionParameters()
{
m_SolarZenithalAngle = 361.;
m_SolarAzimutalAngle = 361.;
m_ViewingZenithalAngle = 361.;
m_ViewingAzimutalAngle = 361.;
m_Month = 0;
m_Day = 0;
m_AtmosphericPressure = 1030.;
m_WaterVaporAmount = 2.5;
m_OzoneAmount = 0.28;
m_AerosolModel = CONTINENTAL;
m_AerosolOptical = 0.2;
}
/**PrintSelf method */
......
......@@ -23,9 +23,11 @@
#define __otbReflectanceToSurfaceReflectanceImageFilter_h
#include "otbAtmosphericRadiativeTerms.h"
#include "otbUnaryImageFunctorWithVectorImageFilter.h"
#include "otbAtmosphericRadiativeTerms.h"
#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h"
#include "itkMetaDataDictionary.h"
namespace otb
{
......@@ -144,64 +146,65 @@ public:
itkTypeMacro(ReflectanceToSurfaceReflectanceImageFilter, UnaryImageFunctorWithVectorImageFilter);
/** Supported images definition. */
typedef typename InputImageType::PixelType InputPixelType;
typedef typename InputImageType::InternalPixelType InputInternalPixelType;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename OutputImageType::PixelType OutputPixelType;
typedef typename OutputImageType::InternalPixelType OutputInternalPixelType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename InputImageType::PixelType InputPixelType;
typedef typename InputImageType::InternalPixelType InputInternalPixelType;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename OutputImageType::PixelType OutputPixelType;
typedef typename OutputImageType::InternalPixelType OutputInternalPixelType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType;
typedef AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms Parameters2RadiativeTermsType;
typedef Parameters2RadiativeTermsType::Pointer Parameters2RadiativeTermsPointerType;
typedef AtmosphericCorrectionParameters::Pointer CorrectionParametersPointerType;
typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType;
typedef itk::MetaDataDictionary MetaDataDictionaryType;
/** Get/Set Atmospheric Radiative Terms. */
void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmo)
{
m_AtmosphericRadiativeTerms = atmo;
this->SetNthInput(1, m_AtmosphericRadiativeTerms);
m_IsSetAtmosphericRadiativeTerms = true;
this->Modified();
}
AtmosphericRadiativeTermsPointerType GetAtmosphericRadiativeTerms()
{
return m_AtmosphericRadiativeTerms;
}
/** Get/Set Atmospheric Correction Parameters. */
itkGetConstObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTerms);
itkGetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters);
/** Get/Set Aeronet file name. */
itkSetMacro(AeronetFileName, std::string);
itkGetMacro(AeronetFileName, std::string);
protected:
/** Constructor */
ReflectanceToSurfaceReflectanceImageFilter()
{
m_AtmosphericRadiativeTerms = AtmosphericRadiativeTerms::New();
};
ReflectanceToSurfaceReflectanceImageFilter();
/** Destructor */
virtual ~ReflectanceToSurfaceReflectanceImageFilter() {};
/** Initialize the functor vector */
void BeforeThreadedGenerateData ()
{
this->GetFunctorVector().clear();
for (unsigned int i = 0;i<this->GetInput()->GetNumberOfComponentsPerPixel();++i)
{
double coef;
double res;
coef = static_cast<double>(m_AtmosphericRadiativeTerms->GetTotalGaseousTransmission(i)
* m_AtmosphericRadiativeTerms->GetDownwardTransmittance(i)
* m_AtmosphericRadiativeTerms->GetUpwardTransmittance(i) );
coef = 1. / coef;
res = -m_AtmosphericRadiativeTerms->GetIntrinsicAtmosphericReflectance(i) * coef;
FunctorType functor;
functor.SetCoefficient(coef);
functor.SetResidu(res);
functor.SetSphericalAlbedo(static_cast<double>(m_AtmosphericRadiativeTerms->GetSphericalAlbedo(i)));
this->GetFunctorVector().push_back(functor);
}
}
/** If empty, fill AtmosphericRadiativeTerms using image metadata*/
void UpdateAtmosphericRadiativeTerms( const MetaDataDictionaryType dict );
/** Read the aeronet data and extract aerosol optical and water vapor amount. */
void UpdateAeronetData( const MetaDataDictionaryType dict );
/** Initialize the functor vector */
void BeforeThreadedGenerateData();
private:
AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms;
CorrectionParametersPointerType m_CorrectionParameters;
bool m_IsSetAtmosphericRadiativeTerms;
/** Path to an Aeronet data file, allows to compute aerosol optical and water vapor amounts. */
std::string m_AeronetFileName;
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbReflectanceToSurfaceReflectanceImageFilter.txx"
#endif
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment