cellects 0.1.3__py3-none-any.whl → 0.2.6__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.
- cellects/__main__.py +65 -25
- cellects/config/all_vars_dict.py +18 -17
- cellects/core/cellects_threads.py +1034 -396
- cellects/core/motion_analysis.py +1664 -2010
- cellects/core/one_image_analysis.py +1082 -1061
- cellects/core/program_organizer.py +1687 -1316
- cellects/core/script_based_run.py +80 -76
- cellects/gui/advanced_parameters.py +365 -326
- cellects/gui/cellects.py +102 -91
- cellects/gui/custom_widgets.py +4 -3
- cellects/gui/first_window.py +226 -104
- cellects/gui/if_several_folders_window.py +117 -68
- cellects/gui/image_analysis_window.py +841 -450
- cellects/gui/required_output.py +100 -56
- cellects/gui/ui_strings.py +840 -0
- cellects/gui/video_analysis_window.py +317 -135
- cellects/image_analysis/cell_leaving_detection.py +64 -4
- cellects/image_analysis/image_segmentation.py +451 -22
- cellects/image_analysis/morphological_operations.py +2166 -1635
- cellects/image_analysis/network_functions.py +616 -253
- cellects/image_analysis/one_image_analysis_threads.py +94 -153
- cellects/image_analysis/oscillations_functions.py +131 -0
- cellects/image_analysis/progressively_add_distant_shapes.py +2 -3
- cellects/image_analysis/shape_descriptors.py +517 -466
- cellects/utils/formulas.py +169 -6
- cellects/utils/load_display_save.py +362 -105
- cellects/utils/utilitarian.py +86 -9
- cellects-0.2.6.dist-info/LICENSE +675 -0
- cellects-0.2.6.dist-info/METADATA +829 -0
- cellects-0.2.6.dist-info/RECORD +44 -0
- cellects/core/one_video_per_blob.py +0 -540
- cellects/image_analysis/cluster_flux_study.py +0 -102
- cellects-0.1.3.dist-info/LICENSE.odt +0 -0
- cellects-0.1.3.dist-info/METADATA +0 -176
- cellects-0.1.3.dist-info/RECORD +0 -44
- {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/WHEEL +0 -0
- {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/entry_points.txt +0 -0
- {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/top_level.txt +0 -0
cellects/gui/required_output.py
CHANGED
|
@@ -1,26 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
"""Widget for configuring Cellects analysis variables and descriptors.
|
|
3
|
+
|
|
4
|
+
This GUI module provides checkboxes to select raw data outputs (presence/absence coordinates,
|
|
5
|
+
contours, tubular networks) and dynamic descriptors calculated per time frame. User selections are saved via parent
|
|
6
|
+
object's background thread when 'Ok' is clicked. Includes categorized sections with grouped options for clarity of
|
|
7
|
+
specimen tracking parameters.
|
|
8
|
+
|
|
9
|
+
Main Components
|
|
10
|
+
---------------
|
|
11
|
+
RequiredOutput : QWidget for configuring required output variables
|
|
12
|
+
|
|
13
|
+
Notes
|
|
14
|
+
-----
|
|
15
|
+
Saves user selections using parent object's SaveAllVars QThread.
|
|
2
16
|
"""
|
|
3
|
-
|
|
4
|
-
A first kind of variable is raw data: presence/absence coordinates of the specimens, network, oscillating pixels
|
|
5
|
-
A second kind of variable describe the specimen at each time frame and for each arena of the image stack or video
|
|
6
|
-
"""
|
|
17
|
+
|
|
7
18
|
import numpy as np
|
|
8
19
|
from PySide6 import QtWidgets, QtCore
|
|
9
20
|
import logging
|
|
10
21
|
from cellects.gui.custom_widgets import (
|
|
11
22
|
WindowType, PButton, Checkbox, FixedText)
|
|
12
23
|
from cellects.image_analysis.shape_descriptors import descriptors_names_to_display, descriptors_categories
|
|
13
|
-
|
|
24
|
+
from cellects.gui.ui_strings import RO
|
|
14
25
|
|
|
15
26
|
class RequiredOutput(WindowType):
|
|
16
27
|
def __init__(self, parent, night_mode):
|
|
28
|
+
"""
|
|
29
|
+
Initialize the RequiredOutput window with a parent widget and night mode setting.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
parent : QWidget
|
|
34
|
+
The parent widget to which this window will be attached.
|
|
35
|
+
night_mode : bool
|
|
36
|
+
A boolean indicating whether the night mode should be enabled.
|
|
37
|
+
|
|
38
|
+
Examples
|
|
39
|
+
--------
|
|
40
|
+
>>> from PySide6 import QtWidgets
|
|
41
|
+
>>> from cellects.gui.cellects import CellectsMainWidget
|
|
42
|
+
>>> from cellects.gui.required_output import RequiredOutput
|
|
43
|
+
>>> import sys
|
|
44
|
+
>>> app = QtWidgets.QApplication([])
|
|
45
|
+
>>> parent = CellectsMainWidget()
|
|
46
|
+
>>> session = RequiredOutput(parent, False)
|
|
47
|
+
>>> session.true_init()
|
|
48
|
+
>>> parent.insertWidget(0, session)
|
|
49
|
+
>>> parent.show()
|
|
50
|
+
>>> sys.exit(app.exec())
|
|
51
|
+
"""
|
|
17
52
|
super().__init__(parent, night_mode)
|
|
18
53
|
self.setParent(parent)
|
|
19
54
|
# Create the main Title
|
|
20
|
-
self.true_init(
|
|
55
|
+
self.true_init()
|
|
56
|
+
|
|
57
|
+
def true_init(self):
|
|
58
|
+
"""
|
|
59
|
+
Initialize the RequiredOutput window with various checkboxes and buttons.
|
|
21
60
|
|
|
22
|
-
|
|
61
|
+
This method sets up the entire UI layout for the RequiredOutput window,
|
|
62
|
+
including a title, checkboxes for saving different types of coordinates and
|
|
63
|
+
descriptors, and 'Cancel' and 'Ok' buttons.
|
|
23
64
|
|
|
65
|
+
Notes
|
|
66
|
+
-----
|
|
67
|
+
This method assumes that the parent widget has a 'po' attribute with specific settings and variables.
|
|
68
|
+
"""
|
|
24
69
|
logging.info("Initialize RequiredOutput window")
|
|
25
70
|
self.title = FixedText('Required Output', police=30, night_mode=self.parent().po.all['night_mode'])
|
|
26
71
|
self.title.setAlignment(QtCore.Qt.AlignHCenter)
|
|
@@ -50,33 +95,28 @@ class RequiredOutput(WindowType):
|
|
|
50
95
|
|
|
51
96
|
# I/C/ Create widgets
|
|
52
97
|
self.save_coord_specimen = Checkbox(self.parent().po.vars['save_coord_specimen'])
|
|
53
|
-
|
|
54
|
-
self.save_coord_specimen_label = FixedText('All pixels covered by the specimen(s)', tip="",
|
|
98
|
+
self.save_coord_specimen_label = FixedText(RO["coord_specimen"]["label"], tip=RO["coord_specimen"]["tips"],
|
|
55
99
|
night_mode=self.parent().po.all['night_mode'])
|
|
56
|
-
|
|
57
|
-
self.
|
|
58
|
-
# self.save_coord_contour.stateChanged.connect(self.save_coord_contour_saving)
|
|
59
|
-
self.save_coord_contour_label = FixedText('Contours of the specimen(s)', tip="",
|
|
100
|
+
self.save_graph = Checkbox(self.parent().po.vars['save_graph'])
|
|
101
|
+
self.save_graph_label = FixedText(RO["Graph"]["label"], tip=RO["Graph"]["tips"],
|
|
60
102
|
night_mode=self.parent().po.all['night_mode'])
|
|
61
103
|
self.save_coord_thickening_slimming = Checkbox(self.parent().po.vars['save_coord_thickening_slimming'])
|
|
62
|
-
|
|
63
|
-
|
|
104
|
+
self.save_coord_thickening_slimming_label = FixedText(RO["coord_oscillating"]["label"],
|
|
105
|
+
tip=RO["coord_oscillating"]["tips"],
|
|
64
106
|
night_mode=self.parent().po.all['night_mode'])
|
|
65
107
|
self.save_coord_network = Checkbox(self.parent().po.vars['save_coord_network'])
|
|
66
|
-
|
|
67
|
-
self.save_coord_network_label = FixedText('Tubular network in the specimen(s)', tip="",
|
|
108
|
+
self.save_coord_network_label = FixedText(RO["coord_network"]["label"], tip=RO["coord_network"]["tips"],
|
|
68
109
|
night_mode=self.parent().po.all['night_mode'])
|
|
69
110
|
|
|
70
111
|
# I/D/ Arrange widgets in the box
|
|
71
112
|
self.save_presence_coordinates_layout.addWidget(self.save_coord_specimen_label, 0, 0)
|
|
72
113
|
self.save_presence_coordinates_layout.addWidget(self.save_coord_specimen, 0, 1)
|
|
73
|
-
self.save_presence_coordinates_layout.addWidget(self.
|
|
74
|
-
self.save_presence_coordinates_layout.addWidget(self.
|
|
75
|
-
|
|
76
|
-
self.save_presence_coordinates_layout.addWidget(self.
|
|
77
|
-
self.save_presence_coordinates_layout.addWidget(self.
|
|
78
|
-
self.save_presence_coordinates_layout.addWidget(self.
|
|
79
|
-
self.save_presence_coordinates_layout.addWidget(self.save_coord_network, 1, 3)
|
|
114
|
+
self.save_presence_coordinates_layout.addWidget(self.save_coord_thickening_slimming_label, 1, 0)
|
|
115
|
+
self.save_presence_coordinates_layout.addWidget(self.save_coord_thickening_slimming, 1, 1)
|
|
116
|
+
self.save_presence_coordinates_layout.addWidget(self.save_coord_network_label, 0, 2)
|
|
117
|
+
self.save_presence_coordinates_layout.addWidget(self.save_coord_network, 0, 3)
|
|
118
|
+
self.save_presence_coordinates_layout.addWidget(self.save_graph_label, 1, 2)
|
|
119
|
+
self.save_presence_coordinates_layout.addWidget(self.save_graph, 1, 3)
|
|
80
120
|
|
|
81
121
|
self.save_presence_coordinates_widget.setLayout(self.save_presence_coordinates_layout)
|
|
82
122
|
self.vlayout.addWidget(self.save_presence_coordinates_widget)
|
|
@@ -132,9 +172,15 @@ class RequiredOutput(WindowType):
|
|
|
132
172
|
|
|
133
173
|
def create_check_boxes_table(self):
|
|
134
174
|
"""
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
175
|
+
Create and populate a table of checkboxes for descriptors in the parent object.
|
|
176
|
+
|
|
177
|
+
This function initializes or updates the descriptors and iterates through
|
|
178
|
+
them to create a table of checkboxes, arranging them in a grid layout. The
|
|
179
|
+
arrangement depends on the total number of descriptors and their visibility.
|
|
180
|
+
|
|
181
|
+
Notes
|
|
182
|
+
-----
|
|
183
|
+
The layout of checkboxes changes based on the number of descriptors.
|
|
138
184
|
"""
|
|
139
185
|
if not np.array_equal(self.parent().po.all['descriptors'], list(descriptors_categories.keys())):
|
|
140
186
|
self.parent().po.all['descriptors'] = descriptors_categories
|
|
@@ -154,15 +200,22 @@ class RequiredOutput(WindowType):
|
|
|
154
200
|
self.descriptor_widgets_list.append(Checkbox(self.parent().po.all['descriptors'][name]))
|
|
155
201
|
cb_index = label_index + 1
|
|
156
202
|
|
|
157
|
-
if name == 'fractal_analysis'
|
|
158
|
-
|
|
159
|
-
|
|
203
|
+
# if name == 'fractal_analysis' or name == 'oscilacyto_analysis':
|
|
204
|
+
# self.descriptor_widgets_list[label_index].setVisible(False)
|
|
205
|
+
# self.descriptor_widgets_list[cb_index].setVisible(False)
|
|
160
206
|
|
|
161
207
|
self.save_descriptors_layout.addWidget(self.descriptor_widgets_list[cb_index], row, col + 1)
|
|
162
208
|
|
|
163
209
|
def cancel_is_clicked(self):
|
|
210
|
+
"""
|
|
211
|
+
Instead of saving the widgets values to the saved states, use the saved states to fill in the widgets.
|
|
212
|
+
|
|
213
|
+
This function updates the state of several checkboxes based on saved variables
|
|
214
|
+
and descriptors. It also changes the active widget to either the first or third
|
|
215
|
+
widget depending on a condition.
|
|
216
|
+
"""
|
|
164
217
|
self.save_coord_specimen.setChecked(self.parent().po.vars['save_coord_specimen'])
|
|
165
|
-
self.
|
|
218
|
+
self.save_graph.setChecked(self.parent().po.vars['save_graph'])
|
|
166
219
|
self.save_coord_thickening_slimming.setChecked(self.parent().po.vars['save_coord_thickening_slimming'])
|
|
167
220
|
self.save_coord_network.setChecked(self.parent().po.vars['save_coord_network'])
|
|
168
221
|
|
|
@@ -175,10 +228,6 @@ class RequiredOutput(WindowType):
|
|
|
175
228
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['oscilacyto_analysis'])
|
|
176
229
|
elif name == 'fractal_analysis':
|
|
177
230
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['fractal_analysis'])
|
|
178
|
-
elif name == 'network_analysis':
|
|
179
|
-
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['network_analysis'])
|
|
180
|
-
elif name == 'graph_extraction':
|
|
181
|
-
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['graph_extraction'])
|
|
182
231
|
else:
|
|
183
232
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.all['descriptors'][name])
|
|
184
233
|
|
|
@@ -188,8 +237,20 @@ class RequiredOutput(WindowType):
|
|
|
188
237
|
self.parent().change_widget(3) # ThirdWidget
|
|
189
238
|
|
|
190
239
|
def ok_is_clicked(self):
|
|
240
|
+
"""
|
|
241
|
+
Updates the parent object's variables and descriptor states based on UI checkboxes.
|
|
242
|
+
|
|
243
|
+
This method updates various variables and descriptor states in the parent
|
|
244
|
+
object based on the current state of checkboxes in the UI. It also starts a
|
|
245
|
+
thread to save all variables and updates the output list accordingly.
|
|
246
|
+
|
|
247
|
+
Notes
|
|
248
|
+
-----
|
|
249
|
+
This method does not return any value. It updates the internal state of the
|
|
250
|
+
parent object, which saves all user defined parameters.
|
|
251
|
+
"""
|
|
191
252
|
self.parent().po.vars['save_coord_specimen'] = self.save_coord_specimen.isChecked()
|
|
192
|
-
self.parent().po.vars['
|
|
253
|
+
self.parent().po.vars['save_graph'] = self.save_graph.isChecked()
|
|
193
254
|
self.parent().po.vars['save_coord_thickening_slimming'] = self.save_coord_thickening_slimming.isChecked()
|
|
194
255
|
self.parent().po.vars['save_coord_network'] = self.save_coord_network.isChecked()
|
|
195
256
|
descriptor_names = self.parent().po.all['descriptors'].keys()
|
|
@@ -203,14 +264,6 @@ class RequiredOutput(WindowType):
|
|
|
203
264
|
self.parent().po.vars['oscilacyto_analysis'] = checked_status
|
|
204
265
|
if name == 'fractal_analysis':
|
|
205
266
|
self.parent().po.vars['fractal_analysis'] = checked_status
|
|
206
|
-
if name == 'network_analysis':
|
|
207
|
-
self.parent().po.vars['network_analysis'] = checked_status
|
|
208
|
-
if name == 'graph_extraction':
|
|
209
|
-
self.parent().po.vars['graph_extraction'] = checked_status
|
|
210
|
-
|
|
211
|
-
# for j in [0, 1, 2]:
|
|
212
|
-
# k = i * 4 + j + 1
|
|
213
|
-
# self.parent().po.all['descriptors'][name][j] = self.descriptor_widgets_list[k].isChecked()
|
|
214
267
|
if not self.parent().thread['SaveAllVars'].isRunning():
|
|
215
268
|
self.parent().thread['SaveAllVars'].start()
|
|
216
269
|
self.parent().po.update_output_list()
|
|
@@ -220,16 +273,7 @@ class RequiredOutput(WindowType):
|
|
|
220
273
|
self.parent().change_widget(3) # ThirdWidget
|
|
221
274
|
|
|
222
275
|
def closeEvent(self, event):
|
|
276
|
+
"""
|
|
277
|
+
Handle the close event for a QWidget.
|
|
278
|
+
"""
|
|
223
279
|
event.accept
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
# if __name__ == "__main__":
|
|
227
|
-
# from cellects.gui.cellects import CellectsMainWidget
|
|
228
|
-
# import sys
|
|
229
|
-
#
|
|
230
|
-
# app = QtWidgets.QApplication([])
|
|
231
|
-
# parent = CellectsMainWidget()
|
|
232
|
-
# session = RequiredOutput(parent, False)
|
|
233
|
-
# parent.insertWidget(0, session)
|
|
234
|
-
# parent.show()
|
|
235
|
-
# sys.exit(app.exec())
|