@@ -8,10 +8,14 @@ def get_ids_that_ends_with_split(
8
8
Extracts the ids of tracks that end with a cell split.
9
9
10
10
Args:
11
- tracks: The tracks to check.
11
+ tracks: The tracks to check. A numpy nd array with columns:
12
+ - label
13
+ - birth frame
14
+ - end frame
15
+ - parent
12
16
13
17
Returns:
14
- The ids of tracks that end with a cell split.
18
+ The ids of tracks that end with a cell split stored in a numpy.ndarray .
15
19
"""
16
20
parents , counts = np .unique (tracks [:, 3 ], return_counts = True )
17
21
counts = counts [parents > 0 ]
@@ -43,8 +47,8 @@ def calculate_f1_score(
43
47
44
48
45
49
def is_matching (
46
- comp : int ,
47
- ref : int ,
50
+ id_comp : int ,
51
+ id_ref : int ,
48
52
mapped_ref : list ,
49
53
mapped_comp : list ,
50
54
ref_children : np .ndarray ,
@@ -56,14 +60,14 @@ def is_matching(
56
60
Checks if the reference and the computed track match.
57
61
58
62
Args:
59
- comp : The computed track id.
60
- ref : The reference track id.
63
+ id_comp : The computed track id.
64
+ id_ref : The reference track id.
61
65
mapped_ref: The matched labels of the ground truth masks.
62
66
mapped_comp: The matched labels of the result masks.
63
67
ref_children: The children ids of the reference track.
64
68
comp_children: The children ids of the computed track.
65
- tr: The reference track end.
66
- tc: The computed track end.
69
+ tr: The frame of the reference track end.
70
+ tc: The frame of the computed track end.
67
71
68
72
Returns:
69
73
True if the reference and the computed track match, False otherwise.
@@ -74,10 +78,10 @@ def is_matching(
74
78
# Compare parents
75
79
t1 , t2 = min (tr , tc ), max (tr , tc )
76
80
mr , mc = mapped_ref [t1 ], mapped_comp [t1 ]
77
- if np .sum (mc == comp ) < 1 or np .sum (mr == ref ) != 1 :
81
+ if np .sum (mc == id_comp ) < 1 or np .sum (mr == id_ref ) != 1 :
78
82
return False
79
- ind = np .argwhere (mr == ref ).squeeze ()
80
- if mc [ind ] != comp :
83
+ ind = np .argwhere (mr == id_ref ).squeeze ()
84
+ if mc [ind ] != id_comp :
81
85
return False
82
86
# Compare children
83
87
mr , mc = np .asarray (mapped_ref [t2 + 1 ]), np .asarray (mapped_comp [t2 + 1 ])
@@ -101,10 +105,26 @@ def bc(
101
105
- Vladimir Ulman et al., Nature methods 2017
102
106
103
107
Args:
104
- comp_tracks: The result tracks.
105
- ref_tracks: The ground truth tracks.
106
- mapped_ref: The matched labels of the ground truth masks.
107
- mapped_comp: The matched labels of the result masks.
108
+ comp_tracks: The result tracks. A (n,4) numpy ndarray with columns:
109
+ - label
110
+ - birth frame
111
+ - end frame
112
+ - parent
113
+ ref_tracks: The ground truth tracks. A (n,4) numpy ndarray with columns:
114
+ - label
115
+ - birth frame
116
+ - end frame
117
+ - parent
118
+ mapped_ref: The matched labels of the ground truth masks. A list of
119
+ length equal to the number of frames. Each element is a list with
120
+ the matched labels of the ground truth masks in the respective
121
+ frame. The elements are in the same order as the corresponding
122
+ elements in mapped_comp.
123
+ mapped_comp: The matched labels of the result masks. A list of length
124
+ equal to the number of frames. Each element is a list with the
125
+ matched labels of the result masks in the respective frame. The
126
+ elements are in the same order as the corresponding elements in
127
+ mapped_ref.
108
128
i: The maximal allowed error in frames.
109
129
110
130
Returns:
0 commit comments