Commit 781356c2 authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO

ENH : New function into ossimSarSenorModel to specify the overlap area for two Burst S1_IW

parent bb7c8276
......@@ -96,6 +96,13 @@ public:
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels=false);
/** Specify overlap area between two bursts */
bool Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels=false);
/** Transform world point (lat,lon,hgt) to input image point
(col,row) and YZ frame */
......
......@@ -128,6 +128,23 @@ SarSensorModelAdapter::DeburstAndConcatenate(std::vector<std::pair<unsigned long
return false;
}
bool
SarSensorModelAdapter::Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels)
{
if(m_SensorModel.get())
{
return m_SensorModel->overlap(linesUp, linesLow, samplesUp, samplesLow, burstIndUp,
inputWithInvalidPixels);
}
return false;
}
bool SarSensorModelAdapter::ImageLineToDeburstLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long imageLine, unsigned long & deburstLine)
{
return ossimplugins::ossimSarSensorModel::imageLineToDeburstLine(lines,imageLine,deburstLine);
......
......@@ -355,6 +355,27 @@ public:
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels=false);
/**
* This method will estime the overlap area between two bursts and return the
* vector of lines and the vector of samples (with two elements : Burst Up and Burst Low).
* Note that this operation has no effect if theBurstRecords
* contains a single burst.
* \return true if this operation succeeded. No changes is
* made to the object if the operation fails.
* \param linesUp A container for the lines ranges to keep into the first Burst
* \param linesLow A container for the lines ranges to keep into the second Burst
* \param samplesUp A container for the samples ranges to keep into the first Burst.
* \param samplesDown A container for the samples ranges to keep into the second Burst.
* \param burstIndUp Index of the first Burst
* \param inputWithInvalidPixels A Boolean to indicate if invalids pixels are into inputs.
*/
bool overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels=false);
/**
* Returns pointer to a new instance, copy of this.
*/
......
......@@ -1936,6 +1936,84 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u
}
bool ossimSarSensorModel::overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels)
{
if(theBurstRecords.empty())
return false;
// Check the single burst record case or < to burstIndUp + 1
if(theBurstRecords.size() == 1 || theBurstRecords.size() <= ( burstIndUp + 1))
{
return false;
}
BurstRecordType burstUp = theBurstRecords[burstIndUp];
BurstRecordType burstLow = theBurstRecords[burstIndUp+1];
// Overlap for samples (valid samples)
std::pair<unsigned long,unsigned long> samples;
samples = std::make_pair(burstUp.startSample, burstUp.endSample);
if (burstLow.startSample > samples.first)
{
samples.first = burstLow.startSample;
}
if (burstLow.endSample < samples.second)
{
samples.second = burstLow.endSample;
}
unsigned long currentStartUp_S = 0;
unsigned long currentStartLow_S = 0;
unsigned long currentStopUp_S = samples.second-samples.first;
unsigned long currentStopLow_S = samples.second-samples.first;
if (inputWithInvalidPixels)
{
currentStartUp_S = samples.first;
currentStartLow_S = samples.first;
}
else
{
if (burstUp.startSample < samples.first)
{
currentStartUp_S = samples.first - burstUp.startSample;
}
if (burstLow.startSample < samples.first)
{
currentStartLow_S = samples.first - burstLow.startSample;
}
}
currentStopUp_S += currentStartUp_S;
currentStopLow_S += currentStartLow_S;
samplesUp = std::make_pair(currentStartUp_S, currentStopUp_S);
samplesLow = std::make_pair(currentStartLow_S, currentStopLow_S);
// Overlap for lines (valid + overlap IW)
DurationType timeOverlapEnd = (burstUp.azimuthStopTime - burstLow.azimuthStartTime);
unsigned long overlapLength = timeOverlapEnd/theAzimuthTimeInterval;
unsigned long lastValidBurstUp = burstUp.endLine - burstUp.startLine;
unsigned long firstValidBurstLow = 0;
if (inputWithInvalidPixels)
{
lastValidBurstUp = burstUp.endLine - burstIndUp*theNumberOfLinesPerBurst;
firstValidBurstLow = burstLow.startLine - (burstIndUp+1)*theNumberOfLinesPerBurst;
}
linesUp = std::make_pair(lastValidBurstUp - overlapLength, lastValidBurstUp);
linesLow = std::make_pair(firstValidBurstLow, firstValidBurstLow + overlapLength);
}
bool ossimSarSensorModel::imageLineToDeburstLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long imageLine, unsigned long & deburstLine)
{
std::vector<std::pair<unsigned long,unsigned long> >::const_iterator vit = lines.begin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment