Commit b1ce097c authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

ENH : Change SARDEMGridImageFilter to robustify the projection calculation...

ENH : Change SARDEMGridImageFilter to robustify the projection calculation (for origin different to zero)
parent 82797f0d
......@@ -373,9 +373,11 @@ namespace otb
// Allocate outputs Tabs
const ImageOutSizeType & outputRegionForThreadSize = outputRegionForThread.GetSize();
unsigned int nbCol = static_cast<unsigned int>(outputRegionForThreadSize[0]);
unsigned int firstCol = static_cast<unsigned int>(outputRegionForThread.GetIndex()[0]+this->GetOutput()->GetOrigin()[0]);
//unsigned int firstCol = static_cast<unsigned int>(outputRegionForThread.GetIndex()[0]+this->GetOutput()->GetOrigin()[0]);
unsigned int firstCol = static_cast<unsigned int>(outputRegionForThread.GetIndex()[0]);
unsigned int nbLine = static_cast<unsigned int>(outputRegionForThreadSize[1]);
unsigned int firstLine = static_cast<unsigned int>(outputRegionForThread.GetIndex()[1]+this->GetOutput()->GetOrigin()[1]);
//unsigned int firstLine = static_cast<unsigned int>(outputRegionForThread.GetIndex()[1]+this->GetOutput()->GetOrigin()[1]);
unsigned int firstLine = static_cast<unsigned int>(outputRegionForThread.GetIndex()[1]);
double *outRange = new double[nbCol*nbLine];
double *outAzi = new double[nbCol*nbLine];
......@@ -400,6 +402,7 @@ namespace otb
gridStep_SLC[0] = m_GridStep[0]*m_MLran;
gridStep_SLC[1] = m_GridStep[1]*m_MLazi;
////////////////////////////// Scan Input Projected DEM //////////////////////////////
// For each Line of input
while ( !InIt_DEMProjMaster.IsAtEnd() && !InIt_DEMProjSlave.IsAtEnd())
......@@ -411,9 +414,9 @@ namespace otb
while (!InIt_DEMProjMaster.IsAtEndOfLine() && !InIt_DEMProjSlave.IsAtEndOfLine())
{
// Grid geometry for DEM current point
unsigned int indGrid_L = (std::round(InIt_DEMProjMaster.Get()[1]))/(m_GridStep[1]);
unsigned int indGrid_C = (std::round(InIt_DEMProjMaster.Get()[0]))/(m_GridStep[0]);
unsigned int indGrid_L = (std::round(InIt_DEMProjMaster.Get()[1] - this->GetOutput()->GetOrigin()[1]))/(m_GridStep[1]) ;
unsigned int indGrid_C = (std::round(InIt_DEMProjMaster.Get()[0] - this->GetOutput()->GetOrigin()[0]))/(m_GridStep[0]);
// Check if the DEM point is into outputThreadRegion
if ((indGrid_L >= firstLine && indGrid_L < firstLine + nbLine) &&
(indGrid_C >= firstCol && indGrid_C < firstCol + nbCol))
......
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