derotation.analysis.blob_detection#

This module contains the BlobDetection class, which is used to detect the largest blob in each image of an image stack. The class uses the blob_log function from the skimage.feature module to detect the blobs. The coordinates of the largest blob in each image are returned as a numpy array. The class also has a method to plot the first 4 blobs in each image, which is useful for debugging purposes.

Classes

BlobDetection([debugging_plots, ...])

The BlobDetection class is used to detect the largest blob in each image of an image stack.

class derotation.analysis.blob_detection.BlobDetection(debugging_plots=False, debug_plots_folder=PosixPath('debug'), blob_log_params={'max_sigma': 12, 'min_sigma': 7, 'overlap': 0, 'threshold': 0.95})[source]#

The BlobDetection class is used to detect the largest blob in each image of an image stack.

Parameters:
  • debugging_plots (bool, optional) – Whether to create debugging plots, by default False

  • debug_plots_folder (Path, optional) – The folder to save the debugging plots, by default None

  • blob_log_params (dict, optional) – The parameters for the blob detection, by default {“max_sigma”: 12, “min_sigma”: 7, “threshold”: 0.95, “overlap”: 0} which are the parameters that worked best for the 3-photon data.

Methods

get_coords_of_largest_blob(image_stack)

Get the coordinates of the largest blob in each image.

plot_blob_detection(blobs, image_stack)

Plot the first 4 blobs in each image.

get_coords_of_largest_blob(image_stack)[source]#

Get the coordinates of the largest blob in each image.

Parameters:

image_stack (np.ndarray) – The image stack.

Returns:

The coordinates of the largest blob in each image.

Return type:

np.ndarray

plot_blob_detection(blobs, image_stack)[source]#

Plot the first 4 blobs in each image. This is useful to check if the blob detection is working correctly and to see if the identity of the largest blob is consistent across the images.

Parameters:
  • blobs (list) – The list of blobs in each image.

  • image_stack (np.ndarray) – The image stack.