forked from leogolds/MicroscopyPipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_track_viewer.py
42 lines (31 loc) · 1.42 KB
/
run_track_viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from pathlib import Path
import pandas as pd
import utils
import trackmate_utils
base_data_path = Path(r"data/fucci_60_frames")
red_stack_path = base_data_path / "red.tif"
green_stack_path = base_data_path / "green.tif"
base_model_path = Path(r"models")
red_segmentation_model = base_model_path / "cellpose/nuclei_red_v2"
green_segmentation_model = base_model_path / "cellpose/nuclei_green_v2"
red_segmentation_map = utils.read_stack(base_data_path / "red_segmented.tiff")
green_segmentation_map = utils.read_stack(base_data_path / "green_segmented.tiff")
tm_red = trackmate_utils.TrackmateXML(base_data_path / "red_segmented.tiff.xml")
tm_green = trackmate_utils.TrackmateXML(base_data_path / "green_segmented.tiff.xml")
red_stack = utils.read_stack(base_data_path / "red.tif")
green_stack = utils.read_stack(base_data_path / "green.tif")
# metric = trackmate_utils.CartesianSimilarity(tm_red, tm_green)
# metric_df = metric.calculate_metric_for_all_tracks()
# metric_df.to_hdf(base_data_path / "metric.h5", key="metric")
metric_df = pd.read_hdf(base_data_path / "metric.h5", key="metric")
metric = trackmate_utils.CartesianSimilarityFromFile(tm_red, tm_green, metric_df)
viewer = trackmate_utils.TrackViewer(
red_stack=red_stack,
green_stack=green_stack,
tm_red=tm_red,
tm_green=tm_green,
red_segmentation_map=red_segmentation_map,
green_segmentation_map=green_segmentation_map,
metric=metric,
)
viewer.view().show()