From 166abf117da7bd395e1539822bd79f2c13985336 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Oct 2024 18:41:19 -0400 Subject: [PATCH] no longer remapping when reloading masks (#1029) --- cellpose/gui/io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cellpose/gui/io.py b/cellpose/gui/io.py index 2faadd6e..47576551 100644 --- a/cellpose/gui/io.py +++ b/cellpose/gui/io.py @@ -478,7 +478,8 @@ def _masks_to_gui(parent, masks, outlines=None, colors=None): # get unique values shape = masks.shape masks = masks.flatten() - fastremap.renumber(masks, in_place=True) + if len(fastremap.unique(masks)) != masks.max() + 1: + fastremap.renumber(masks, in_place=True) masks = masks.reshape(shape) masks = masks.astype(np.uint16) if masks.max() < 2**16 - 1 else masks.astype( np.uint32)