relabel_segmentation

Functions

relabel_segmentation(→ numpy.ndarray)

Relabel a segmentation based on tracking results so that nodes in same

Module Contents

relabel_segmentation.relabel_segmentation(solution_nx_graph: networkx.DiGraph, segmentation: numpy.ndarray) numpy.ndarray

Relabel a segmentation based on tracking results so that nodes in same track share the same id. IDs do change at division.

Args:
solution_nx_graph (nx.DiGraph): Networkx graph with the solution to use

for relabeling. Nodes not in graph will be removed from seg. Original segmentation ids and hypothesis ids have to be stored in the graph so we can map them back. Assumes tracket ids have already been assigned.

segmentation (np.ndarray): Original (potentially multi-hypothesis)

segmentation with dimensions (t,h,[z],y,x), where h is 1 for single input segmentation.

Returns:
np.ndarray: Relabeled segmentation array where nodes in same track share same

id with shape (t,1,[z],y,x)