traccuracy.utils
Module Contents
Functions
|
Get path |
Returns copies of graphs with divisions corrected. |
|
|
Export annotated tracking graphs as geffs along with a summary of traccuracy results |
|
Save a list of results to a traccuracy export json |
- traccuracy.utils.get_equivalent_skip_edge(skip_other_matched: traccuracy.matchers._matched.Matched, skip_src: collections.abc.Hashable, skip_dst: collections.abc.Hashable, matched_src: collections.abc.Hashable, matched_dst: collections.abc.Hashable) list[collections.abc.Hashable][source]
Get path
matched_src ->...-> matched_dstequivalent toskip_src -> skip_dst.A skip edge
skip_src -> skip_dstis equivalent to a path connectingmatched_srcandmatched_dstif:skip_srcis a valid match formatched_src,skip_dstis a valid match formatched_dst,matched_srcis an ancestor ofmatched_dst(regardless of intervening nodes) AND- all nodes on the path
matched_src ->...-> matched_dsthave no valid matches in skip_other_matched.
- all nodes on the path
- Parameters:
skip_other_matched (traccuracy.matchers._base.Matched) – Matched object mapping skip nodes to other nodes
skip_src (Hashable) – ID of source node of skip edge
skip_dst (Hashable) – ID of destination node of skip edge
matched_src (Hashable) – matched node of skip_src
matched_dst (Hashable) – matched node of skip_dst
- Returns:
path from matched_src to matched_dst, or empty list if no such path.
- Return type:
list[Hashable]
- traccuracy.utils.get_corrected_division_graphs_with_delta(matched: traccuracy.matchers._matched.Matched, frame_buffer: int = 0, relax_skip_edges: bool = False) tuple[traccuracy._tracking_graph.TrackingGraph, traccuracy._tracking_graph.TrackingGraph][source]
Returns copies of graphs with divisions corrected.
All divisions corrected by a frame_buffer value less than or equal to the given frame buffer are marked as
TP_DIV.- Parameters:
matched (traccuracy.matchers._base.Matched) – Matched object for set of GT and Pred data. Must be annotated with division events.
frame_buffer (int) – Maximum frame buffer to use for division correction
relax_skip_edges (bool) – If True, will allow divisions that incorporate skip edges from parent to daughter
- Returns:
- Tuple of corrected
GT and Pred graphs
- Return type:
- traccuracy.utils.export_graphs_to_geff(out_zarr: str, matched: traccuracy.matchers._matched.Matched, results: list[traccuracy.metrics._results.Results] | list[dict[str, Any]], target_frame_buffer: int = 0) None[source]
Export annotated tracking graphs as geffs along with a summary of traccuracy results
Output file structure: out_zarr.zarr/ ├── gt.geff ├── pred.geff └── traccuracy-results.json
- Parameters:
out_zarr (str) – Path to output zarr
matched (traccuracy.matchers._base.Matched) – Matched object containing annotated TrackingGraphs
results (list[traccuracy.metrics._results.Results] | list[dict[str, Any]) – List of Results output by Metric.compute OR results objects as dictionary as returned by
run_metricstarget_frame_buffer (int, optional) – If divisions are annotated, target_frame_buffer can be used to run
get_corrected_divisions_with_deltain order to provide division annotations for a specific frame buffer. Defaults to 0.
- Raises:
ValueError – matched argument must be an instance of
MatchedValueError – results argument must be a list of Results or dictionary objects
ValueError – Zarr already exists at out_zarr
ValueError – Requested target frame buffer {target_frame_buffer} exceeds computed ” “frame buffer {max_frame_buffer}
- traccuracy.utils.save_results_json(results: list[traccuracy.metrics._results.Results] | list[dict[str, Any]], out_path: str) None[source]
Save a list of results to a traccuracy export json
- Parameters:
results (list[traccuracy.metrics._results.Results] | list[dict[str, Any]) – List of either results dictionaries or results objects
out_path (str) – Path to save json file
- Raises:
ValueError – out_path already exists
ValueError – results argument must be a list of Results objects or dictionaries
ValueError – results argument must be a list