OMERO ROIs

OMERO Python library providing utilities for handling regions of interest.

exception omero_rois.NoMaskFound(msg='No mask found')[source]

Exception thrown when no foreground pixels were found in a mask

exception omero_rois.InvalidBinaryImage(msg='Invalid labels found')[source]

Exception thrown when invalid labels are found

omero_rois.mask_from_binary_image(binim, rgba=None, z=None, c=None, t=None, text=None, raise_on_no_mask=True)[source]

Create a mask shape from a binary image (background=0)

Parameters:
  • binim (numpy.array) – Binary 2D array, must contain values [0, 1] only
  • int-4-tuple (rgba) – Optional (red, green, blue, alpha) colour
  • z – Optional Z-index for the mask
  • c – Optional C-index for the mask
  • t – Optional T-index for the mask
  • text – Optional text for the mask
  • raise_on_no_mask – If True (default) throw an exception if no mask found, otherwise return an empty Mask
Returns:

An OMERO mask

Raises:
omero_rois.masks_from_label_image(labelim, rgba=None, z=None, c=None, t=None, text=None, raise_on_no_mask=True)[source]

Create mask shapes from a label image (background=0)

Parameters:
  • labelim (numpy.array) – 2D label array
  • int-4-tuple (rgba) – Optional (red, green, blue, alpha) colour
  • z – Optional Z-index for the mask
  • c – Optional C-index for the mask
  • t – Optional T-index for the mask
  • text – Optional text for the mask
  • raise_on_no_mask – If True (default) throw an exception if no mask found, otherwise return an empty Mask
Returns:

A list of OMERO masks in label order ([] if no labels found)