Skip to content

[BUG] Mask values exceed 65535 when metric_intersection_over_union() #1378

@Chenchao-is-CC

Description

@Chenchao-is-CC

Before you fill out this form:

Did you review the FAQ?

Did you look through previous (open AND closed) issues posted on GH?


Describe the bug

When running 3D stitching on a large image stack (1682, 2693, 2482), the combined mask values in metrics_intersection_over_union() exceed uint16 (65535), causing integer overflow. Currently, the stitched mask array is initialized as uint16, which cannot accommodate large label counts.


Expected behavior

It would be helpful if Cellpose could automatically determine an appropriate dtype for stitched masks, promoting to int32 (or larger) when necessary, to prevent overflow. I would be very grateful if you could fix this bug.


Screenshots

Image

Additional context

Automatic dtype promotion would prevent overflow issues in large 3D datasets and simplify downstream analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions