Skip to content

Commit 166abf1

Browse files
no longer remapping when reloading masks (#1029)
1 parent 0339f6e commit 166abf1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cellpose/gui/io.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ def _masks_to_gui(parent, masks, outlines=None, colors=None):
478478
# get unique values
479479
shape = masks.shape
480480
masks = masks.flatten()
481-
fastremap.renumber(masks, in_place=True)
481+
if len(fastremap.unique(masks)) != masks.max() + 1:
482+
fastremap.renumber(masks, in_place=True)
482483
masks = masks.reshape(shape)
483484
masks = masks.astype(np.uint16) if masks.max() < 2**16 - 1 else masks.astype(
484485
np.uint32)

0 commit comments

Comments
 (0)