Skip to content

Commit

Permalink
Use ndarray for type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
cmalinmayor committed Mar 13, 2024
1 parent 05c0a8e commit d5cfc41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/motile_toolbox/utils/saving_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@

def relabel_segmentation(
solution_nx_graph: nx.DiGraph,
segmentation: np.array,
segmentation: np.ndarray,
frame_key="t",
) -> np.array:
) -> np.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.
segmentation (np.array): Original segmentation with labels ids that correspond
segmentation (np.ndarray): Original segmentation with labels ids that correspond
to segmentation id in graph.
frame_key (str, optional): Time frame key in networkx graph. Defaults to "t".
Returns:
np.array: Relabeled segmentation array where nodes in same track share same id.
np.ndarray: Relabeled segmentation array where nodes in same track share same
id.
"""
tracked_masks = np.zeros_like(segmentation)
id_counter = 1
Expand Down

0 comments on commit d5cfc41

Please sign in to comment.