From 8062cf581ae5a18b310435fcb5dadbe148cb2170 Mon Sep 17 00:00:00 2001 From: nrepina Date: Sat, 24 Aug 2024 10:25:41 +0200 Subject: [PATCH] Bug fix in Surface Mesh Multiscale Task. If label image of input region is empty, skip region. --- src/scmultiplex/fractal/surface_mesh_multiscale.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scmultiplex/fractal/surface_mesh_multiscale.py b/src/scmultiplex/fractal/surface_mesh_multiscale.py index 3d06bee..2302c9e 100644 --- a/src/scmultiplex/fractal/surface_mesh_multiscale.py +++ b/src/scmultiplex/fractal/surface_mesh_multiscale.py @@ -294,6 +294,13 @@ def surface_mesh_multiscale( seg, parent_mask = mask_by_parent_object( seg, groupby_dask, groupby_idlist, row_int, label_str ) + # Only proceed if labelmap is not empty + if np.amax(seg) == 0: + logger.warning( + f"Skipping object ID {label_str}. Label image contains no labeled objects." + ) + # Skip this object + continue else: # Check that label exists in object if float(label_str) not in seg: