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

ENH : correct SGFT on calib

parent 9de296fd
No related branches found
No related tags found
No related merge requests found
...@@ -88,7 +88,7 @@ TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) co ...@@ -88,7 +88,7 @@ TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) co
ossimKeywordlist kwl; ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl); imageKeywordlist.convertToOSSIMKeywordlist(kwl);
std::cout<<kwl<<std::endl;
std::string key; std::string key;
ossimString separatorList; ossimString separatorList;
key = "azimuth_start_time"; key = "azimuth_start_time";
...@@ -678,8 +678,33 @@ TerraSarImageMetadataInterface::GetRadarFrequency( const MetaDataDictionaryType ...@@ -678,8 +678,33 @@ TerraSarImageMetadataInterface::GetRadarFrequency( const MetaDataDictionaryType
ossimKeywordlist kwl; ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl); imageKeywordlist.convertToOSSIMKeywordlist(kwl);
ossimString tempVal = kwl.find("radarFrequency"); ossimString tempVal = kwl.find("radarFrequency");
double freq =tempVal.toDouble();
return freq;
}
double
TerraSarImageMetadataInterface::GetPRF( const MetaDataDictionaryType & dict ) const
{
if( !this->CanRead( dict ) )
{
itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image");
}
ImageKeywordlistType imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
}
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
ossimString tempVal = kwl.find("sensor_params.prf");
double freq = tempVal.toDouble(); double freq = tempVal.toDouble();
return freq; return freq;
......
...@@ -126,6 +126,9 @@ public: ...@@ -126,6 +126,9 @@ public:
/** Get the radar frequency */ /** Get the radar frequency */
double GetRadarFrequency( const MetaDataDictionaryType & ) const; double GetRadarFrequency( const MetaDataDictionaryType & ) const;
/** Get the PRF */
double GetPRF( const MetaDataDictionaryType & ) const;
/** Get the incidence angles structure */ /** Get the incidence angles structure */
ossimplugins::IncidenceAngles* GetIncidenceAngles( const MetaDataDictionaryType & ) const; ossimplugins::IncidenceAngles* GetIncidenceAngles( const MetaDataDictionaryType & ) const;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define __otbTerraSarCalibrationImageFilter_txx #define __otbTerraSarCalibrationImageFilter_txx
#include <algorithm> #include <algorithm>
#include <iomanip>
#include "otbTerraSarCalibrationImageFilter.h" #include "otbTerraSarCalibrationImageFilter.h"
#include "otbTerraSarImageMetadataInterface.h" #include "otbTerraSarImageMetadataInterface.h"
...@@ -147,12 +148,12 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> ...@@ -147,12 +148,12 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
} }
} }
// Radar frequency (PRF) // PRF
if (this->GetPRF() == 1.) if (this->GetPRF() == 1.)
{ {
if (mdIsAvailable) if (mdIsAvailable)
{ {
m_PRF = lImageMetadata->GetRadarFrequency(this->GetInput()->GetMetaDataDictionary()); m_PRF = lImageMetadata->GetPRF(this->GetInput()->GetMetaDataDictionary());
} }
else else
{ {
...@@ -213,27 +214,46 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> ...@@ -213,27 +214,46 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
// Set up progress reporting // Set up progress reporting
itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
for(unsigned int i = 0; i < m_NoiseRecords.size();++i)
{
std::cout<<std::fixed<<std::setprecision(10)<<"t"<<i<<": "<< m_NoiseRecords[i].first << std::endl;
}
assert(!m_NoiseRecords.empty());
// The acquisition time of the first line of OutputRegionForThread. // The acquisition time of the first line of OutputRegionForThread.
double invPRF = 1/m_PRF; //double PRFJulian = m_PRF * (0.864 / 1e-5);
double currentAzimuthPosition = m_NoiseRecords.back().first = invPRF double invPRF = /*(0.864/1e-5) * */1/m_PRF;
double currentAzimuthPosition = m_NoiseRecords.back().first + invPRF
* (m_OriginalProductSize[1]- inputIt.GetIndex()[1] -1); * (m_OriginalProductSize[1]- inputIt.GetIndex()[1] -1);
// Local variable to store the current noise record
NoiseRecordType currentNoiseRecord;
std::cout<<"Product size: "<<m_OriginalProductSize<<std::endl;
std::cout<<"Start index: "<<inputIt.GetIndex()<<std::endl;
std::cout<<"Current position: "<<currentAzimuthPosition<<std::endl;
std::cout<<"PRF: "<<m_PRF<<std::endl;
// Look for the first noise record to be used (remember we sorted // Look for the first noise record to be used (remember we sorted
// m_NoiseRecords by decreasing time) // m_NoiseRecords by decreasing time)
NoiseRecordVectorType::const_iterator currentNoiseRecordIt = m_NoiseRecords.begin(); NoiseRecordVectorType::const_iterator currentNoiseRecordIt = m_NoiseRecords.begin();
unsigned int nrIndex = 0;
// Iterate until we find it // Iterate until we find it
while(currentNoiseRecordIt != m_NoiseRecords.end() && currentNoiseRecordIt->first > currentAzimuthPosition) while(currentNoiseRecordIt != m_NoiseRecords.end() && currentNoiseRecordIt->first > currentAzimuthPosition)
{ {
++currentNoiseRecordIt; ++nrIndex;
++currentNoiseRecordIt;
} }
assert(currentNoiseRecordIt != m_NoiseRecords.end());
// Store the current noise record azimuth position // Store the current noise record azimuth position
double currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first; double currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first;
calibrationFunctor.SetNoiseRecord(currentNoiseRecordIt->second);
std::cout<<nrIndex<<" degree: "<<currentNoiseRecordIt->second.get_polynomialDegree()<<std::endl;
// Store current line index // Store current line index
typename OutputImageRegionType::IndexType::IndexValueType currentLine = inputIt.GetIndex()[1]; typename OutputImageRegionType::IndexType::IndexValueType currentLine = inputIt.GetIndex()[1];
...@@ -254,13 +274,15 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> ...@@ -254,13 +274,15 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
{ {
// Update the iterator // Update the iterator
++currentNoiseRecordIt; ++currentNoiseRecordIt;
++nrIndex;
std::cout<<"NrIndex increment"<<std::endl;
// If we are not at the last record // If we are not at the last record
if(currentNoiseRecordIt != m_NoiseRecords.end()) if(currentNoiseRecordIt != m_NoiseRecords.end())
{ {
// Update the functor noise record // Update the functor noise record
currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first; currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first;
calibrationFunctor.SetNoiseRecord(currentNoiseRecordIt->second); calibrationFunctor.SetNoiseRecord(currentNoiseRecordIt->second);
std::cout<<nrIndex<<" degree: "<<currentNoiseRecordIt->second.get_polynomialDegree()<<std::endl;
} }
} }
} }
......
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