fucciphase 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fucciphase/__init__.py +7 -1
- fucciphase/__main__.py +12 -0
- fucciphase/fucci_phase.py +123 -53
- fucciphase/io.py +18 -17
- fucciphase/main_cli.py +151 -34
- fucciphase/napari/tracks_to_napari.py +20 -21
- fucciphase/phase.py +350 -137
- fucciphase/plot.py +240 -88
- fucciphase/sensor.py +47 -33
- fucciphase/tracking_utilities.py +70 -9
- fucciphase/utils/__init__.py +14 -1
- fucciphase/utils/checks.py +2 -5
- fucciphase/utils/dtw.py +2 -4
- fucciphase/utils/normalize.py +46 -12
- fucciphase/utils/phase_fit.py +11 -7
- fucciphase/utils/simulator.py +1 -1
- fucciphase/utils/track_postprocessing.py +16 -11
- fucciphase/utils/trackmate.py +30 -13
- fucciphase-0.0.4.dist-info/METADATA +238 -0
- fucciphase-0.0.4.dist-info/RECORD +25 -0
- {fucciphase-0.0.2.dist-info → fucciphase-0.0.4.dist-info}/WHEEL +1 -1
- fucciphase-0.0.2.dist-info/METADATA +0 -137
- fucciphase-0.0.2.dist-info/RECORD +0 -24
- {fucciphase-0.0.2.dist-info → fucciphase-0.0.4.dist-info}/entry_points.txt +0 -0
- {fucciphase-0.0.2.dist-info → fucciphase-0.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
|
|
3
1
|
import numpy as np
|
|
4
2
|
import pandas as pd
|
|
5
3
|
|
|
@@ -15,18 +13,18 @@ def add_trackmate_data_to_viewer(
|
|
|
15
13
|
df: pd.DataFrame,
|
|
16
14
|
viewer: napari.Viewer,
|
|
17
15
|
scale: tuple,
|
|
18
|
-
image_data:
|
|
19
|
-
colormaps:
|
|
20
|
-
labels:
|
|
21
|
-
cycle_percentage_id:
|
|
16
|
+
image_data: list[np.ndarray],
|
|
17
|
+
colormaps: list[str],
|
|
18
|
+
labels: np.ndarray | None,
|
|
19
|
+
cycle_percentage_id: str | None = "CELL_CYCLE_PERC_POST",
|
|
22
20
|
dim: int = 2,
|
|
23
|
-
textkwargs:
|
|
24
|
-
label_id_name:
|
|
25
|
-
track_id_name:
|
|
26
|
-
time_id_name:
|
|
27
|
-
pos_x_id_name:
|
|
28
|
-
pos_y_id_name:
|
|
29
|
-
crop_fov:
|
|
21
|
+
textkwargs: dict | None = None,
|
|
22
|
+
label_id_name: str | None = "MAX_INTENSITY_CH3",
|
|
23
|
+
track_id_name: str | None = "TRACK_ID",
|
|
24
|
+
time_id_name: str | None = "POSITION_T",
|
|
25
|
+
pos_x_id_name: str | None = "POSITION_X",
|
|
26
|
+
pos_y_id_name: str | None = "POSITION_Y",
|
|
27
|
+
crop_fov: list[float] | None = None,
|
|
30
28
|
) -> None:
|
|
31
29
|
"""Overlay tracking result and video.
|
|
32
30
|
|
|
@@ -73,7 +71,7 @@ def add_trackmate_data_to_viewer(
|
|
|
73
71
|
labels_layer = viewer.add_labels(new_labels, scale=scale)
|
|
74
72
|
labels_layer.contour = 10
|
|
75
73
|
|
|
76
|
-
for image, colormap in zip(image_data, colormaps):
|
|
74
|
+
for image, colormap in zip(image_data, colormaps, strict=True):
|
|
77
75
|
viewer.add_image(image, blending="additive", colormap=colormap, scale=scale)
|
|
78
76
|
# TODO implement cropping, filter points in / outside range
|
|
79
77
|
# crop_fov =
|
|
@@ -95,8 +93,8 @@ def pandas_df_to_napari_tracks(
|
|
|
95
93
|
frame_id_name: str,
|
|
96
94
|
position_x_name: str,
|
|
97
95
|
position_y_name: str,
|
|
98
|
-
feature_name:
|
|
99
|
-
colormaps_dict:
|
|
96
|
+
feature_name: str | None = None,
|
|
97
|
+
colormaps_dict: dict | None = None,
|
|
100
98
|
) -> None:
|
|
101
99
|
"""Add tracks to Napari track layer.
|
|
102
100
|
Splitting and merging are not yet implemented.
|
|
@@ -106,12 +104,13 @@ def pandas_df_to_napari_tracks(
|
|
|
106
104
|
track_data = track_df[
|
|
107
105
|
[unique_track_id_name, frame_id_name, position_y_name, position_x_name]
|
|
108
106
|
].to_numpy()
|
|
109
|
-
|
|
110
|
-
raise ValueError(
|
|
111
|
-
"Make sure that the features are between 0 and 1, "
|
|
112
|
-
"otherwise the colormapping does not work well"
|
|
113
|
-
)
|
|
107
|
+
|
|
114
108
|
features = None
|
|
115
109
|
if feature_name is not None:
|
|
110
|
+
if track_df[feature_name].min() < 0 or track_df[feature_name].max() > 100.0:
|
|
111
|
+
raise ValueError(
|
|
112
|
+
"Make sure that the features are between 0 and 1, "
|
|
113
|
+
"otherwise the colormapping does not work well"
|
|
114
|
+
)
|
|
116
115
|
features = {feature_name: track_df[feature_name].to_numpy()}
|
|
117
116
|
viewer.add_tracks(track_data, features=features, colormaps_dict=colormaps_dict)
|