Skip to content

Commit

Permalink
Add tracks for automatic tracking results
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Aug 27, 2024
1 parent 7fc593b commit 08e3e8e
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 4 deletions.
59 changes: 59 additions & 0 deletions scripts/automatic_tracks.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
,Cell_ID,Start,End,Parent_ID
0,1,0,0,0
1,2,1,6,0
2,10,1,1,1
3,3,7,14,0
4,8,7,8,2
5,4,15,15,3
6,6,15,23,3
7,19,0,4,0
8,20,5,23,19
9,22,5,23,19
10,25,0,3,0
11,26,4,23,25
12,28,4,23,25
13,30,0,1,0
14,31,2,3,30
15,33,2,3,30
16,40,0,22,0
17,41,23,23,40
18,43,23,23,40
19,44,0,3,0
20,45,4,23,44
21,47,4,23,44
22,50,0,4,0
23,51,5,13,0
24,62,5,23,50
25,52,14,15,51
26,54,14,14,0
27,55,15,16,0
28,60,15,15,54
29,56,17,22,55
30,58,17,23,55
31,63,0,5,0
32,64,6,23,63
33,66,6,23,63
34,71,0,0,0
35,72,1,23,71
36,74,1,23,71
37,76,0,8,0
38,77,9,23,76
39,79,9,23,76
40,87,0,2,0
41,88,3,23,87
42,90,3,23,87
43,96,0,14,0
44,97,15,23,96
45,99,15,23,96
46,103,0,3,0
47,104,4,23,103
48,106,4,23,103
49,111,0,12,0
50,112,13,15,111
51,114,13,23,111
52,117,2,2,0
53,118,3,3,117
54,120,3,23,117
55,125,4,13,0
56,126,14,17,125
57,128,14,23,125
19 changes: 15 additions & 4 deletions scripts/measure_for_automatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import pandas as pd
import imageio.v3 as imageio

from deepcell_tracking import isbi_utils

from traccuracy import run_metrics
from traccuracy.matchers import CTCMatcher
from traccuracy._tracking_graph import TrackingGraph
Expand Down Expand Up @@ -50,7 +48,20 @@ def _get_tracks_to_isbi():
'label': daughter_id
}

from deepcell_tracking import isbi_utils
track_df = isbi_utils.trk_to_isbi(track_info)
track_df.to_csv("automatic_tracks.csv")
return track_df


def _get_tracks_df():
tracks_path = "automatic_tracks.csv"
segmentation = imageio.imread(os.path.join(ROOT, "tracking_result.tif"))
breakpoint()
if os.path.exists(tracks_path):
track_df = pd.read_csv(tracks_path)
else:
track_df = _get_tracks_to_isbi()
return segmentation, track_df


Expand All @@ -60,7 +71,7 @@ def _get_metrics_for_autotrack(segmentation, seg_df):
gt = f['labels'][:]

gt_nodes = _get_node_attributes(gt)
gt_df = pd.read_csv(os.path.join(ROOT, "gt_tracks.csv"))
gt_df = pd.read_csv("gt_tracks.csv")
gt_G = ctc_to_graph(gt_df, gt_nodes)
_check_ctc(gt_df, gt_nodes, gt)
gt_T = TrackingGraph(gt_G, segmentation=gt, name="DynamicNuclearNet-GT")
Expand All @@ -81,7 +92,7 @@ def _get_metrics_for_autotrack(segmentation, seg_df):


def main():
segmentation, seg_df = _get_tracks_to_isbi()
segmentation, seg_df = _get_tracks_df()
_get_metrics_for_autotrack(segmentation, seg_df)


Expand Down

0 comments on commit 08e3e8e

Please sign in to comment.