get_depth_map#

get_depth_map(array: ndarray, neighbors_map: dict) dict[source]#

Get map of id to depth starting from depth = 1 at the edge if the region.

All ids at the edge of the array are assigned a depth of 1. Immediate neighbors of those edges are assigned a depth of 2, and so on, until all ids have an assigned depth.

Parameters:
  • array – Segmentation array.

  • neighbors_map – Map of ids to lists of neighbors.

Returns:

Map of id to depth from edge.

find_edge_ids(array: ndarray) list[int][source]#

Get ids of regions closest to the edge of the array.

Parameters:

array – Segmentation array.

Returns:

List of edge arrays.