cellects 0.1.2__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 +390 -330
- cellects/gui/cellects.py +102 -91
- cellects/gui/custom_widgets.py +16 -33
- cellects/gui/first_window.py +226 -104
- cellects/gui/if_several_folders_window.py +117 -68
- cellects/gui/image_analysis_window.py +866 -454
- cellects/gui/required_output.py +104 -57
- cellects/gui/ui_strings.py +840 -0
- cellects/gui/video_analysis_window.py +333 -155
- 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 -109
- 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.2.dist-info/LICENSE.odt +0 -0
- cellects-0.1.2.dist-info/METADATA +0 -132
- cellects-0.1.2.dist-info/RECORD +0 -44
- {cellects-0.1.2.dist-info → cellects-0.2.6.dist-info}/WHEEL +0 -0
- {cellects-0.1.2.dist-info → cellects-0.2.6.dist-info}/entry_points.txt +0 -0
- {cellects-0.1.2.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
|
-
"""
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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.
|
|
6
16
|
"""
|
|
7
17
|
|
|
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
|
-
from cellects.image_analysis.shape_descriptors import descriptors_names_to_display
|
|
13
|
-
|
|
23
|
+
from cellects.image_analysis.shape_descriptors import descriptors_names_to_display, descriptors_categories
|
|
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()
|
|
21
56
|
|
|
22
|
-
def true_init(self
|
|
57
|
+
def true_init(self):
|
|
58
|
+
"""
|
|
59
|
+
Initialize the RequiredOutput window with various checkboxes and buttons.
|
|
60
|
+
|
|
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,10 +172,19 @@ 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
|
"""
|
|
185
|
+
if not np.array_equal(self.parent().po.all['descriptors'], list(descriptors_categories.keys())):
|
|
186
|
+
self.parent().po.all['descriptors'] = descriptors_categories
|
|
187
|
+
|
|
139
188
|
descriptor_names = self.parent().po.all['descriptors']
|
|
140
189
|
|
|
141
190
|
for i, name in enumerate(descriptor_names):
|
|
@@ -151,15 +200,22 @@ class RequiredOutput(WindowType):
|
|
|
151
200
|
self.descriptor_widgets_list.append(Checkbox(self.parent().po.all['descriptors'][name]))
|
|
152
201
|
cb_index = label_index + 1
|
|
153
202
|
|
|
154
|
-
if name == 'fractal_analysis'
|
|
155
|
-
|
|
156
|
-
|
|
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)
|
|
157
206
|
|
|
158
207
|
self.save_descriptors_layout.addWidget(self.descriptor_widgets_list[cb_index], row, col + 1)
|
|
159
208
|
|
|
160
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
|
+
"""
|
|
161
217
|
self.save_coord_specimen.setChecked(self.parent().po.vars['save_coord_specimen'])
|
|
162
|
-
self.
|
|
218
|
+
self.save_graph.setChecked(self.parent().po.vars['save_graph'])
|
|
163
219
|
self.save_coord_thickening_slimming.setChecked(self.parent().po.vars['save_coord_thickening_slimming'])
|
|
164
220
|
self.save_coord_network.setChecked(self.parent().po.vars['save_coord_network'])
|
|
165
221
|
|
|
@@ -172,10 +228,6 @@ class RequiredOutput(WindowType):
|
|
|
172
228
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['oscilacyto_analysis'])
|
|
173
229
|
elif name == 'fractal_analysis':
|
|
174
230
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['fractal_analysis'])
|
|
175
|
-
elif name == 'network_analysis':
|
|
176
|
-
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['network_analysis'])
|
|
177
|
-
elif name == 'graph_extraction':
|
|
178
|
-
self.descriptor_widgets_list[k].setChecked(self.parent().po.vars['graph_extraction'])
|
|
179
231
|
else:
|
|
180
232
|
self.descriptor_widgets_list[k].setChecked(self.parent().po.all['descriptors'][name])
|
|
181
233
|
|
|
@@ -185,8 +237,20 @@ class RequiredOutput(WindowType):
|
|
|
185
237
|
self.parent().change_widget(3) # ThirdWidget
|
|
186
238
|
|
|
187
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
|
+
"""
|
|
188
252
|
self.parent().po.vars['save_coord_specimen'] = self.save_coord_specimen.isChecked()
|
|
189
|
-
self.parent().po.vars['
|
|
253
|
+
self.parent().po.vars['save_graph'] = self.save_graph.isChecked()
|
|
190
254
|
self.parent().po.vars['save_coord_thickening_slimming'] = self.save_coord_thickening_slimming.isChecked()
|
|
191
255
|
self.parent().po.vars['save_coord_network'] = self.save_coord_network.isChecked()
|
|
192
256
|
descriptor_names = self.parent().po.all['descriptors'].keys()
|
|
@@ -200,14 +264,6 @@ class RequiredOutput(WindowType):
|
|
|
200
264
|
self.parent().po.vars['oscilacyto_analysis'] = checked_status
|
|
201
265
|
if name == 'fractal_analysis':
|
|
202
266
|
self.parent().po.vars['fractal_analysis'] = checked_status
|
|
203
|
-
if name == 'network_analysis':
|
|
204
|
-
self.parent().po.vars['network_analysis'] = checked_status
|
|
205
|
-
if name == 'graph_extraction':
|
|
206
|
-
self.parent().po.vars['graph_extraction'] = checked_status
|
|
207
|
-
|
|
208
|
-
# for j in [0, 1, 2]:
|
|
209
|
-
# k = i * 4 + j + 1
|
|
210
|
-
# self.parent().po.all['descriptors'][name][j] = self.descriptor_widgets_list[k].isChecked()
|
|
211
267
|
if not self.parent().thread['SaveAllVars'].isRunning():
|
|
212
268
|
self.parent().thread['SaveAllVars'].start()
|
|
213
269
|
self.parent().po.update_output_list()
|
|
@@ -217,16 +273,7 @@ class RequiredOutput(WindowType):
|
|
|
217
273
|
self.parent().change_widget(3) # ThirdWidget
|
|
218
274
|
|
|
219
275
|
def closeEvent(self, event):
|
|
276
|
+
"""
|
|
277
|
+
Handle the close event for a QWidget.
|
|
278
|
+
"""
|
|
220
279
|
event.accept
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
# if __name__ == "__main__":
|
|
224
|
-
# from cellects.gui.cellects import CellectsMainWidget
|
|
225
|
-
# import sys
|
|
226
|
-
#
|
|
227
|
-
# app = QtWidgets.QApplication([])
|
|
228
|
-
# parent = CellectsMainWidget()
|
|
229
|
-
# session = RequiredOutput(parent, False)
|
|
230
|
-
# parent.insertWidget(0, session)
|
|
231
|
-
# parent.show()
|
|
232
|
-
# sys.exit(app.exec())
|