From 6148d6d4431238874064a4745432acdf3bad6123 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Thu, 23 Feb 2012 16:32:00 +0100
Subject: [PATCH] BUG: Fixing bugs on field sizes

---
 .../otbStereoRectificationGridGenerator.cxx    | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx
index 192ebcf0f2..f84f022d0f 100644
--- a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx
+++ b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx
@@ -316,9 +316,12 @@ private:
       lspacing[0]*=GetParameterInt("epi.step");
       lspacing[1]*=GetParameterInt("epi.step");
        
-      lsize[0]/=GetParameterInt("epi.step")+1;
-      lsize[1]/=GetParameterInt("epi.step")+1;
-      
+      lsize[0]/=GetParameterInt("epi.step");
+      lsize[1]/=GetParameterInt("epi.step");
+
+      lsize[0]+=1;
+      lsize[1]+=1;
+
       m_LeftInvertDeformationFieldFilter->SetOutputOrigin(lorigin);
       m_LeftInvertDeformationFieldFilter->SetOutputSpacing(lspacing);
       m_LeftInvertDeformationFieldFilter->SetSize(lsize);
@@ -349,6 +352,15 @@ private:
       FloatVectorImageType::SpacingType rspacing = GetParameterImage("io.inright")->GetSpacing();
       FloatVectorImageType::SizeType rsize = GetParameterImage("io.inright")->GetLargestPossibleRegion().GetSize();
 
+      rspacing[0]*=GetParameterInt("epi.step");
+      rspacing[1]*=GetParameterInt("epi.step");
+       
+      rsize[0]/=GetParameterInt("epi.step");
+      rsize[1]/=GetParameterInt("epi.step");
+
+      rsize[0]+=1;
+      rsize[1]+=1;
+
       m_RightInvertDeformationFieldFilter->SetOutputOrigin(rorigin);
       m_RightInvertDeformationFieldFilter->SetOutputSpacing(rspacing);
       m_RightInvertDeformationFieldFilter->SetSize(rsize);
-- 
GitLab