Segmentation plot

Functions to visualize segmentation results.

Visualize segmented instances:

Compare segmented instances with a ground truth:

bigfish.plot.plot_segmentation(image, mask, rescale=False, contrast=False, title=None, framesize=(15, 10), remove_frame=True, path_output=None, ext='png', show=True)

Plot result of a 2-d segmentation, with labelled instances if available.

Parameters:
imagenp.ndarray

A 2-d image with shape (y, x).

masknp.ndarray

A 2-d image with shape (y, x).

rescalebool, default=False

Rescale pixel values of the image (made by default in matplotlib).

contrastbool, default=False

Contrast image.

titlestr, optional

Title of the image.

framesizetuple, default=(15, 10)

Size of the frame used to plot with plt.figure(figsize=framesize).

remove_framebool, default=True

Remove axes and frame.

path_outputstr, optional

Path to save the image (without extension).

extstr or list, default=’png’

Extension used to save the plot. If it is a list of strings, the plot will be saved several times.

showbool, default=True

Show the figure or not.

bigfish.plot.plot_segmentation_boundary(image, cell_label=None, nuc_label=None, boundary_size=1, rescale=False, contrast=False, title=None, framesize=(10, 10), remove_frame=True, path_output=None, ext='png', show=True)

Plot the boundary of the segmented objects.

Parameters:
imagenp.ndarray

A 2-d image with shape (y, x).

cell_labelnp.ndarray, optional

A 2-d image with shape (y, x).

nuc_labelnp.ndarray, optional

A 2-d image with shape (y, x).

boundary_sizeint, default=1

Width of the cell and nucleus boundaries, in pixel.

rescalebool, default=False

Rescale pixel values of the image (made by default in matplotlib).

contrastbool, default=False

Contrast image.

titlestr, optional

Title of the image.

framesizetuple, default=(10, 10)

Size of the frame used to plot with plt.figure(figsize=framesize).

remove_framebool, default=True

Remove axes and frame.

path_outputstr, optional

Path to save the image (without extension).

extstr or list, default=’png’

Extension used to save the plot. If it is a list of strings, the plot will be saved several times.

showbool, default=True

Show the figure or not.

bigfish.plot.plot_segmentation_diff(image, mask_pred, mask_gt, rescale=False, contrast=False, title=None, framesize=(15, 10), remove_frame=True, path_output=None, ext='png', show=True)

Plot segmentation results along with ground truth to compare.

Parameters:
imagenp.ndarray

Image with shape (y, x).

mask_prednp.ndarray

Image with shape (y, x).

mask_gtnp.ndarray

Image with shape (y, x).

rescalebool, default=False

Rescale pixel values of the image (made by default in matplotlib).

contrastbool, default=False

Contrast image.

titlestr, optional

Title of the plot.

framesizetuple, default=(15, 10)

Size of the frame used to plot with plt.figure(figsize=framesize).

remove_framebool, default=True

Remove axes and frame.

path_outputstr, optional

Path to save the image (without extension).

extstr or list, default=’png’

Extension used to save the plot. If it is a list of strings, the plot will be saved several times.

showbool, default=True

Show the figure or not.