From ff581b51637e3fa2a3fd51aa9bf2eefa737670b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Tue, 29 Mar 2022 11:39:09 +0100
Subject: [PATCH] bugfix fringe case almost at edge

---
 aliby/tile/traps.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/aliby/tile/traps.py b/aliby/tile/traps.py
index 9426377b..987a18b5 100644
--- a/aliby/tile/traps.py
+++ b/aliby/tile/traps.py
@@ -81,8 +81,8 @@ def segment_traps(
         (i, region)
         for i, region in enumerate(regionprops(label_image))
         if min_mal < region.major_axis_length < max_mal
-        and tile_size // 2 < region.centroid[0] < half_floor(image.shape[0])
-        and tile_size // 2 < region.centroid[1] < half_floor(image.shape[1])
+        and tile_size // 2 < region.centroid[0] < half_floor(image.shape[0]) - 1
+        and tile_size // 2 < region.centroid[1] < half_floor(image.shape[1]) - 1
     ]
     idx, valid_region = zip(*idx_valid_region)
 
-- 
GitLab