itasc.contact_analysis.dynamics.trajectories

Tracked label stack → per-track centroid trajectories (µm), gaps preserved.

The shared front end of every dynamics calculation. Runs skimage.measure.regionprops() over each frame of a tracked label stack (label == track_id, constant across frames — the same per-frame loop the shape core uses) and groups centroids into one trajectory per track id. Frames where a track’s label is absent are simply missing from its series, so a Trajectory carries an explicit frames array and downstream code can detect gaps (diff(frames) > 1).

Centroids are returned in µm ((x, y) = (col, row) · pixel_size_um); x is the column axis and y the row axis, matching the shape core’s centroid_x_um / centroid_y_um. Backend-only (no Qt / napari).

Functions

extract_trajectories(label_path, *, ...[, ...])

Read a tracked label TIFF and return one Trajectory per track id.

trajectories_from_stack(label_stack, *, ...)

extract_trajectories() over an in-memory T×Y×X label stack.

Classes

Trajectory(track_id, frames, xy)

One track's centroid path in µm, in frame order.

class itasc.contact_analysis.dynamics.trajectories.Trajectory(track_id, frames, xy)[source]

Bases: object

One track’s centroid path in µm, in frame order.

frames is strictly increasing (one entry per frame the track is present); xy is the matching (N, 2) array of (x_um, y_um) centroids. A jump of more than 1 between consecutive frames is a gap.

Parameters:
track_id: int
frames: ndarray
xy: ndarray
property n_frames: int
property n_gaps: int
itasc.contact_analysis.dynamics.trajectories.extract_trajectories(label_path, *, pixel_size_um, progress_cb=None)[source]

Read a tracked label TIFF and return one Trajectory per track id.

Centroids come from regionprops(frame).centroid (row, col) scaled by pixel_size_um into (x_um, y_um). Trajectories are sorted by track id; each is internally sorted by frame.

Return type:

list[Trajectory]

Parameters:
itasc.contact_analysis.dynamics.trajectories.trajectories_from_stack(label_stack, *, pixel_size_um, progress_cb=None)[source]

extract_trajectories() over an in-memory T×Y×X label stack.

Return type:

list[Trajectory]

Parameters: