Skip to content

Commit

Permalink
Fix issue with dtypes that leads to integer overflow in committing (#671
Browse files Browse the repository at this point in the history
)
  • Loading branch information
constantinpape authored Jul 26, 2024
1 parent 3bd8265 commit 1d33862
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion micro_sam/sam_annotator/_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def _commit_impl(viewer, layer, preserve_committed):
z_min, z_max = state.z_range
bb = np.s_[z_min:(z_max+1)]

seg = viewer.layers[layer].data[bb]
# Cast the dtype of the segmentation we work with correctly.
# Otherwise we run into type conversion errors later.
dtype = viewer.layers["committed_objects"].data.dtype
seg = viewer.layers[layer].data[bb].astype(dtype)
shape = seg.shape

# We parallelize these operatios because they take quite long for large volumes.
Expand Down

0 comments on commit 1d33862

Please sign in to comment.