cellects 0.1.2__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/__init__.py +0 -0
- cellects/__main__.py +49 -0
- cellects/config/__init__.py +0 -0
- cellects/config/all_vars_dict.py +155 -0
- cellects/core/__init__.py +0 -0
- cellects/core/cellects_paths.py +31 -0
- cellects/core/cellects_threads.py +1451 -0
- cellects/core/motion_analysis.py +2010 -0
- cellects/core/one_image_analysis.py +1061 -0
- cellects/core/one_video_per_blob.py +540 -0
- cellects/core/program_organizer.py +1316 -0
- cellects/core/script_based_run.py +154 -0
- cellects/gui/__init__.py +0 -0
- cellects/gui/advanced_parameters.py +1258 -0
- cellects/gui/cellects.py +189 -0
- cellects/gui/custom_widgets.py +790 -0
- cellects/gui/first_window.py +449 -0
- cellects/gui/if_several_folders_window.py +239 -0
- cellects/gui/image_analysis_window.py +2066 -0
- cellects/gui/required_output.py +232 -0
- cellects/gui/video_analysis_window.py +656 -0
- cellects/icons/__init__.py +0 -0
- cellects/icons/cellects_icon.icns +0 -0
- cellects/icons/cellects_icon.ico +0 -0
- cellects/image_analysis/__init__.py +0 -0
- cellects/image_analysis/cell_leaving_detection.py +54 -0
- cellects/image_analysis/cluster_flux_study.py +102 -0
- cellects/image_analysis/image_segmentation.py +706 -0
- cellects/image_analysis/morphological_operations.py +1635 -0
- cellects/image_analysis/network_functions.py +1757 -0
- cellects/image_analysis/one_image_analysis_threads.py +289 -0
- cellects/image_analysis/progressively_add_distant_shapes.py +508 -0
- cellects/image_analysis/shape_descriptors.py +1016 -0
- cellects/utils/__init__.py +0 -0
- cellects/utils/decorators.py +14 -0
- cellects/utils/formulas.py +637 -0
- cellects/utils/load_display_save.py +1054 -0
- cellects/utils/utilitarian.py +490 -0
- cellects-0.1.2.dist-info/LICENSE.odt +0 -0
- cellects-0.1.2.dist-info/METADATA +132 -0
- cellects-0.1.2.dist-info/RECORD +44 -0
- cellects-0.1.2.dist-info/WHEEL +5 -0
- cellects-0.1.2.dist-info/entry_points.txt +2 -0
- cellects-0.1.2.dist-info/top_level.txt +1 -0
cellects/gui/cellects.py
ADDED
|
@@ -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
|
+
"""
|