Skip to content

Commit 65f41f1

Browse files
committed
...
1 parent 33b34ae commit 65f41f1

File tree

7 files changed

+273
-41
lines changed

7 files changed

+273
-41
lines changed

ctc_metrics/metrics/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@
66
from ctc_metrics.metrics.technical.seg import seg
77
from ctc_metrics.metrics.technical.tra import tra
88
from ctc_metrics.metrics.technical.det import det
9+
from ctc_metrics.metrics.technical.op_ctb import op_ctb
10+
from ctc_metrics.metrics.technical.op_csb import op_csb
11+
from ctc_metrics.metrics.biological.bio import bio
12+
from ctc_metrics.metrics.biological.op_clb import op_clb
13+
from ctc_metrics.metrics.technical.lnk import lnk
14+
15+
ALL_METRICS = [
16+
"Valid", "BC", "CT", "CCA", "TF", "SEG", "TRA", "DET", "LNK", "OP_CTB",
17+
"OP_CSB", "BIO", "OP_CLB"
18+
]

ctc_metrics/metrics/biological/bio.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
def bio(
3+
ct: float,
4+
tf: float,
5+
bc: float,
6+
cca: float,
7+
):
8+
"""
9+
Computes the BIO. As described by
10+
[celltrackingchallenge](http://celltrackingchallenge.net/).
11+
12+
Args:
13+
ct: The complete tracking metric.
14+
tf: The track fractions metric.
15+
bc: The branching correctness metric.
16+
cca: The cell cycle accuracy metric.
17+
18+
Returns:
19+
The bio metric.
20+
"""
21+
total_metrics = 0
22+
if ct is not None:
23+
total_metrics += 1
24+
else:
25+
ct = 0
26+
if tf is not None:
27+
total_metrics += 1
28+
else:
29+
tf = 0
30+
if bc is not None:
31+
total_metrics += 1
32+
else:
33+
bc = 0
34+
if cca is not None:
35+
total_metrics += 1
36+
else:
37+
cca = 0
38+
bio = (ct + tf + bc + cca) / total_metrics
39+
return bio
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
def op_clb(
3+
lnk: float,
4+
bio: float,
5+
):
6+
"""
7+
Computes the OP_CLB metric. As described by
8+
[celltrackingchallenge](http://celltrackingchallenge.net/).
9+
10+
Args:
11+
lnk: The linking metric.
12+
bio: The biological metric.
13+
14+
Returns:
15+
The OP_CLB metric.
16+
"""
17+
18+
op = 0.5 * lnk + 0.5 * bio
19+
return op

ctc_metrics/metrics/technical/lnk.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
def lnk(
3+
ED: int,
4+
EA: int,
5+
EC: int,
6+
num_edges: int,
7+
**_ignored
8+
):
9+
"""
10+
Calculate Linking (LNK) metric.
11+
12+
According to
13+
Cell Tracking Accuracy Measurement Based on Comparison of Acyclic
14+
Oriented Graphs; Matula etal. 2015
15+
16+
Args:
17+
ED: Number of redundant edge.
18+
EA: Number of missing edges.
19+
EC: Number of wrong edge semantics.
20+
num_edges: Number of edges in the graph.
21+
_ignored: Ignored arguments.
22+
23+
Returns:
24+
The Linking metric.
25+
"""
26+
# Calculate AOGM_A
27+
w_ed = 1
28+
w_ea = 1.5
29+
w_ec = 1
30+
AOGM_A = w_ed * ED + w_ea * EA + w_ec * EC
31+
# Calculate AOGM_0 (create graph from scratch)
32+
# i.e, all vertices and edges are false negatives
33+
AOGM_0 = w_ea * num_edges
34+
# Calculate DET
35+
LNK = 1 - min(AOGM_A, AOGM_0) / AOGM_0
36+
return float(LNK)
37+
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
def op_csb(
3+
seg: float,
4+
det: float,
5+
):
6+
"""
7+
Computes the OP_CSB metric. As described by
8+
[celltrackingchallenge](http://celltrackingchallenge.net/).
9+
10+
Args:
11+
seg: The segmentation metric.
12+
det: The detection metric.
13+
14+
Returns:
15+
The OP_CSB metric.
16+
"""
17+
18+
op = 0.5 * seg + 0.5 * det
19+
return op
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
def op_ctb(
3+
seg: float,
4+
tra: float,
5+
):
6+
"""
7+
Computes the OP_CTB metric. As described by
8+
[celltrackingchallenge](http://celltrackingchallenge.net/).
9+
10+
Args:
11+
seg: The segmentation metric.
12+
tra: The tracking metric.
13+
14+
Returns:
15+
The OP_CTB metric.
16+
"""
17+
18+
op = 0.5 * seg + 0.5 * tra
19+
return op

0 commit comments

Comments
 (0)