From 4ecffc478d5577b6ab8e6b90aaa9f0fc927ff265 Mon Sep 17 00:00:00 2001
From: remi <remi.cresson@irstea.fr>
Date: Tue, 29 Oct 2019 14:13:03 +0100
Subject: [PATCH] ENH: fix bug with nodata

---
 include/otbTensorflowSampler.hxx | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/otbTensorflowSampler.hxx b/include/otbTensorflowSampler.hxx
index a552fea..5cf15be 100644
--- a/include/otbTensorflowSampler.hxx
+++ b/include/otbTensorflowSampler.hxx
@@ -199,8 +199,6 @@ TensorflowSampler<TInputImage, TVectorData>
             PixelType pix = it.Get();
             for (unsigned int band; band < pix.Size(); band++)
               {
-              std::cout << band << std::endl;
-
               if (pix[band] == m_NodataValue)
                 {
                 hasBeenSampled = false;
@@ -217,6 +215,20 @@ TensorflowSampler<TInputImage, TVectorData>
       } // Next input
       if (hasBeenSampled)
       {
+        // TODO: delete this
+        IndexType outIndex;
+        outIndex[0] = 0;
+        outIndex[1] = count * m_PatchSizes[0][1];
+        RegionType region(outIndex, m_PatchSizes[0]);
+        IteratorType it(m_OutputPatchImages[0], region);
+        for (it.GoToBegin(); !it.IsAtEnd(); ++it)
+          {
+          PixelType pix = it.Get();
+          for (unsigned int band; band < pix.Size(); band++)
+            if (pix[band] == m_NodataValue)
+              std::cout << band << std::endl;
+          }
+
         // Fill label
         labelIndex[1] = count;
         m_OutputLabelImage->SetPixel(labelIndex, labelPix);
-- 
GitLab