Skip to content

Commit 5e519fa

Browse files
committed
biological/bc.py is_matching() uses max_i also checking distance of mothers,...
...cosmetic fixes in the function's documentation, t_start variable renamed to t_last_common (when finding the last common timepoint of both dividing mother tracks)
1 parent 0287ea3 commit 5e519fa

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • ctc_metrics/metrics/biological

ctc_metrics/metrics/biological/bc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ def is_matching(
7373
t_parent_end_comp: The frame of the computed track end.
7474
t_child_start_ref: The frame of the reference track start.
7575
t_child_start_comp: The frame of the computed track start.
76-
max_i: The maximal time gap between starts of the reference and computed daughter tracks.
76+
max_i: The maximal time gap between ends of the reference and
77+
computed mother tracks, and beginnings of daughter tracks.
7778
Returns:
7879
True if the reference and the computed track match, False otherwise.
7980
"""
8081
# Check if the number of children is the same
8182
if len(ref_children) != len(comp_children):
8283
return False
83-
# Compare parents
84-
t_start = min(t_parent_end_ref, t_parent_end_comp)
85-
mr, mc = mapped_ref[t_start], mapped_comp[t_start]
84+
# Compare parents, for temporal distance and then for spatial overlap
85+
if abs(t_parent_end_ref - t_parent_end_comp) > max_i:
86+
return False
87+
t_last_common = min(t_parent_end_ref, t_parent_end_comp)
88+
mr, mc = mapped_ref[t_last_common], mapped_comp[t_last_common]
8689
if np.sum(mc == id_comp) < 1 or np.sum(mr == id_ref) != 1:
8790
return False
8891
ind = np.argwhere(mr == id_ref).squeeze()

0 commit comments

Comments
 (0)