From 3cffedfe45b8c0e262f3ecb4d10b72a6192e2911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABlle=20USSEGLIO?= <gaelle.usseglio@cnes.fr>
Date: Fri, 12 Jul 2019 12:02:26 +0000
Subject: [PATCH] ENH : Adapt margin according size image into
 SARDEMPolygonsAnalysis filter

---
 include/otbSARDEMPolygonsAnalysisImageFilter.txx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/otbSARDEMPolygonsAnalysisImageFilter.txx b/include/otbSARDEMPolygonsAnalysisImageFilter.txx
index 8e1b935..34229be 100644
--- a/include/otbSARDEMPolygonsAnalysisImageFilter.txx
+++ b/include/otbSARDEMPolygonsAnalysisImageFilter.txx
@@ -179,10 +179,14 @@ namespace otb
     // Set the margin
     int nbLinesSAR = m_SarImagePtr->GetLargestPossibleRegion().GetSize()[1];
     int nbLinesDEM = m_DemImagePtr->GetLargestPossibleRegion().GetSize()[1];
-    if (nbLinesSAR > nbLinesDEM)
+    if (nbLinesSAR/2 > nbLinesDEM)
       { 
 	m_Margin = (nbLinesSAR/nbLinesDEM)*30;
       }
+    else if (nbLinesSAR > nbLinesDEM)
+      {
+	m_Margin = (nbLinesSAR/nbLinesDEM)*60;
+      }
     else
       {
 	m_Margin = 100;
-- 
GitLab