celldetective 1.4.2__py3-none-any.whl → 1.5.0b0__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.
Files changed (151) hide show
  1. celldetective/__init__.py +25 -0
  2. celldetective/__main__.py +62 -43
  3. celldetective/_version.py +1 -1
  4. celldetective/extra_properties.py +477 -399
  5. celldetective/filters.py +192 -97
  6. celldetective/gui/InitWindow.py +541 -411
  7. celldetective/gui/__init__.py +0 -15
  8. celldetective/gui/about.py +44 -39
  9. celldetective/gui/analyze_block.py +120 -84
  10. celldetective/gui/base/__init__.py +0 -0
  11. celldetective/gui/base/channel_norm_generator.py +335 -0
  12. celldetective/gui/base/components.py +249 -0
  13. celldetective/gui/base/feature_choice.py +92 -0
  14. celldetective/gui/base/figure_canvas.py +52 -0
  15. celldetective/gui/base/list_widget.py +133 -0
  16. celldetective/gui/{styles.py → base/styles.py} +92 -36
  17. celldetective/gui/base/utils.py +33 -0
  18. celldetective/gui/base_annotator.py +900 -767
  19. celldetective/gui/classifier_widget.py +6 -22
  20. celldetective/gui/configure_new_exp.py +777 -671
  21. celldetective/gui/control_panel.py +635 -524
  22. celldetective/gui/dynamic_progress.py +449 -0
  23. celldetective/gui/event_annotator.py +2023 -1662
  24. celldetective/gui/generic_signal_plot.py +1292 -944
  25. celldetective/gui/gui_utils.py +899 -1289
  26. celldetective/gui/interactions_block.py +658 -0
  27. celldetective/gui/interactive_timeseries_viewer.py +447 -0
  28. celldetective/gui/json_readers.py +48 -15
  29. celldetective/gui/layouts/__init__.py +5 -0
  30. celldetective/gui/layouts/background_model_free_layout.py +537 -0
  31. celldetective/gui/layouts/channel_offset_layout.py +134 -0
  32. celldetective/gui/layouts/local_correction_layout.py +91 -0
  33. celldetective/gui/layouts/model_fit_layout.py +372 -0
  34. celldetective/gui/layouts/operation_layout.py +68 -0
  35. celldetective/gui/layouts/protocol_designer_layout.py +96 -0
  36. celldetective/gui/pair_event_annotator.py +3130 -2435
  37. celldetective/gui/plot_measurements.py +586 -267
  38. celldetective/gui/plot_signals_ui.py +724 -506
  39. celldetective/gui/preprocessing_block.py +395 -0
  40. celldetective/gui/process_block.py +1678 -1831
  41. celldetective/gui/seg_model_loader.py +580 -473
  42. celldetective/gui/settings/__init__.py +0 -7
  43. celldetective/gui/settings/_cellpose_model_params.py +181 -0
  44. celldetective/gui/settings/_event_detection_model_params.py +95 -0
  45. celldetective/gui/settings/_segmentation_model_params.py +159 -0
  46. celldetective/gui/settings/_settings_base.py +77 -65
  47. celldetective/gui/settings/_settings_event_model_training.py +752 -526
  48. celldetective/gui/settings/_settings_measurements.py +1133 -964
  49. celldetective/gui/settings/_settings_neighborhood.py +574 -488
  50. celldetective/gui/settings/_settings_segmentation_model_training.py +779 -564
  51. celldetective/gui/settings/_settings_signal_annotator.py +329 -305
  52. celldetective/gui/settings/_settings_tracking.py +1304 -1094
  53. celldetective/gui/settings/_stardist_model_params.py +98 -0
  54. celldetective/gui/survival_ui.py +422 -312
  55. celldetective/gui/tableUI.py +1665 -1701
  56. celldetective/gui/table_ops/_maths.py +295 -0
  57. celldetective/gui/table_ops/_merge_groups.py +140 -0
  58. celldetective/gui/table_ops/_merge_one_hot.py +95 -0
  59. celldetective/gui/table_ops/_query_table.py +43 -0
  60. celldetective/gui/table_ops/_rename_col.py +44 -0
  61. celldetective/gui/thresholds_gui.py +382 -179
  62. celldetective/gui/viewers/__init__.py +0 -0
  63. celldetective/gui/viewers/base_viewer.py +700 -0
  64. celldetective/gui/viewers/channel_offset_viewer.py +331 -0
  65. celldetective/gui/viewers/contour_viewer.py +394 -0
  66. celldetective/gui/viewers/size_viewer.py +153 -0
  67. celldetective/gui/viewers/spot_detection_viewer.py +341 -0
  68. celldetective/gui/viewers/threshold_viewer.py +309 -0
  69. celldetective/gui/workers.py +304 -126
  70. celldetective/log_manager.py +92 -0
  71. celldetective/measure.py +1895 -1478
  72. celldetective/napari/__init__.py +0 -0
  73. celldetective/napari/utils.py +1025 -0
  74. celldetective/neighborhood.py +1914 -1448
  75. celldetective/preprocessing.py +1620 -1220
  76. celldetective/processes/__init__.py +0 -0
  77. celldetective/processes/background_correction.py +271 -0
  78. celldetective/processes/compute_neighborhood.py +894 -0
  79. celldetective/processes/detect_events.py +246 -0
  80. celldetective/processes/measure_cells.py +565 -0
  81. celldetective/processes/segment_cells.py +760 -0
  82. celldetective/processes/track_cells.py +435 -0
  83. celldetective/processes/train_segmentation_model.py +694 -0
  84. celldetective/processes/train_signal_model.py +265 -0
  85. celldetective/processes/unified_process.py +292 -0
  86. celldetective/regionprops/_regionprops.py +358 -317
  87. celldetective/relative_measurements.py +987 -710
  88. celldetective/scripts/measure_cells.py +313 -212
  89. celldetective/scripts/measure_relative.py +90 -46
  90. celldetective/scripts/segment_cells.py +165 -104
  91. celldetective/scripts/segment_cells_thresholds.py +96 -68
  92. celldetective/scripts/track_cells.py +198 -149
  93. celldetective/scripts/train_segmentation_model.py +324 -201
  94. celldetective/scripts/train_signal_model.py +87 -45
  95. celldetective/segmentation.py +844 -749
  96. celldetective/signals.py +3514 -2861
  97. celldetective/tracking.py +30 -15
  98. celldetective/utils/__init__.py +0 -0
  99. celldetective/utils/cellpose_utils/__init__.py +133 -0
  100. celldetective/utils/color_mappings.py +42 -0
  101. celldetective/utils/data_cleaning.py +630 -0
  102. celldetective/utils/data_loaders.py +450 -0
  103. celldetective/utils/dataset_helpers.py +207 -0
  104. celldetective/utils/downloaders.py +197 -0
  105. celldetective/utils/event_detection/__init__.py +8 -0
  106. celldetective/utils/experiment.py +1782 -0
  107. celldetective/utils/image_augmenters.py +308 -0
  108. celldetective/utils/image_cleaning.py +74 -0
  109. celldetective/utils/image_loaders.py +926 -0
  110. celldetective/utils/image_transforms.py +335 -0
  111. celldetective/utils/io.py +62 -0
  112. celldetective/utils/mask_cleaning.py +348 -0
  113. celldetective/utils/mask_transforms.py +5 -0
  114. celldetective/utils/masks.py +184 -0
  115. celldetective/utils/maths.py +351 -0
  116. celldetective/utils/model_getters.py +325 -0
  117. celldetective/utils/model_loaders.py +296 -0
  118. celldetective/utils/normalization.py +380 -0
  119. celldetective/utils/parsing.py +465 -0
  120. celldetective/utils/plots/__init__.py +0 -0
  121. celldetective/utils/plots/regression.py +53 -0
  122. celldetective/utils/resources.py +34 -0
  123. celldetective/utils/stardist_utils/__init__.py +104 -0
  124. celldetective/utils/stats.py +90 -0
  125. celldetective/utils/types.py +21 -0
  126. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/METADATA +1 -1
  127. celldetective-1.5.0b0.dist-info/RECORD +187 -0
  128. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/WHEEL +1 -1
  129. tests/gui/test_new_project.py +129 -117
  130. tests/gui/test_project.py +127 -79
  131. tests/test_filters.py +39 -15
  132. tests/test_notebooks.py +8 -0
  133. tests/test_tracking.py +232 -13
  134. tests/test_utils.py +123 -77
  135. celldetective/gui/base_components.py +0 -23
  136. celldetective/gui/layouts.py +0 -1602
  137. celldetective/gui/processes/compute_neighborhood.py +0 -594
  138. celldetective/gui/processes/measure_cells.py +0 -360
  139. celldetective/gui/processes/segment_cells.py +0 -499
  140. celldetective/gui/processes/track_cells.py +0 -303
  141. celldetective/gui/processes/train_segmentation_model.py +0 -270
  142. celldetective/gui/processes/train_signal_model.py +0 -108
  143. celldetective/gui/table_ops/merge_groups.py +0 -118
  144. celldetective/gui/viewers.py +0 -1354
  145. celldetective/io.py +0 -3663
  146. celldetective/utils.py +0 -3108
  147. celldetective-1.4.2.dist-info/RECORD +0 -123
  148. /celldetective/{gui/processes → processes}/downloader.py +0 -0
  149. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/entry_points.txt +0 -0
  150. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/licenses/LICENSE +0 -0
  151. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/top_level.txt +0 -0
@@ -1,31 +1,84 @@
1
- from celldetective.utils import get_software_location
1
+ from celldetective import get_software_location
2
2
  from PyQt5.QtGui import QIcon
3
3
  import os
4
4
 
5
+
5
6
  class Styles(object):
6
7
 
7
- def __init__(self):
8
+ def __init__(self):
8
9
 
9
- self.init_button_styles()
10
- self.init_tab_styles()
11
- self.init_label_styles()
10
+ self.init_button_styles()
11
+ self.init_tab_styles()
12
+ self.init_label_styles()
12
13
 
13
- self.help_color = "#1958b7"
14
+ self.help_color = "#1958b7"
14
15
 
15
-
16
- self.celldetective_blue = "#1565c0"
17
- self.celldetective_logo_path = os.sep.join([get_software_location(),'celldetective','icons','logo.png'])
18
- self.celldetective_icon = QIcon(self.celldetective_logo_path)
16
+ self.celldetective_blue = "#1565c0"
17
+ self.celldetective_logo_path = os.sep.join(
18
+ [get_software_location(), "celldetective", "icons", "logo.png"]
19
+ )
20
+ self.celldetective_icon = QIcon(self.celldetective_logo_path)
19
21
 
20
- self.action_lbl_style_sheet = """
22
+ self.action_lbl_style_sheet = """
21
23
  font-size: 10px;
22
24
  padding-left: 10px;
23
25
  """
24
26
 
25
- def init_button_styles(self):
26
-
27
-
28
- self.button_style_sheet = '''
27
+ self.progress_bar_style = f"""
28
+ QProgressBar {{
29
+ border: 1px solid #B8B8B8;
30
+ border-radius: 5px;
31
+ text-align: center;
32
+ background-color: white;
33
+ color: black;
34
+ }}
35
+ QProgressBar::chunk {{
36
+ background-color: {self.celldetective_blue};
37
+ width: 20px;
38
+ }}
39
+ """
40
+ self.combo_style = """
41
+ QComboBox {
42
+ border: 1px solid #B8B8B8;
43
+ border-radius: 5px;
44
+ padding: 1px 18px 1px 3px;
45
+ min-width: 6em;
46
+ }
47
+ QComboBox:editable {
48
+ background: white;
49
+ }
50
+ QComboBox:!editable, QComboBox::drop-down:editable {
51
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
52
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
53
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
54
+ }
55
+ QComboBox:!editable:on, QComboBox::drop-down:editable:on {
56
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
57
+ stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
58
+ stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
59
+ }
60
+ QComboBox:on { /* shift the text when the popup opens */
61
+ padding-top: 3px;
62
+ padding-left: 4px;
63
+ }
64
+ QComboBox::drop-down {
65
+ subcontrol-origin: padding;
66
+ subcontrol-position: top right;
67
+ width: 15px;
68
+ border-left-width: 1px;
69
+ border-left-color: darkgray;
70
+ border-left-style: solid;
71
+ border-top-right-radius: 3px;
72
+ border-bottom-right-radius: 3px;
73
+ }
74
+ QComboBox::down-arrow {
75
+ image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png);
76
+ }
77
+ """
78
+
79
+ def init_button_styles(self):
80
+
81
+ self.button_style_sheet = """
29
82
  QPushButton {
30
83
  background-color: #1565c0;
31
84
  color: white;
@@ -49,9 +102,9 @@ class Styles(object):
49
102
  font-weight: bold;
50
103
  font-size: 12px;
51
104
  }
52
- '''
105
+ """
53
106
 
54
- self.button_style_sheet_2 = '''
107
+ self.button_style_sheet_2 = """
55
108
  QPushButton {
56
109
  background-color: transparent;
57
110
  border: 3px solid #1565c0;
@@ -73,9 +126,9 @@ class Styles(object):
73
126
  color: rgba(21, 101, 192, 0.50);
74
127
  }
75
128
 
76
- '''
129
+ """
77
130
 
78
- self.button_style_sheet_5 = '''
131
+ self.button_style_sheet_5 = """
79
132
  QPushButton {
80
133
  background-color: transparent;
81
134
  border: 3px solid #1565c0;
@@ -96,10 +149,9 @@ class Styles(object):
96
149
  color: rgba(21, 101, 192, 0.50);
97
150
  }
98
151
 
99
- '''
100
-
152
+ """
101
153
 
102
- self.button_style_sheet_2_not_done = '''
154
+ self.button_style_sheet_2_not_done = """
103
155
  QPushButton {
104
156
  background-color: transparent;
105
157
  border: 3px solid #d14334;
@@ -115,9 +167,9 @@ class Styles(object):
115
167
  QPushButton:pressed {
116
168
  background-color: #ff8a00;
117
169
  }
118
- '''
170
+ """
119
171
 
120
- self.button_style_sheet_3 = '''
172
+ self.button_style_sheet_3 = """
121
173
  QPushButton {
122
174
  background-color: #eeeeee;
123
175
  color: black;
@@ -132,9 +184,9 @@ class Styles(object):
132
184
  QPushButton:pressed {
133
185
  background-color: #ff8a00;
134
186
  }
135
- '''
187
+ """
136
188
 
137
- self.button_select_all = '''
189
+ self.button_select_all = """
138
190
  QPushButton {
139
191
  background-color: transparent;
140
192
  color: black;
@@ -148,9 +200,13 @@ class Styles(object):
148
200
  QPushButton:pressed {
149
201
  background-color: #ff8a00;
150
202
  }
151
- '''
203
+ QPushButton:checked {
204
+ background-color: #1565c0;
205
+ color: white;
206
+ }
207
+ """
152
208
 
153
- self.menu_check_style = '''
209
+ self.menu_check_style = """
154
210
  QCheckBox {
155
211
  font-size: 10px;
156
212
  padding-left: 10px;
@@ -160,9 +216,9 @@ class Styles(object):
160
216
  background-color : rgba(189, 189, 189, 1);
161
217
  opacity : 0.3;
162
218
  }
163
- '''
219
+ """
164
220
 
165
- self.button_add = '''
221
+ self.button_add = """
166
222
  QPushButton {
167
223
  background-color: transparent;
168
224
  color: black;
@@ -177,11 +233,11 @@ class Styles(object):
177
233
  QPushButton:pressed {
178
234
  background-color: #ff8a00;
179
235
  }
180
- '''
236
+ """
181
237
 
182
- def init_tab_styles(self):
238
+ def init_tab_styles(self):
183
239
 
184
- self.qtab_style = """
240
+ self.qtab_style = """
185
241
  QTabWidget::pane {
186
242
  border: 1px solid #B8B8B8;
187
243
  background: white;
@@ -271,9 +327,9 @@ class Styles(object):
271
327
  }
272
328
  """
273
329
 
274
- def init_label_styles(self):
330
+ def init_label_styles(self):
275
331
 
276
- self.block_title = '''
332
+ self.block_title = """
277
333
  font-weight: bold;
278
334
  padding: 0px;
279
- '''
335
+ """
@@ -0,0 +1,33 @@
1
+ from PyQt5.QtWidgets import QApplication
2
+ from prettytable import PrettyTable
3
+
4
+
5
+ def center_window(window):
6
+ """
7
+ Centers the given window in the middle of the screen.
8
+
9
+ This function calculates the current screen's geometry and moves the
10
+ specified window to the center of the screen. It works by retrieving the
11
+ frame geometry of the window, identifying the screen where the cursor is
12
+ currently located, and adjusting the window's position to be centrally
13
+ aligned on that screen.
14
+
15
+ Parameters
16
+ ----------
17
+ window : QMainWindow or QWidget
18
+ The window or widget to be centered on the screen.
19
+ """
20
+
21
+ frameGm = window.frameGeometry()
22
+ screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
23
+ centerPoint = QApplication.desktop().screenGeometry(screen).center()
24
+ frameGm.moveCenter(centerPoint)
25
+ window.move(frameGm.topLeft())
26
+
27
+
28
+ def pretty_table(dct: dict):
29
+ table = PrettyTable()
30
+ for c in dct.keys():
31
+ table.add_column(str(c), [])
32
+ table.add_row([dct.get(c, "") for c in dct.keys()])
33
+ print(table)