From a6e8906fe1487835bf3bca57a6f7b6de9d53b346 Mon Sep 17 00:00:00 2001
From: Ezgi Berberoglu <berberoglu@biomed.ee.ethz.ch>
Date: Fri, 14 Dec 2018 13:42:50 +0100
Subject: [PATCH] corrections for box image generation

---
 generate_images.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generate_images.py b/generate_images.py
index 01d3c4d..77fb13d 100644
--- a/generate_images.py
+++ b/generate_images.py
@@ -103,7 +103,7 @@ class Image():
         # structure
         if (structure["type"] == "no"):
             self.I0_structure = self.I0_structure_no
-        if (structure["type"] == "box"):
+        elif (structure["type"] == "box"):
             self.I0_structure = self.I0_structure_box
             self.Xmin = structure["Xmin"]
             self.Xmax = structure["Xmax"]
@@ -206,7 +206,7 @@ class Image():
         if (g is not None): g[:] = 1. # MG 20180806: gradient is given by texture; here it is just indicator function
 
     def I0_structure_box(self, X, i, g=None):
-        if numpy.greater_equal(X, self.Xmin) and numpy.less_equal(X, self.Xmax):
+        if all(numpy.greater_equal(X, self.Xmin)) and all(numpy.less_equal(X, self.Xmax)):
             i[0] = 1.
         else:
             i[0] = 0.
-- 
GitLab