acia.tracking#

Tracking module contains all tools to work with tracking formats

acia.tracking.annotate_tracklet_times(tracklet_graph, timepoints)[source]#

Stamp real start_time/end_time onto every tracklet node in place.

A tracklet node carries integer start_frame/end_frame (see acia.tracking.formats.read_ctc_tracklet_graph()); this maps those frame indices through per-frame timepoints to real timestamps, storing the float magnitudes (in timepoints’ own unit) as start_time/ end_time and recording that unit in tracklet_graph.graph["time_unit"]. Downstream (acia.viz.plot_tracklet_lineage()) then lays the lineage out on a real-time axis without the caller re-supplying any time.

Parameters:
  • tracklet_graph (DiGraph) – one node per tracklet with start_frame/end_frame.

  • timepoints – per-frame pint Quantity (e.g. source.timepoints); None is a no-op (the graph keeps frame-only nodes).

Returns:

The same tracklet_graph, mutated in place.

Return type:

DiGraph

class acia.tracking.TrackingSource[source]#

Bases: object

Base class for tracking information containing segmentation overlay and tracking graph (usually ids of overlay contours)

property overlay: Overlay#
property tracking_graph: DiGraph#
copy()[source]#
Return type:

TrackingSource

class acia.tracking.TrackingSourceInMemory[source]#

Bases: TrackingSource

Tracking Source stored in memory

__init__(overlay, tracking_graph)[source]#
Parameters:
property overlay: Overlay#
property tracking_graph: DiGraph#
copy()[source]#
Return type:

TrackingSourceInMemory

merge(tr_source)[source]#
Parameters:

tr_source (TrackingSource)

class acia.tracking.SimpleTrackingSource[source]#

Bases: TrackingSourceInMemory

Tracking Source based on simple tracking json format

__init__(file_content)[source]#
Parameters:

file_content (str)

static from_file(file_path)[source]#

Loads segmentation and tracking from simple tracking json format

Parameters:

file_path (Path) – path to the simple tracking file

Returns:

SimpleTrackingSource – the loaded simple tracking file

Return type:

SimpleTrackingSource

store(file_path)[source]#

Saves simple tracking json format

Parameters:

file_path (Path) – file name to save

acia.tracking.subsample_tracking(tracking, subsampling_factor)[source]#

Subsample the tracking source

Parameters:
  • tracking (TrackingSource) – tracking source to subsample

  • subsampling_factor (int) – subsampling factor defining the step of frames. 1 means no subsampling. 2 means every second frame, …

Raises:

ValueError – when wrong subsampling factor is chosen

Returns:

TrackingSource – subsampled tracking source

Return type:

TrackingSource

acia.tracking.ctc_track_graph(ov, tracklet_graph)[source]#

Computes the ctc track graph (every cell detection is a node) based on cell detections (overlay) and the tracklet graph (every tracklet is one node).

Hint: overlay labels and tracklet_graph node ids need to align.

Parameters:
  • ov (Overlay) – _description_

  • tracklet_graph (nx.DiGraph) – _description_

Returns:

_type_ – _description_