From 4ddeb05c7579b9141059e4adbe0a9b36b0f91ef3 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Fri, 29 Aug 2014 17:49:21 +0200
Subject: [PATCH] BUG: Mantis-942: use correct image envelope

---
 Applications/Utils/otbVectorDataExtractROI.cxx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Applications/Utils/otbVectorDataExtractROI.cxx b/Applications/Utils/otbVectorDataExtractROI.cxx
index 73a4d0f1b4..f05466bd14 100644
--- a/Applications/Utils/otbVectorDataExtractROI.cxx
+++ b/Applications/Utils/otbVectorDataExtractROI.cxx
@@ -116,9 +116,11 @@ private:
 
     // Find the geographic region of interest
     // Get the index of the corner of the image
-    IndexType ul, ur, ll, lr;
+    itk::ContinuousIndex<double,2> ul(inImage->GetLargestPossibleRegion().GetIndex());
     PointType pul, pur, pll, plr;
-    ul = inImage->GetLargestPossibleRegion().GetIndex();
+    ul[0] += -0.5;
+    ul[1] += -0.5;
+    itk::ContinuousIndex<double,2> ur, ll, lr;
     ur = ul;
     ll = ul;
     lr = ul;
@@ -128,10 +130,10 @@ private:
     ll[1] += inImage->GetLargestPossibleRegion().GetSize()[1];
 
     // Transform to physical point
-    inImage->TransformIndexToPhysicalPoint(ul, pul);
-    inImage->TransformIndexToPhysicalPoint(ur, pur);
-    inImage->TransformIndexToPhysicalPoint(ll, pll);
-    inImage->TransformIndexToPhysicalPoint(lr, plr);
+    inImage->TransformContinuousIndexToPhysicalPoint(ul, pul);
+    inImage->TransformContinuousIndexToPhysicalPoint(ur, pur);
+    inImage->TransformContinuousIndexToPhysicalPoint(ll, pll);
+    inImage->TransformContinuousIndexToPhysicalPoint(lr, plr);
 
     // Build the cartographic region
     RemoteSensingRegionType            rsRegion;
-- 
GitLab