distance

Author: Chris Dijkstra Date: 11-11-2024

Functions for creating distance maps of masked images where each pixel gets assigned a value based on their proximity to the nearest seed.

lettuceSee.distance.coord_dist_map(mask, seed_coords)

Creates a distance map from seeds given as coordinates, bound by a mask

Parameters:
  • mask (ndarray) – The binary mask that gives the boundaries of the distance map

  • seed_coords (list[tuple[int, int]]) – The list of coordinates

Return type:

ndarray

Returns:

A distance map

lettuceSee.distance.im_dist_map(mask, seed_map)

Creates a distance map from seeds derived from an input image, bound by a mask

Parameters:
  • mask (ndarray) – The binary mask that gives the boundaries of the distance map

  • seed_map (ndarray[bool]) – Binary image containing the seeds as 1 or True

Return type:

ndarray

Returns:

A distance map

lettuceSee.distance.centre_seed_dist(flip_mask, non_flip_mask, seed_map)

Creates a dist map from a line bisecting a mask and transforms it into a continuous distance map

Parameters:
  • flip_mask (ndarray[bool]) – Mask of the area of the distance map that will be flipped. The pixel that is furthest from the bisecting line in seed_map will be 0 in the output map

  • non_flip_mask (ndarray[bool]) – Mask of the area of the distance map that will not be flipped

  • seed_map (ndarray[bool]) – The seed map containing the line that bisects the mask into flip_mask and non_flip_mask, should have overlap with both flip_mask and non_flip_mask

Return type:

ndarray

Returns:

A distance map