From 6124fa791c632994c4b0353cfea939f19dc6d6e0 Mon Sep 17 00:00:00 2001
From: Remi Cresson <remi.cresson@irstea.fr>
Date: Sat, 26 Oct 2019 18:23:33 +0200
Subject: [PATCH] ENH: new sample selection/extraction strategy (use nodata in
 selection or extraction)

---
 app/otbPatchesSelection.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/otbPatchesSelection.cxx b/app/otbPatchesSelection.cxx
index 99bb4d2..3154b8b 100644
--- a/app/otbPatchesSelection.cxx
+++ b/app/otbPatchesSelection.cxx
@@ -545,7 +545,6 @@ public:
     otbAppLogINFO("Grid step : " << this->GetParameterInt("grid.step"));
     otbAppLogINFO("Patch size : " << this->GetParameterInt("grid.psize"));
 
-
     // Compute no-data mask
     m_NoDataFilter = IsNoDataFilterType::New();
     m_NoDataFilter->GetFunctor().SetNoDataValue(GetParameterFloat("nodata"));
@@ -556,6 +555,9 @@ public:
     // If mask available, use it
     if (HasValue("mask"))
       {
+      if (GetParameterUInt8Image("mask")->GetLargestPossibleRegion().GetSize() !=
+          GetParameterFloatVectorImage("in")->GetLargestPossibleRegion().GetSize())
+        otbAppLogFATAL("Mask must have the same size as the input image!");
       m_MaskImageFilter = MaskImageFilterType::New();
       m_MaskImageFilter->SetInput(m_NoDataFilter->GetOutput());
       m_MaskImageFilter->SetMaskImage(GetParameterUInt8Image("mask"));
-- 
GitLab