itasc.tracking_ultrack.corrections¶
Per-frame correction primitives for Ultrack solves and exports.
Functions
|
Force best predecessor and successor links around anchored tracks. |
|
Apply solve-time correction annotations to |
|
Apply anchor remap/stamp and validated paste-back to exported labels. |
Convert the legacy validated-track store to validated corrections. |
|
|
Insert missing LinkDB rows for edges incident to anchor (REAL) nodes. |
|
Insert REAL NodeDB rows for anchor corrections that had no existing candidate. |
Classes
|
|
|
|
|
|
|
|
|
|
|
- class itasc.tracking_ultrack.corrections.CorrectionDatabaseReport(fake_nodes=0, anchor_nodes=0, anchor_links=0, anchor_overlaps_pruned=0, unmatched_anchors=())[source]¶
Bases:
object- Parameters:
- unmatched_anchors: tuple[Correction, ...] = ()¶
- class itasc.tracking_ultrack.corrections.AnchorIncidentLinkReport(inserted=0, anchors_processed=0)[source]¶
Bases:
object
- class itasc.tracking_ultrack.corrections.AnchorTailLinkReport(annotated=0, skipped_no_anchor=0, skipped_no_link=0)[source]¶
Bases:
object
- class itasc.tracking_ultrack.corrections.PostSolveCorrectionReport(remapped_anchor_tracks=0, stamped_anchors=0, pasted_validated=0)[source]¶
Bases:
object
- itasc.tracking_ultrack.corrections.corrections_from_validated_tracks(validated_tracks, tracked_labels)[source]¶
Convert the legacy validated-track store to validated corrections.
- itasc.tracking_ultrack.corrections.apply_corrections_to_database(working_dir, corrections, cfg, *, annotate_anchor_links=True, tracked_labels=None)[source]¶
Apply solve-time correction annotations to
data.db.Validated frames mark nearby candidates
FAKE. Anchors mark the nearest surviving candidateREALand mark consecutive anchor linksREAL. In Ultrack 0.6.x these are hard annotations when solve usesuse_annotations=True.tracked_labelsenables IoU-based candidate matching for anchors. When provided, the mask of the anchored cell intracked_labelsis compared against NodeDB candidate masks, and the candidate with the highest IoU is chosen. This correctly identifies the intended candidate even when two hierarchical candidates (e.g. parent vs child) have nearly identical centroids. Falls back to centroid-distance matching when no IoU > 0 is found.- Return type:
- Parameters:
corrections (list[Correction])
cfg (TrackingConfig)
annotate_anchor_links (bool)
tracked_labels (ndarray | None)
- itasc.tracking_ultrack.corrections.ensure_anchor_incident_links(working_dir, cfg)[source]¶
Insert missing LinkDB rows for edges incident to anchor (REAL) nodes.
The linker keeps only the top
cfg.max_neighborssource-side edges per target. A node the user selects as an anchor after solving may have been pruned out of LinkDB entirely for some — or all — adjacent-frame candidates, leaving the solver no way to extend the track from it. This fills those gaps for anchor-incident edges, using the same per-pair weight formula as the active linker mode.- Return type:
- Parameters:
cfg (TrackingConfig)
- itasc.tracking_ultrack.corrections.annotate_anchor_tail_links(working_dir, corrections, cfg, *, tracked_labels=None)[source]¶
Force best predecessor and successor links around anchored tracks.
Consecutive anchor links constrain only the user-confirmed frames. This helper walks the best positive same-linker chain backward from the first anchor and forward from the last anchor of each cell, mirroring the greedy extender while still letting the ILP handle conflicts with other annotated cells.
- Return type:
- Parameters:
corrections (list[Correction])
cfg (TrackingConfig)
tracked_labels (ndarray | None)
- class itasc.tracking_ultrack.corrections.HomemadeAnchorInjectionReport(injected=0, skipped_no_mask=0, skipped_overflow=0)[source]¶
Bases:
object
- itasc.tracking_ultrack.corrections.inject_unmatched_anchor_nodes(working_dir, unmatched_anchors, tracked_labels, cfg)[source]¶
Insert REAL NodeDB rows for anchor corrections that had no existing candidate.
Called when
apply_corrections_to_databasefound no NodeDB node withinanchor_radius_pxfor one or more anchor corrections. This happens when the user anchors a manually-drawn cell that the segmenter never produced a candidate for. We extract the cell’s mask fromtracked_labelsand insert a synthetic NodeDB row marked REAL so the ILP is forced to include it, then add OverlapDB rows with any spatially overlapping existing nodes so the ILP cannot simultaneously select conflicting candidates.- Return type:
- Parameters:
unmatched_anchors (tuple[Correction, ...])
tracked_labels (ndarray)
cfg (TrackingConfig)
- itasc.tracking_ultrack.corrections.apply_post_solve_corrections(exported_labels, corrections, tracked_labels, cfg, *, working_dir=None)[source]¶
Apply anchor remap/stamp and validated paste-back to exported labels.
- Return type:
- Parameters:
exported_labels (ndarray)
corrections (list[Correction])
tracked_labels (ndarray)
cfg (TrackingConfig)