I’m using Cellpose to segment images from Omero using a variation of this script. It works as intended on nearly all of our images, but occasionally throws an error.
---------------------------------------------------------------------------
NoMaskFound Traceback (most recent call last)
<ipython-input-42-5237eedf1c65> in <module>
37 # create segmentation roi
38 updateService = conn.getUpdateService()
---> 39 msks = omero_rois.masks_from_label_image(masks)
40 create_roi(image,msks)
41 else:
~\Anaconda3\envs\omero\lib\site-packages\omero_rois\library.py in masks_from_label_image(labelim, rgba, z, c, t, text, raise_on_no_mask)
132 for i in range(1, labelim.max() + 1):
133 mask = mask_from_binary_image(labelim == i, rgba, z, c, t, text,
--> 134 raise_on_no_mask)
135 masks.append(mask)
136 return masks
~\Anaconda3\envs\omero\lib\site-packages\omero_rois\library.py in mask_from_binary_image(binim, rgba, z, c, t, text, raise_on_no_mask)
79 else:
80 if raise_on_no_mask:
---> 81 raise NoMaskFound()
82 x0 = 0
83 w = 0
NoMaskFound: No mask found
I can’t figure out why it’s saying no mask found. The error can be reproduced by calling
badMask = np.load ('4359_mask.npy')
goodMask = np.load ('4360_mask.npy')
for mask in [goodMask,badMask]:
msks = omero_rois.masks_from_label_image(mask)
I have included the masks here masks.zip (668.8 KB)