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 have to be stored in the graph so we can map them back. Assumes tracklet ids have already been assigned.

segmentation (np.ndarray): Original segmentation with dimensions (t,z],y,x)

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

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