bin2cell.view_labels

bin2cell.view_labels(image_path, labels_npz_path, crop=None, stardist_normalize=False, fill=False, border=True, fill_palette=None, fill_label_weight=0.5, border_color=[255, 255, 0])

Render segmentation results in a lightweight manner on a full image level. Can do fills or borders. Returns image as np.array.

Input

image_pathfilepath

Path to image that was segmented.

labels_npz_pathfilepath

Path to sparse labels generated by b2c.stardist().

cropNone or tuple of int, optional (default: None)

A PIL-formatted crop specification - a four integer tuple, provided as (left, upper, right, lower) coordinates. If None, will render full segmentation results.

stardist_normalizebool, optional (default: False)

If True, percentile normalise the input image prior to rendering the segmentation labels on it.

fillbool, optional (default: False)

If True, render the objects in full, with transparency controlled by fill_label_weight.

borderbool, optional (default, True)

If True, render a fully opaque border of a specified colour around the objects

fill_paletteNone or np.array of np.uint8, optional (default: None)

Two-dimensional np.array, with rows corresponding to colours of the palette and columns corresponding to RGB, in np.uint8. If None, will use Seaborn’s bright palette, skipping the pink due to it rendering poorly against H&E images. Objects will be coloured based on the remainder of dividing its label ID by the number of colours.

fill_label_weightfloat, optional (default: 0.5)

Weight to assign the object fill render when constructing output. 0 is completely transparent, 1 is completely opaque.

border_colorlist of np.uint8, optional (default: [255, 255, 0])

Border colour in RGB.