aliby.tile.traps.segment_traps

segment_traps(image, tile_size, downscale=0.4, disk_radius_frac=0.01, square_size=3, min_frac_tilesize=0.3, **identify_traps_kwargs)[source]

Use an entropy filter and Otsu thresholding to find a trap template, which is then passed to identify_trap_locations.

To obtain candidate traps the major axis length of a tile must be smaller than tilesize.

The hyperparameters have not been optimised.

Parameters
image: 2D array
tile_size: integer

Size of the tile

downscale: float (optional)

Fraction by which to shrink image

disk_radius_frac: float (optional)

Radius of disk using in the entropy filter

square_size: integer (optional)

Parameter for a morphological closing applied to thresholded image

min_frac_tilesize: float (optional)
max_frac_tilesize: float (optional)

Used to determine bounds on the major axis length of regions suspected of containing traps.

identify_traps_kwargs:

Passed to identify_trap_locations

Returns
traps: an array of pairs of integers

The coordinates of the centroids of the traps.