Detection plot

Functions to visualize detection results.

Visualize detected spots:

Visualize the reference spot computed for an image:

Visualize the elbow curve used to automatically set a detection threshold:

bigfish.plot.plot_detection(image, spots, shape='circle', radius=3, color='red', linewidth=1, fill=False, rescale=False, contrast=False, title=None, framesize=(15, 10), remove_frame=True, path_output=None, ext='png', show=True)

Plot detected spots and foci on a 2-d image.

Parameters:
imagenp.ndarray

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

spotslist or np.ndarray

Array with coordinates and shape (nb_spots, 3) or (nb_spots, 2). To plot different kind of detected spots with different symbols, use a list of arrays.

shapelist or str, default=’circle’

List of symbols used to localized the detected spots in the image, among circle, square or polygon. One symbol per array in spots. If shape is a string, the same symbol is used for every elements of ‘spots’.

radiuslist or int or float, default=3

List of yx radii of the detected spots, in pixel. One radius per array in spots. If radius is a scalar, the same value is applied for every elements of spots.

colorlist or str, default=’red’

List of colors of the detected spots. One color per array in spots. If color is a string, the same color is applied for every elements of spots.

linewidthlist or int, default=1

List of widths or width of the border symbol. One integer per array in spots. If linewidth is an integer, the same width is applied for every elements of spots.

filllist or bool, default=False

List of boolean to fill the symbol of the detected spots. If fill is a boolean, it is applied for every symbols.

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_reference_spot(reference_spot, rescale=False, contrast=False, title=None, framesize=(5, 5), remove_frame=True, path_output=None, ext='png', show=True)

Plot the selected yx plan of the selected dimensions of an image.

Parameters:
reference_spotnp.ndarray

Spot image with shape (z, y, x) or (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=(5, 5)

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_elbow(images, voxel_size=None, spot_radius=None, log_kernel_size=None, minimum_distance=None, title=None, framesize=(5, 5), size_title=20, size_axes=15, size_legend=15, path_output=None, ext='png', show=True)

Plot the elbow curve that allows an automated spot detection.

Parameters:
imageslist

List of ndarrays with shape (z, y, x) or (y, x). The same threshold is applied to every images.

voxel_sizeint or float or tuple or list, optional

Size of a voxel, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same value is applied to every dimensions. Not used if ‘log_kernel_size’ and ‘minimum_distance’ are provided.

spot_radiusint or float or tuple or list, optional

Radius of the spot, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same radius is applied to every dimensions. Not used if ‘log_kernel_size’ and ‘minimum_distance’ are provided.

log_kernel_sizeint or float or tuple or list, optional

Size of the LoG kernel. It equals the standard deviation (in pixels) used for the gaussian kernel (one for each dimension). One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same standard deviation is applied to every dimensions. If None, we estimate it with the voxel size and spot radius.

minimum_distanceint or float or tuple or list, optional

Minimum distance (in pixels) between two spots we want to be able to detect separately. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same distance is applied to every dimensions. If None, we estimate it with the voxel size and spot radius.

titlestr, optional

Title of the plot.

framesizetuple, default=(5, 5)

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

size_titleint, default=20

Size of the title.

size_axesint, default=15

Size of the axes label.

size_legendint, default=15

Size of the legend.

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_elbow_colocalized(spots_1, spots_2, voxel_size, threshold_max=None, title=None, framesize=(5, 5), size_title=20, size_axes=15, size_legend=15, path_output=None, ext='png', show=True)

Plot the elbow curve that allows an automated colocalized spot detection.

Parameters:
spots_1np.ndarray

Coordinates of the spots with shape (nb_spots, 3) or (nb_spots, 2).

spots_2np.ndarray

Coordinates of the spots with shape (nb_spots, 3) or (nb_spots, 2).

voxel_sizeint or float or tuple or list

Size of a voxel, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same value is applied to every dimensions.

threshold_maxint or float, optional

Maximum threshold value to consider.

titlestr, optional

Title of the plot.

framesizetuple, default=(5, 5)

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

size_titleint, default=20

Size of the title.

size_axesint, default=15

Size of the axes label.

size_legendint, default=15

Size of the legend.

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

Show the figure or not.