[FEATURE] check the number of labels after filtering out labels fewer than min_size
Is your feature request related to a problem? Please describe.
I applied the cellpose on one tif stack containing many cells. The saved tif image is in 32-bit format, which indicating there are more than 65,535 labels. However, I checked the labels and found that the maximal label is about 64,000. I think it was related to the step of filtering out labels fewer than min_size. In my case, there are probably more than 2^16 -1 labels before removing and fewer than 2^16-1 labels after filtering. Thus, I think the related code can be improved.
Describe the solution you'd like
After filtering out the labels with size fewer than min_size (https://github.com/MouseLand/cellpose/blob/main/cellpose/dynamics.py#L619), check the number of total labels remained and if the number is fewer than 2^16, store the mask in 16-bit format.