tree_widget_utils

Functions

extract_sorted_tracks(→ pandas.DataFrame | None)

Extract the information of individual tracks required for constructing the pyqtgraph plot. Follows the same logic as the relabel_segmentation

sort_track_ids(→ List[Dict])

Sort track IDs such to maintain left-first order in the tree formed by parent-child relationships.

extract_lineage_tree(→ List[str])

Extract the entire lineage tree including horizontal relations for a given node

Module Contents

tree_widget_utils.extract_sorted_tracks(tracks: motile_plugin.core.Tracks, colormap: napari.utils.CyclicLabelColormap) pandas.DataFrame | None

Extract the information of individual tracks required for constructing the pyqtgraph plot. Follows the same logic as the relabel_segmentation function from the Motile toolbox.

Args:
tracks (motile_plugin.core.Tracks): A tracks object containing a graph

to be converted into a dataframe.

colormap (napari.utils.CyclicLabelColormap): The colormap to use to

extract the color of each node from the track ID

Returns:

pd.DataFrame | None: data frame with all the information needed to construct the pyqtgraph plot. Columns are: ‘t’, ‘node_id’, ‘track_id’, ‘color’, ‘x’, ‘y’, (‘z’), ‘index’, ‘parent_id’, ‘parent_track_id’, ‘state’, ‘symbol’, and ‘x_axis_pos’

tree_widget_utils.sort_track_ids(track_list: List[Dict]) List[Dict]

Sort track IDs such to maintain left-first order in the tree formed by parent-child relationships. Used to determine the x-axis order of the tree plot.

Args:

track_list (list): List of dictionaries with ‘track_id’ and ‘parent_track_id’.

Returns:

list: Ordered list of track IDs for the x-axis.

tree_widget_utils.extract_lineage_tree(graph: networkx.DiGraph, node_id: str) List[str]

Extract the entire lineage tree including horizontal relations for a given node