cellects 0.1.0.dev1__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 (46) hide show
  1. cellects/__init__.py +0 -0
  2. cellects/__main__.py +49 -0
  3. cellects/config/__init__.py +0 -0
  4. cellects/config/all_vars_dict.py +154 -0
  5. cellects/core/__init__.py +0 -0
  6. cellects/core/cellects_paths.py +30 -0
  7. cellects/core/cellects_threads.py +1464 -0
  8. cellects/core/motion_analysis.py +1931 -0
  9. cellects/core/one_image_analysis.py +1065 -0
  10. cellects/core/one_video_per_blob.py +679 -0
  11. cellects/core/program_organizer.py +1347 -0
  12. cellects/core/script_based_run.py +154 -0
  13. cellects/gui/__init__.py +0 -0
  14. cellects/gui/advanced_parameters.py +1258 -0
  15. cellects/gui/cellects.py +189 -0
  16. cellects/gui/custom_widgets.py +789 -0
  17. cellects/gui/first_window.py +449 -0
  18. cellects/gui/if_several_folders_window.py +239 -0
  19. cellects/gui/image_analysis_window.py +1909 -0
  20. cellects/gui/required_output.py +232 -0
  21. cellects/gui/video_analysis_window.py +656 -0
  22. cellects/icons/__init__.py +0 -0
  23. cellects/icons/cellects_icon.icns +0 -0
  24. cellects/icons/cellects_icon.ico +0 -0
  25. cellects/image_analysis/__init__.py +0 -0
  26. cellects/image_analysis/cell_leaving_detection.py +54 -0
  27. cellects/image_analysis/cluster_flux_study.py +102 -0
  28. cellects/image_analysis/extract_exif.py +61 -0
  29. cellects/image_analysis/fractal_analysis.py +184 -0
  30. cellects/image_analysis/fractal_functions.py +108 -0
  31. cellects/image_analysis/image_segmentation.py +272 -0
  32. cellects/image_analysis/morphological_operations.py +867 -0
  33. cellects/image_analysis/network_functions.py +1244 -0
  34. cellects/image_analysis/one_image_analysis_threads.py +289 -0
  35. cellects/image_analysis/progressively_add_distant_shapes.py +246 -0
  36. cellects/image_analysis/shape_descriptors.py +981 -0
  37. cellects/utils/__init__.py +0 -0
  38. cellects/utils/formulas.py +881 -0
  39. cellects/utils/load_display_save.py +1016 -0
  40. cellects/utils/utilitarian.py +516 -0
  41. cellects-0.1.0.dev1.dist-info/LICENSE.odt +0 -0
  42. cellects-0.1.0.dev1.dist-info/METADATA +131 -0
  43. cellects-0.1.0.dev1.dist-info/RECORD +46 -0
  44. cellects-0.1.0.dev1.dist-info/WHEEL +5 -0
  45. cellects-0.1.0.dev1.dist-info/entry_points.txt +2 -0
  46. cellects-0.1.0.dev1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ This module contains the Widget that stacks all Cellects widget.
4
+ An important note is that user-friendliness and versatility are at the core of Cellects’ development.
5
+ Henceforth, the general workflow is in fact, a user-assisted workflow. Every step of the general workflow can
6
+ be fine-tuned by the user to cope with various imaging conditions. At every step, automatic algorithms suggest options
7
+ to help the user to find the best parameters.
8
+ """
9
+ import logging
10
+ import signal
11
+
12
+ # necessary on OSX
13
+ # pip install cython pyobjus
14
+ import sys
15
+ import numpy as np
16
+ from PySide6 import QtWidgets, QtGui
17
+ from screeninfo import get_monitors
18
+
19
+ from cellects.core.program_organizer import ProgramOrganizer
20
+ from cellects.core.cellects_threads import SaveAllVarsThread
21
+ from cellects.gui.advanced_parameters import AdvancedParameters
22
+ from cellects.gui.first_window import FirstWindow
23
+ from cellects.gui.if_several_folders_window import IfSeveralFoldersWindow
24
+ from cellects.gui.image_analysis_window import ImageAnalysisWindow
25
+ from cellects.gui.required_output import RequiredOutput
26
+ from cellects.gui.video_analysis_window import VideoAnalysisWindow
27
+
28
+ from cellects.core.cellects_paths import ICONS_DIR
29
+
30
+
31
+ class CellectsMainWidget(QtWidgets.QStackedWidget):
32
+ """ Main widget: this is the main window """
33
+
34
+ def __init__(self):
35
+ super().__init__()
36
+
37
+ self.setWindowTitle('Cellects')
38
+ self.pre_processing_done: bool = False
39
+ self.last_is_first: bool = True
40
+ self.last_tab: str = "data_specifications"
41
+ self.pre_processing_done: bool = False
42
+ self.screen_height = get_monitors()[0].height
43
+ self.screen_width = get_monitors()[0].width
44
+ self.im_max_width = 570 # self.screen_width // 5 374, 296
45
+ self.im_max_height = 266 # self.screen_height // 5 (1369, 778) (1380, 834)
46
+ # self.image_window_width_ratio = 570/1380
47
+ # self.image_window_height_ratio = 266/750
48
+ self.image_window_width_diff = 1380 - 570
49
+ self.image_window_height_diff = 750 - 266
50
+ self.image_to_display = np.zeros((self.im_max_height, self.im_max_width, 3), np.uint8)
51
+ # self.im_max_height = (2 * self.screen_height // 3) // 3
52
+ # self.im_max_width = (2 * self.screen_width // 3) // 4
53
+ self.i = 1
54
+ self.po = ProgramOrganizer()
55
+ # self.subwidgets_stack.po = self.po
56
+ self.po.load_variable_dict()
57
+ # self.parent().po.all['night_mode'] = True
58
+
59
+ # self.resize(4 * self.screen_width // 5, 4 * self.screen_height // 5)
60
+ self.resize(1380, 750)
61
+
62
+ # self.setMaximumWidth(self.screen_width)
63
+ # self.setMaximumHeight(self.screen_height)
64
+ #
65
+ # self.setSizePolicy(
66
+ # QtWidgets.QSizePolicy.Maximum,
67
+ # QtWidgets.QSizePolicy.Maximum)
68
+ #
69
+ # self.setSizePolicy(
70
+ # QtWidgets.QSizePolicy.Minimum,
71
+ # QtWidgets.QSizePolicy.Minimum)
72
+ # self.setSizePolicy(
73
+ # QtWidgets.QSizePolicy.Expanding,
74
+ # QtWidgets.QSizePolicy.Expanding)
75
+
76
+ def instantiate(self):
77
+
78
+ logging.info("instantiate")
79
+ self.firstwindow = FirstWindow(
80
+ self,
81
+ night_mode=self.po.all['night_mode'])
82
+ self.insertWidget(0, self.firstwindow)
83
+
84
+ self.instantiate_widgets()
85
+
86
+ self.thread = {}
87
+ self.thread['SaveAllVars'] = SaveAllVarsThread(self)
88
+ self.change_widget(0)
89
+ self.center()
90
+
91
+ def instantiate_widgets(self, severalfolder_included=True):
92
+ print("Widgets are instantiating")
93
+ # for widg_i in np.arange(1, 6):
94
+ # widget = self.widget(1)
95
+ # if widget is not None:
96
+ # self.removeWidget(widget)
97
+ # # widget.deleteLater()
98
+ if severalfolder_included:
99
+ self.ifseveralfolderswindow = IfSeveralFoldersWindow(self, night_mode=self.po.all['night_mode'])
100
+ self.insertWidget(1, self.ifseveralfolderswindow)
101
+ # self.ifseveralfolderswindow.setVisible(True)
102
+ self.imageanalysiswindow = ImageAnalysisWindow(self, night_mode=self.po.all['night_mode'])
103
+ self.insertWidget(2, self.imageanalysiswindow)
104
+
105
+ self.videoanalysiswindow = VideoAnalysisWindow(self, night_mode=self.po.all['night_mode'])
106
+ self.insertWidget(3, self.videoanalysiswindow)
107
+
108
+ self.requiredoutputwindow = RequiredOutput(self, night_mode=self.po.all['night_mode'])
109
+ self.insertWidget(4, self.requiredoutputwindow)
110
+
111
+ self.advancedparameterswindow = AdvancedParameters(self, night_mode=self.po.all['night_mode'])
112
+ self.insertWidget(5, self.advancedparameterswindow)
113
+
114
+ # self.requiredoutputwindow = RequiredOutput(
115
+ # self, night_mode=self.po.all['night_mode'])
116
+ # self.insertWidget(4, self.requiredoutputwindow)
117
+ #
118
+ # self.advancedparameterswindow = AdvancedParameters(
119
+ # self, night_mode=self.po.all['night_mode'])
120
+ # self.insertWidget(5, self.requiredoutputwindow)
121
+
122
+
123
+ def update_widget(self, idx, widget_to_call):
124
+ """ Update widget at its position (idx) in the stack """
125
+ self.insertWidget(idx, widget_to_call)
126
+
127
+ def change_widget(self, idx):
128
+ """ Display a widget using its position (idx) in the stack """
129
+ self.setCurrentIndex(idx) # Index that new widget
130
+ self.updateGeometry()
131
+ self.currentWidget().setVisible(True)
132
+ if idx == 3 or idx == 5:
133
+ self.currentWidget().display_conditionally_visible_widgets()
134
+
135
+ def center(self):
136
+ qr = self.frameGeometry()
137
+ # cp = QtWidgets.QDesktopWidget().availableGeometry().center() # PyQt 5
138
+ cp = QtGui.QGuiApplication.primaryScreen().availableGeometry().center() # Pyside 6
139
+ qr.moveCenter(cp)
140
+ self.move(qr.topLeft())
141
+
142
+ def closeEvent(self, event):
143
+ reply = QtWidgets.QMessageBox.question(
144
+ self,
145
+ 'Closing Cellects',
146
+ 'Are you sure you want to exit?',
147
+ QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
148
+ QtWidgets.QMessageBox.No)
149
+
150
+ if reply == QtWidgets.QMessageBox.Yes:
151
+ signal.signal(signal.SIGSEGV, signal.SIG_IGN)
152
+ logging.info("Closing main window.")
153
+ event.accept()
154
+ # QtWidgets.QApplication.quit()
155
+ self.close()
156
+ else:
157
+ event.ignore()
158
+ # self.hide()
159
+
160
+ # def update_all_settings(self):
161
+ # self.firstwindow
162
+ # self.imageanalysiswindow
163
+ # self.videoanalysiswindow
164
+ # requiredoutputwindow = self.widget(4)
165
+ # advancedparameterswindow = self.widget(5)
166
+
167
+
168
+
169
+ """
170
+ Ajouter
171
+ are_gravity_centers_moving
172
+ Retirer advanced mode de third widget
173
+ Inverser gauche et droite de third widget
174
+
175
+ drop_nak1 Réduction de la taille de la forme d'origine lors du passage de
176
+ luminosity_segmentation à luminosity_segmentation + gradient_segmentation
177
+
178
+ Catégories d'Advanced parameters:
179
+
180
+ - Spatio-temporal scales: time interval, timmings, convert,
181
+ - Analysis parameters: crop, subtract background
182
+ - Computer resources: Parallel, proc, ram,
183
+ - Video saving: fps, over unaltered, keep unaltered, save processed
184
+ - Special cases: correct error around initial shape, connect distant shape,
185
+ appearing size threshold, appearing detection method, oscillation period
186
+
187
+ if image_analysis is done:
188
+ get_average_pixel_size
189
+ """