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

ENH : missing OTBCommonTest11 init

parent cb093b36
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ FilterFunctionValues ...@@ -33,6 +33,8 @@ FilterFunctionValues
{ {
m_MinSpectralValue = 0; m_MinSpectralValue = 0;
m_MaxSpectralValue = 1; m_MaxSpectralValue = 1;
// Fill with 1. Size 3 for 6S interpolation
m_FilterFunctionValues = ValuesVectorType(3,1.);
m_UserStep = 0.0025; m_UserStep = 0.0025;
} }
...@@ -138,21 +140,21 @@ AtmosphericCorrectionParameters ...@@ -138,21 +140,21 @@ AtmosphericCorrectionParameters
{ {
if(bandId != 0) if(bandId != 0)
{ {
function->SetFilterFunctionValues(vect); function->SetFilterFunctionValues(vect);
m_WavelenghtSpectralBand.push_back(function); m_WavelenghtSpectralBand.push_back(function);
function = FilterFunctionValues::New(); function = FilterFunctionValues::New();
vect.clear(); vect.clear();
} }
bandId++; bandId++;
function->SetMinSpectralValue(keywordStrings[0].toDouble()); function->SetMinSpectralValue(keywordStrings[0].toDouble());
function->SetMaxSpectralValue(keywordStrings[1].toDouble()); function->SetMaxSpectralValue(keywordStrings[1].toDouble());
if(keywordStrings.size() == 3) if(keywordStrings.size() == 3)
function->SetUserStep(keywordStrings[2].toDouble()); function->SetUserStep(keywordStrings[2].toDouble());
} }
else if(keywordStrings.size()==1) else if(keywordStrings.size()==1)
vect.push_back(keywordStrings[0].toDouble()); vect.push_back(keywordStrings[0].toDouble());
else if(keywordStrings.size()!=0) else if(keywordStrings.size()!=0)
itkExceptionMacro("File "<<filename<<" not valid."); itkExceptionMacro("File "<<filename<<" not valid.");
} }
function->SetFilterFunctionValues(vect); function->SetFilterFunctionValues(vect);
m_WavelenghtSpectralBand.push_back(function); m_WavelenghtSpectralBand.push_back(function);
......
...@@ -96,17 +96,26 @@ ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage> ...@@ -96,17 +96,26 @@ ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage>
// the user has set the filter function values // the user has set the filter function values
else else
{ {
if( m_FilterFunctionCoef.size() != this->GetInput()->GetNumberOfComponentsPerPixel() ) bool ffvfOK = true;
{ if( m_FilterFunctionCoef.size() == 0 )
itkExceptionMacro(<<"Filter Function and image channels mismatch."); ffvfOK = false;
} else if( m_FilterFunctionCoef.size() != this->GetInput()->GetNumberOfComponentsPerPixel() )
itkExceptionMacro(<<"Function Values and Input image size dismatch");
for(unsigned int i=0; i<this->GetInput()->GetNumberOfComponentsPerPixel(); i++) for(unsigned int i=0; i<this->GetInput()->GetNumberOfComponentsPerPixel(); i++)
{ {
FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New();
functionValues->SetFilterFunctionValues(m_FilterFunctionCoef[i]); // if no ffvf set, set 1 as coef
if(ffvfOK)
functionValues->SetFilterFunctionValues(m_FilterFunctionCoef[i]);
functionValues->SetMinSpectralValue(imageMetadataInterface->GetFirstWavelengths(dict)[i]); functionValues->SetMinSpectralValue(imageMetadataInterface->GetFirstWavelengths(dict)[i]);
functionValues->SetMaxSpectralValue(imageMetadataInterface->GetLastWavelengths(dict)[i]); functionValues->SetMaxSpectralValue(imageMetadataInterface->GetLastWavelengths(dict)[i]);
// if no ffvf set, compute the step to be sure that the valueswavelength are between min and max
if(!ffvfOK)
functionValues->SetUserStep( functionValues->GetMaxSpectralValue()-functionValues->GetMinSpectralValue()/2. );
m_CorrectionParameters->SetWavelenghtSpectralBandWithIndex(i, functionValues); m_CorrectionParameters->SetWavelenghtSpectralBandWithIndex(i, functionValues);
} }
} }
......
...@@ -174,7 +174,6 @@ SIXSTraits::ComputeWavelenghtSpectralBandValuesFor6S( ...@@ -174,7 +174,6 @@ SIXSTraits::ComputeWavelenghtSpectralBandValuesFor6S(
{ {
itkGenericExceptionMacro(<<"The FilterFunctionValues vector must have more than 1 values !"); 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 - epsilon )) if( L_min+static_cast<double>(FilterFunctionValues.size()-1)*L_userStep < (L_max - epsilon ))
{ {
itkGenericExceptionMacro(<<"The following condition: "<<L_min<<"+("<<FilterFunctionValues.size()<<"-1)*"<<L_userStep<<" < ("<< L_max <<"-"<<epsilon<<") is not respected !"); itkGenericExceptionMacro(<<"The following condition: "<<L_min<<"+("<<FilterFunctionValues.size()<<"-1)*"<<L_userStep<<" < ("<< L_max <<"-"<<epsilon<<") is not respected !");
......
...@@ -31,6 +31,7 @@ ENDIF(OTB_USE_MAPNIK) ...@@ -31,6 +31,7 @@ ENDIF(OTB_USE_MAPNIK)
IF(OTB_USE_PQXX) IF(OTB_USE_PQXX)
SET(COMMON_TESTS10 ${CXX_TEST_PATH}/otbCommonTests10) SET(COMMON_TESTS10 ${CXX_TEST_PATH}/otbCommonTests10)
ENDIF(OTB_USE_PQXX) ENDIF(OTB_USE_PQXX)
SET(COMMON_TESTS11 ${CXX_TEST_PATH}/otbCommonTests11)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -65,6 +65,8 @@ public: ...@@ -65,6 +65,8 @@ public:
ossimString getAcquisitionDate() const; ossimString getAcquisitionDate() const;
ossimString getProductionDate() const; ossimString getProductionDate() const;
ossimString getImageID() const; ossimString getImageID() const;
ossimString getInstrument() const;
ossim_uint32 getInstrumentIndex() const;
ossimFilename getMetadataFile() const; ossimFilename getMetadataFile() const;
void getSunAzimuth(ossim_float64& az) const; void getSunAzimuth(ossim_float64& az) const;
void getSunElevation(ossim_float64& el) const; void getSunElevation(ossim_float64& el) const;
...@@ -74,7 +76,7 @@ public: ...@@ -74,7 +76,7 @@ public:
void getViewingAngle(ossim_float64& va) const; void getViewingAngle(ossim_float64& va) const;
void getSceneOrientation(ossim_float64& so) const; void getSceneOrientation(ossim_float64& so) const;
ossim_uint32 getNumberOfBands() const; ossim_uint32 getNumberOfBands() const;
ossim_uint16 getStepCount() const; ossim_uint32 getStepCount() const;
bool isStarTrackerUsed() const; bool isStarTrackerUsed() const;
bool isSwirDataUsed() const; bool isSwirDataUsed() const;
...@@ -222,6 +224,8 @@ private: ...@@ -222,6 +224,8 @@ private:
ossimString theImageID; ossimString theImageID;
ossimFilename theMetadataFile; ossimFilename theMetadataFile;
ossimString theProductionDate; ossimString theProductionDate;
ossimString theInstrument;
ossim_uint32 theInstrumentIndex;
/* /*
* From xml section: * From xml section:
...@@ -265,7 +269,7 @@ private: ...@@ -265,7 +269,7 @@ private:
bool theSwirDataFlag; bool theSwirDataFlag;
ossim_uint32 theNumBands; ossim_uint32 theNumBands;
ossimString theAcquisitionDate; ossimString theAcquisitionDate;
ossim_uint16 theStepCount; ossim_uint32 theStepCount;
//--- //---
......
...@@ -38,6 +38,9 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData () ...@@ -38,6 +38,9 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData ()
theMetadataVersion(OSSIM_SPOT_METADATA_VERSION_UNKNOWN), theMetadataVersion(OSSIM_SPOT_METADATA_VERSION_UNKNOWN),
theImageID(), theImageID(),
theMetadataFile(), theMetadataFile(),
theProductionDate(),
theInstrument(),
theInstrumentIndex(0),
theSunAzimuth(0.0), theSunAzimuth(0.0),
theSunElevation(0.0), theSunElevation(0.0),
theIncidenceAngle(0.0), theIncidenceAngle(0.0),
...@@ -74,7 +77,10 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData () ...@@ -74,7 +77,10 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData ()
ossimSpotDimapSupportData::ossimSpotDimapSupportData(const ossimSpotDimapSupportData& rhs) ossimSpotDimapSupportData::ossimSpotDimapSupportData(const ossimSpotDimapSupportData& rhs)
:ossimErrorStatusInterface(rhs), :ossimErrorStatusInterface(rhs),
theMetadataVersion(rhs.theMetadataVersion), theMetadataVersion(rhs.theMetadataVersion),
theProductionDate(rhs.theProductionDate),
theImageID(rhs.theImageID), theImageID(rhs.theImageID),
theInstrument(rhs.theInstrument),
theInstrumentIndex(rhs.theInstrumentIndex),
theMetadataFile (rhs.theMetadataFile), theMetadataFile (rhs.theMetadataFile),
theSunAzimuth(rhs.theSunAzimuth), theSunAzimuth(rhs.theSunAzimuth),
theSunElevation(rhs.theSunElevation), theSunElevation(rhs.theSunElevation),
...@@ -116,6 +122,9 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData (const ossimFilename& dimap ...@@ -116,6 +122,9 @@ ossimSpotDimapSupportData::ossimSpotDimapSupportData (const ossimFilename& dimap
theMetadataVersion(OSSIM_SPOT_METADATA_VERSION_UNKNOWN), theMetadataVersion(OSSIM_SPOT_METADATA_VERSION_UNKNOWN),
theImageID(), theImageID(),
theMetadataFile (dimapFile), theMetadataFile (dimapFile),
theInstrument(),
theInstrumentIndex(0),
theProductionDate(),
theSunAzimuth(0.0), theSunAzimuth(0.0),
theSunElevation(0.0), theSunElevation(0.0),
theIncidenceAngle(0.0), theIncidenceAngle(0.0),
...@@ -180,6 +189,8 @@ void ossimSpotDimapSupportData::clearFields() ...@@ -180,6 +189,8 @@ void ossimSpotDimapSupportData::clearFields()
clearErrorStatus(); clearErrorStatus();
theSensorID="Spot 5"; theSensorID="Spot 5";
theMetadataVersion = OSSIM_SPOT_METADATA_VERSION_UNKNOWN; theMetadataVersion = OSSIM_SPOT_METADATA_VERSION_UNKNOWN;
theInstrument = "";
theInstrumentIndex = 0;
theImageID = ""; theImageID = "";
theMetadataFile = ""; theMetadataFile = "";
theProductionDate = ""; theProductionDate = "";
...@@ -852,6 +863,8 @@ void ossimSpotDimapSupportData::printInfo(ostream& os) const ...@@ -852,6 +863,8 @@ void ossimSpotDimapSupportData::printInfo(ostream& os) const
<< "\n " << "\n "
<< "\n Job Number (ID): " << theImageID << "\n Job Number (ID): " << theImageID
<< "\n Acquisition Date: " << theAcquisitionDate << "\n Acquisition Date: " << theAcquisitionDate
<< "\n Instrument: " << theInstrument
<< "\n Instrument Index: " << theInstrumentIndex
<< "\n Production Date: " << theProductionDate << "\n Production Date: " << theProductionDate
<< "\n Number of Bands: " << theNumBands << "\n Number of Bands: " << theNumBands
<< "\n Geo Center Point: " << theRefGroundPoint << "\n Geo Center Point: " << theRefGroundPoint
...@@ -915,6 +928,16 @@ ossimFilename ossimSpotDimapSupportData::getMetadataFile() const ...@@ -915,6 +928,16 @@ ossimFilename ossimSpotDimapSupportData::getMetadataFile() const
return theMetadataFile; return theMetadataFile;
} }
ossimString ossimSpotDimapSupportData::getInstrument() const
{
return theInstrument;
}
ossim_uint32 ossimSpotDimapSupportData::getInstrumentIndex() const
{
return theInstrumentIndex;
}
void ossimSpotDimapSupportData::getSunAzimuth(ossim_float64& az) const void ossimSpotDimapSupportData::getSunAzimuth(ossim_float64& az) const
{ {
az = theSunAzimuth; az = theSunAzimuth;
...@@ -950,7 +973,7 @@ ossim_uint32 ossimSpotDimapSupportData::getNumberOfBands() const ...@@ -950,7 +973,7 @@ ossim_uint32 ossimSpotDimapSupportData::getNumberOfBands() const
return theNumBands; return theNumBands;
} }
ossim_uint16 ossimSpotDimapSupportData::getStepCount() const ossim_uint32 ossimSpotDimapSupportData::getStepCount() const
{ {
return theStepCount; return theStepCount;
} }
...@@ -1234,6 +1257,16 @@ bool ossimSpotDimapSupportData::saveState(ossimKeywordlist& kwl, ...@@ -1234,6 +1257,16 @@ bool ossimSpotDimapSupportData::saveState(ossimKeywordlist& kwl,
theNumBands, theNumBands,
true); true);
kwl.add(prefix,
"instrument",
theInstrument,
true);
kwl.add(prefix,
"instrument_index",
theInstrumentIndex,
true);
kwl.add(prefix, kwl.add(prefix,
ossimKeywordNames::IMAGE_DATE_KW, ossimKeywordNames::IMAGE_DATE_KW,
theAcquisitionDate, theAcquisitionDate,
...@@ -1321,6 +1354,7 @@ bool ossimSpotDimapSupportData::saveState(ossimKeywordlist& kwl, ...@@ -1321,6 +1354,7 @@ bool ossimSpotDimapSupportData::saveState(ossimKeywordlist& kwl,
{ {
tempString += (ossimString::toString(theSolarIrradiance[idx]) + " "); tempString += (ossimString::toString(theSolarIrradiance[idx]) + " ");
} }
kwl.add(prefix, kwl.add(prefix,
"solar_irradiance", "solar_irradiance",
tempString, tempString,
...@@ -1480,6 +1514,8 @@ bool ossimSpotDimapSupportData::loadState(const ossimKeywordlist& kwl, ...@@ -1480,6 +1514,8 @@ bool ossimSpotDimapSupportData::loadState(const ossimKeywordlist& kwl,
theNumBands = ossimString(kwl.find(prefix, ossimKeywordNames::NUMBER_BANDS_KW)).toUInt32(); theNumBands = ossimString(kwl.find(prefix, ossimKeywordNames::NUMBER_BANDS_KW)).toUInt32();
theAcquisitionDate = kwl.find(prefix, ossimKeywordNames::IMAGE_DATE_KW); theAcquisitionDate = kwl.find(prefix, ossimKeywordNames::IMAGE_DATE_KW);
theProductionDate = kwl.find(prefix, "production_date"); theProductionDate = kwl.find(prefix, "production_date");
theInstrument = kwl.find(prefix, "instrument");
theInstrumentIndex = ossimString(kwl.find(prefix, "instrument_index")).toUInt32();
theStepCount = ossimString(kwl.find(prefix, "step_count")).toInt32(); theStepCount = ossimString(kwl.find(prefix, "step_count")).toInt32();
theIncidenceAngle = ossimString(kwl.find(prefix, "incident_angle")).toDouble(); theIncidenceAngle = ossimString(kwl.find(prefix, "incident_angle")).toDouble();
...@@ -1714,6 +1750,46 @@ bool ossimSpotDimapSupportData::parsePart1( ...@@ -1714,6 +1750,46 @@ bool ossimSpotDimapSupportData::parsePart1(
} }
theProductionDate = xml_nodes[0]->getText(); theProductionDate = xml_nodes[0]->getText();
//---
// Fetch the Instrument:
//---
xml_nodes.clear();
xpath = "/Dimap_Document/Dataset_Sources/INSTRUMENT";
xmlDocument->findNodes(xpath, xml_nodes);
if (xml_nodes.size() == 0)
{
setErrorStatus();
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< MODULE << " DEBUG:"
<< "\nCould not find: " << xpath
<< std::endl;
}
return false;
}
theInstrument = xml_nodes[0]->getText();
//---
// Fetch the Instrument Index:
//---
xml_nodes.clear();
xpath = "/Dimap_Document/Dataset_Sources/INSTRUMENT";
xmlDocument->findNodes(xpath, xml_nodes);
if (xml_nodes.size() == 0)
{
setErrorStatus();
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< MODULE << " DEBUG:"
<< "\nCould not find: " << xpath
<< std::endl;
}
return false;
}
theInstrumentIndex = xml_nodes[0]->getText().toUInt32();
return true; return true;
} }
......
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