From a4994d5ac5cb579352436a88c0dd1a93a4a0dbed Mon Sep 17 00:00:00 2001
From: Farzaneh Labbaf <f.labbaf97@gmail.com>
Date: Fri, 17 Mar 2023 13:21:30 +0100
Subject: [PATCH] Update packages and fix deprecated syntax in updated packages

---
 requirements.txt |  9 +++++----
 unet/segment.py  | 10 +++++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index 680a02d..8c87f20 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,13 +1,14 @@
 numpy>=1.17.4
 PyQt5>=5.14.2
 matplotlib>=3.1.1
-nd2reader==3.2.1
-h5py==2.9.0
+nd2reader==3.3.0
+h5py==3.8.0
 scikit-image>=0.15.0
+openpyxl==3.1.2
 Tensorflow==2.11.0
 opencv-python-headless>=4.7.0.72
 pandas>=0.25.3
-munkres==1.1.2
-sklearn==0.0
+munkres
+sklearn
 imageio>=2.6.1
 Pillow>=6.2.1
diff --git a/unet/segment.py b/unet/segment.py
index c333fb9..afdf009 100644
--- a/unet/segment.py
+++ b/unet/segment.py
@@ -1,6 +1,7 @@
 from scipy import ndimage as ndi
 from skimage.feature import peak_local_max
-from skimage.morphology import watershed, dilation
+from skimage.morphology import dilation
+from skimage.segmentation import watershed
 from skimage.filters import gaussian
 from skimage.measure import label
 
@@ -25,10 +26,13 @@ def segment(th, pred, min_distance=10, topology=None):
     elif callable(topology):
         topology = topology(dtr)
 
-    m = peak_local_max(-topology, min_distance, indices=False)
+    coords = peak_local_max(-topology, min_distance)
+    # to fix deprecation of indices in peak_local_max
+    mask = np.zeros(dtr.shape, dtype=bool)
+    mask[tuple(coords.T)] = True
     
     # Uncomment to start with cross for every pixel instead of single pixel
-    m_lab = label(m) #comment this
+    m_lab = label(mask) #comment this
     #m_dil = dilation(m)
     #m_lab = label(m_dil)
     wsh = watershed(topology, m_lab, mask=th, connectivity=2)
-- 
GitLab