Skip to content

Commit

Permalink
no longer remapping when reloading masks (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Oct 25, 2024
1 parent 0339f6e commit 166abf1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cellpose/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 166abf1

Please sign in to comment.