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.
@@ -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: List[np.ndarray],
19
- colormaps: List[str],
20
- labels: Optional[np.ndarray],
21
- cycle_percentage_id: Optional[str] = "CELL_CYCLE_PERC_POST",
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: Optional[dict] = None,
24
- label_id_name: Optional[str] = "MAX_INTENSITY_CH3",
25
- track_id_name: Optional[str] = "TRACK_ID",
26
- time_id_name: Optional[str] = "POSITION_T",
27
- pos_x_id_name: Optional[str] = "POSITION_X",
28
- pos_y_id_name: Optional[str] = "POSITION_Y",
29
- crop_fov: Optional[List[float]] = None,
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: Optional[str] = None,
99
- colormaps_dict: Optional[dict] = None,
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
- if track_df[feature_name].min() < 0 or track_df[feature_name].max() > 100.0:
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)