Skip to content
Snippets Groups Projects
Commit f4a80e05 authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

BUG : Correction into SARInterferogram filter with Margin

parent a324b641
No related branches found
No related tags found
No related merge requests found
......@@ -619,7 +619,7 @@ namespace otb
itk::ThreadIdType threadId)
{
// Compute corresponding input region for SAR images
ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, false);
ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, true);
// Define/declare an iterator that will walk the input regions for this
// thread.
......@@ -662,21 +662,9 @@ namespace otb
indFirstL = -m_MarginAzi;
}
ImageSARIndexType indSARL;
indSARL[0] = inMasterIt.GetIndex()[0];
indSARL[1] = inMasterIt.GetIndex()[1] - (-indFirstL);
if ((indSARL[1] + indLastL) > (m_nbLinesSAR-1))
{
indLastL = (m_nbLinesSAR-1) - indSARL[1];
}
// Check previous index
if (indSARL[1] >= 0 && m_MarginAzi != 0)
if ((inMasterIt.GetIndex()[1] + indLastL - indFirstL) > (m_nbLinesSAR-1))
{
// Previous index inputs
inMasterIt.SetIndex(indSARL);
inSlaveIt.SetIndex(indSARL);
indLastL = (m_nbLinesSAR-1) - inMasterIt.GetIndex()[1] + indFirstL;
}
bool backTopreviousLines = false;
......@@ -706,9 +694,9 @@ namespace otb
indSARL[0] = inMasterIt.GetIndex()[0];
indSARL[1] = inMasterIt.GetIndex()[1] - (2*m_MarginAzi);
if ((indSARL[1] + indLastL) > (m_nbLinesSAR-1))
if ((indSARL[1] + indLastL - indFirstL) > (m_nbLinesSAR-1))
{
indLastL = (m_nbLinesSAR - 1) - indSARL[1];
indLastL = (m_nbLinesSAR - 1) - indSARL[1] + indFirstL;
}
// Check previous index
......@@ -745,22 +733,11 @@ namespace otb
indFirstC = -m_MarginRan;
}
ImageSARIndexType indSARC;
indSARC[0] = inMasterIt.GetIndex()[0] - (-indFirstC);
indSARC[1] = inMasterIt.GetIndex()[1];
if ((indSARC[0] + indLastC) > (m_nbColSAR-1))
if ((inMasterIt.GetIndex()[0] + indLastC - indFirstC) > (m_nbColSAR-1))
{
indLastC = (m_nbColSAR-1) - indSARC[0];
indLastC = (m_nbColSAR-1) - inMasterIt.GetIndex()[0] + indFirstC;
}
// Check previous index
if (indSARC[0] >= 0 && m_MarginRan != 0)
{
// Previous index inputs
inMasterIt.SetIndex(indSARC);
inSlaveIt.SetIndex(indSARC);
}
// For each column
while (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine() && !outIt.IsAtEndOfLine())
......@@ -777,9 +754,9 @@ namespace otb
indSARC[0] = inMasterIt.GetIndex()[0] - (2*m_MarginRan);
indSARC[1] = inMasterIt.GetIndex()[1];
if ((indSARC[0] + indLastC) > (m_nbColSAR-1))
if ((indSARC[0] + indLastC - indFirstC) > (m_nbColSAR-1))
{
indLastC = (m_nbColSAR-1) - indSARC[0];
indLastC = (m_nbColSAR-1) - indSARC[0] + indFirstC;
}
// Check previous index
......@@ -877,12 +854,12 @@ namespace otb
itk::ThreadIdType threadId)
{
// Compute corresponding input region for SAR images
ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, false);
ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, true);
// Compute corresponding input region for Topographic phase image
bool sameGeoAsMainOutput; // If true => Geo TopoPhase == main output geo else Geo TopoPhase = SAR Geo
ImagePhaseRegionType inputPhaseRegionForThread = OutputRegionToInputPhaseRegion(outputRegionForThread,
sameGeoAsMainOutput, false);
sameGeoAsMainOutput, true);
// Define/declare an iterator that will walk the input regions for this
// thread.
typedef itk::ImageScanlineConstIterator< ImageSARType > InputIterator;
......@@ -927,33 +904,12 @@ namespace otb
{
indFirstL = -m_MarginAzi;
}
ImageSARIndexType indSARL;
indSARL[0] = inMasterIt.GetIndex()[0];
indSARL[1] = inMasterIt.GetIndex()[1] - (-indFirstL);
ImagePhaseIndexType indPhaL;
indPhaL[0] = inTopoPhaseIt.GetIndex()[0];
indPhaL[1] = inTopoPhaseIt.GetIndex()[1] - (-indFirstL);
if ((indSARL[1] + indLastL) > (m_nbLinesSAR-1))
{
indLastL = (m_nbLinesSAR-1) - indSARL[1];
}
// Check previous index
if (indSARL[1] >= 0 && indPhaL[1] >= 0 && m_MarginAzi != 0)
if ((inMasterIt.GetIndex()[1] + (indLastL - indFirstL)) > (m_nbLinesSAR-1))
{
// Previous index inputs
inMasterIt.SetIndex(indSARL);
inSlaveIt.SetIndex(indSARL);
// If topographic phase has SAR geo
if (!sameGeoAsMainOutput)
{
inTopoPhaseIt.SetIndex(indPhaL);
}
indLastL = (m_nbLinesSAR-1) + indFirstL - inMasterIt.GetIndex()[1];
}
bool backTopreviousLines = false;
bool backTopreviousColunms = false;
......@@ -987,9 +943,9 @@ namespace otb
indPhaL[1] = inTopoPhaseIt.GetIndex()[1] - (2*m_MarginAzi);
if ((indSARL[1] + indLastL) > (m_nbLinesSAR-1))
if ((indSARL[1] + indLastL - indFirstL) > (m_nbLinesSAR-1))
{
indLastL = (m_nbLinesSAR - 1) - indSARL[1];
indLastL = (m_nbLinesSAR - 1) - indSARL[1] + indFirstL;
}
// Check previous index
......@@ -1010,6 +966,7 @@ namespace otb
backTopreviousLines = true;
// GenerateInputRequestedRegion function requires an input region with
// In_nbLine = m_Averaging * Out_nbLine (Averaing in function of ML Factors and Margins)
for (int i = indFirstL ; i < indLastL; i++)
......@@ -1026,38 +983,16 @@ namespace otb
int indFirstC = 0;
int indLastC = m_MLRan + m_MarginRan;
if (inMasterIt.GetIndex()[0] >= m_MarginRan && m_MarginRan != 0)
if (inMasterIt.GetIndex()[0] >= m_MarginRan && m_MarginRan != 0)
{
indFirstC = -m_MarginRan;
}
ImageSARIndexType indSARC;
indSARC[0] = inMasterIt.GetIndex()[0] - (-indFirstC);
indSARC[1] = inMasterIt.GetIndex()[1];
ImagePhaseIndexType indPhaC;
indPhaC[0] = inTopoPhaseIt.GetIndex()[0] - (-indFirstC);
indPhaC[1] = inTopoPhaseIt.GetIndex()[1];
if ((indSARC[0] + indLastC) > (m_nbColSAR-1))
if ((inMasterIt.GetIndex()[0] + (indLastC - indFirstC)) > (m_nbColSAR-1))
{
indLastC = (m_nbColSAR-1) - indSARC[0];
indLastC = (m_nbColSAR-1) + indFirstC - inMasterIt.GetIndex()[0];
}
// Check previous index
if (indSARC[0] >= 0 && indPhaC[0] >= 0 && m_MarginRan != 0)
{
// Previous index inputs
inMasterIt.SetIndex(indSARC);
inSlaveIt.SetIndex(indSARC);
// If topographic phase has SAR geo
if (!sameGeoAsMainOutput)
{
inTopoPhaseIt.SetIndex(indPhaC);
}
}
///////// For each column /////////
while (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine() && !inTopoPhaseIt.IsAtEndOfLine()
......@@ -1081,9 +1016,9 @@ namespace otb
indPhaC[1] = inTopoPhaseIt.GetIndex()[1];
if ((indSARC[0] + indLastC) > (m_nbColSAR-1))
if ((indSARC[0] + indLastC - indFirstC) > (m_nbColSAR-1))
{
indLastC = (m_nbColSAR-1) - indSARC[0];
indLastC = (m_nbColSAR-1) - indSARC[0] + indFirstC;
}
// Check previous index
......
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