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.
Files changed (38) hide show
  1. cellects/__main__.py +65 -25
  2. cellects/config/all_vars_dict.py +18 -17
  3. cellects/core/cellects_threads.py +1034 -396
  4. cellects/core/motion_analysis.py +1664 -2010
  5. cellects/core/one_image_analysis.py +1082 -1061
  6. cellects/core/program_organizer.py +1687 -1316
  7. cellects/core/script_based_run.py +80 -76
  8. cellects/gui/advanced_parameters.py +365 -326
  9. cellects/gui/cellects.py +102 -91
  10. cellects/gui/custom_widgets.py +4 -3
  11. cellects/gui/first_window.py +226 -104
  12. cellects/gui/if_several_folders_window.py +117 -68
  13. cellects/gui/image_analysis_window.py +841 -450
  14. cellects/gui/required_output.py +100 -56
  15. cellects/gui/ui_strings.py +840 -0
  16. cellects/gui/video_analysis_window.py +317 -135
  17. cellects/image_analysis/cell_leaving_detection.py +64 -4
  18. cellects/image_analysis/image_segmentation.py +451 -22
  19. cellects/image_analysis/morphological_operations.py +2166 -1635
  20. cellects/image_analysis/network_functions.py +616 -253
  21. cellects/image_analysis/one_image_analysis_threads.py +94 -153
  22. cellects/image_analysis/oscillations_functions.py +131 -0
  23. cellects/image_analysis/progressively_add_distant_shapes.py +2 -3
  24. cellects/image_analysis/shape_descriptors.py +517 -466
  25. cellects/utils/formulas.py +169 -6
  26. cellects/utils/load_display_save.py +362 -105
  27. cellects/utils/utilitarian.py +86 -9
  28. cellects-0.2.6.dist-info/LICENSE +675 -0
  29. cellects-0.2.6.dist-info/METADATA +829 -0
  30. cellects-0.2.6.dist-info/RECORD +44 -0
  31. cellects/core/one_video_per_blob.py +0 -540
  32. cellects/image_analysis/cluster_flux_study.py +0 -102
  33. cellects-0.1.3.dist-info/LICENSE.odt +0 -0
  34. cellects-0.1.3.dist-info/METADATA +0 -176
  35. cellects-0.1.3.dist-info/RECORD +0 -44
  36. {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/WHEEL +0 -0
  37. {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/entry_points.txt +0 -0
  38. {cellects-0.1.3.dist-info → cellects-0.2.6.dist-info}/top_level.txt +0 -0
cellects/__main__.py CHANGED
@@ -1,23 +1,45 @@
1
1
  #!/usr/bin/env python3
2
- """Launcher of cellects software.
2
+ """
3
+ Launcher for the Cellects software.
4
+
5
+ This module initializes logging configuration, creates the Qt application instance,
6
+ loads Cellects icon, and launches the main GUI interface.
7
+ """
3
8
 
4
- """
5
- import logging
6
9
  import sys
10
+ import logging
7
11
  import coloredlogs
8
12
  from PySide6 import QtWidgets, QtGui
9
13
  from cellects.core.cellects_paths import ICONS_DIR
10
14
 
11
- # These two lines allow the taskbar icon to be cellects_icon instead if python icon.
12
15
  if sys.platform.startswith('win'):
13
- import ctypes
14
- ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('company.app.1')
15
-
16
+ try:
17
+ import ctypes
18
+ ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('company.app.1')
19
+ except Exception as e:
20
+ logging.getLogger(__name__).debug(f"Windows taskbar icon setup failed: {e}")
16
21
 
17
- LOGLEVEL = "INFO" #"DEBUG"
22
+ LOGLEVEL = "INFO" # Set to DEBUG for development
18
23
 
19
24
  def _initialize_coloredlogs(loglevel: str = 'DEBUG') -> None:
20
- """Initialize logging parameters with coloredlogs library."""
25
+
26
+ """Initialize colored console logging with custom format.
27
+
28
+ Parameters
29
+ ----------
30
+ loglevel : str, optional
31
+ Logging threshold level (default is DEBUG). Accepts standard Python
32
+ logging level strings like 'DEBUG', 'INFO', or 'WARNING'.
33
+
34
+ Notes
35
+ -----
36
+ This function must be called before any other logging setup to ensure proper
37
+ configuration of colored output.
38
+ """
39
+ # Configure basic logging before applying colored logs
40
+ logging.basicConfig(level=loglevel)
41
+
42
+ # Apply colored formatting to the root logger
21
43
  coloredlogs.install(
22
44
  logger=logging.basicConfig(),
23
45
  level=loglevel,
@@ -26,23 +48,41 @@ def _initialize_coloredlogs(loglevel: str = 'DEBUG') -> None:
26
48
 
27
49
 
28
50
  def run_cellects():
29
- """Entry point of cellects software."""
51
+ """Run the Cellects application entry point.
52
+
53
+ This function initializes the Qt application, loads platform-specific icons,
54
+ creates and displays the main window widget, then starts the event loop.
55
+
56
+ Raises
57
+ ------
58
+ ImportError
59
+ If required GUI components cannot be loaded
60
+ """
30
61
  _initialize_coloredlogs(LOGLEVEL)
31
- from cellects.gui.cellects import CellectsMainWidget
32
- app = QtWidgets.QApplication([])
33
-
34
- # Add the icon file to the app
35
- icon = QtGui.QIcon()
36
- if sys.platform.startswith('win'):
37
- icon.addPixmap(QtGui.QPixmap(ICONS_DIR / "cellects_icon.ico"))
38
- else:
39
- icon.addPixmap(QtGui.QPixmap(ICONS_DIR / "cellects_icon.icns"))
40
- app.setWindowIcon(icon)
41
- # Start session
42
- session = CellectsMainWidget()
43
- session.instantiate()
44
- session.show()
45
- sys.exit(app.exec())
62
+
63
+ try:
64
+ from cellects.gui.cellects import CellectsMainWidget
65
+
66
+ # Initialize application
67
+ app = QtWidgets.QApplication([])
68
+
69
+ # Set custom window icon for taskbar (platform-specific handling)
70
+ icon = QtGui.QIcon()
71
+ platform_icon_path = (
72
+ ICONS_DIR / "cellects_icon.ico" if sys.platform.startswith('win')
73
+ else ICONS_DIR / "cellects_icon.icns"
74
+ )
75
+ icon.addPixmap(QtGui.QPixmap(str(platform_icon_path)))
76
+ app.setWindowIcon(icon)
77
+
78
+ # Create and display main window
79
+ session = CellectsMainWidget()
80
+ session.instantiate()
81
+ session.show()
82
+ sys.exit(app.exec())
83
+ except Exception as e:
84
+ logging.getLogger(__name__).critical("Application failed to start", exc_info=True)
85
+ raise
46
86
 
47
87
 
48
88
  if __name__ == "__main__":
@@ -41,7 +41,6 @@ class DefaultDicts:
41
41
  'extract_time_interval': True,
42
42
  'do_multiprocessing': False,
43
43
  'extension': '.tif',
44
- 'first_detection_frame': 1,
45
44
  'folder_number': 1,
46
45
  'first_folder_sample_number': 1,
47
46
  'first_move_threshold_in_mm²': 10,
@@ -64,11 +63,15 @@ class DefaultDicts:
64
63
  'set_spot_shape': True,
65
64
  'set_spot_size': True,
66
65
  'starting_blob_hsize_in_mm': 15,
67
- 'starting_blob_shape': None
66
+ 'starting_blob_shape': None,
67
+ 'auto_mesh_side_length': True,
68
+ 'auto_mesh_step_length': True,
69
+ 'auto_mesh_min_int_var': True,
68
70
  }
69
71
 
70
72
  self.vars = {
71
- 'analyzed_individuals': np.empty(0, dtype=np.uint16),
73
+ 'video_list': None,
74
+ 'analyzed_individuals': np.array([1], dtype=np.uint16),
72
75
  'arena_shape': 'rectangle', # 'circle',
73
76
  'bio_label': 1,
74
77
  'bio_label2': 1,
@@ -83,16 +86,19 @@ class DefaultDicts:
83
86
  'first_move_threshold': None,
84
87
  'img_number': 0,
85
88
  'iso_digi_analysis': True,
89
+ 'first_detection_frame': 0,
86
90
  'luminosity_threshold': 127,
87
91
  'max_size_for_connection': 300,
88
92
  'min_size_for_connection': 20,
89
93
  'origin_state': 'fluctuating',
90
94
  'oscilacyto_analysis': False,
91
- 'network_analysis': False,
92
- 'graph_extraction': False,
93
- 'network_detection_threshold': 20,
94
- 'network_mesh_side_length': 8,
95
- 'network_mesh_step_length': 2,
95
+
96
+ 'rolling_window_segmentation': {'do': False, 'side_len': None, 'step': None, 'min_int_var': None},
97
+ 'grid_segmentation': False,
98
+ 'mesh_side_length': 4,
99
+ 'mesh_step_length': 2,
100
+ 'mesh_min_int_var': 20,
101
+
96
102
  'fractal_analysis': False,
97
103
  'fractal_box_side_threshold': 32,
98
104
  'fractal_zoom_step': 0,
@@ -115,11 +121,12 @@ class DefaultDicts:
115
121
  'maximal_growth_factor': 0.05,
116
122
  'min_ram_free': 0.87,
117
123
  'expected_oscillation_period': 2, # (min)
118
- 'minimal_oscillating_cluster_size': 10, # (pixels)
124
+ 'minimal_oscillating_cluster_size': 50, # (pixels)
119
125
  'output_in_mm': True,
120
126
  'save_processed_videos': True,
121
127
  'several_blob_per_arena': False,
122
128
  'time_step': 1,
129
+ 'time_step_is_arbitrary': True,
123
130
  'true_if_use_light_AND_slope_else_OR': False,
124
131
  'do_fading': False,
125
132
  'fading': 0,
@@ -128,13 +135,12 @@ class DefaultDicts:
128
135
  'exif': [],
129
136
  'lose_accuracy_to_save_memory': True,
130
137
  'save_coord_specimen': False,
131
- 'save_coord_contour': False,
138
+ 'save_graph': False,
132
139
  'save_coord_thickening_slimming': False,
133
140
  'save_coord_network': False,
134
- 'grid_segmentation': False,
135
141
  # Data stored during analysis:
136
142
  'descriptors': descriptors,
137
- 'filter_spec': {'filter1_type': "", 'filter1_param': [1., 1.], 'filter2_type': "", 'filter2_param': [1., 1.]},
143
+ 'filter_spec': {'filter1_type': "", 'filter1_param': [.5, 1.], 'filter2_type': "", 'filter2_param': [.5, 1.]},
138
144
  }
139
145
 
140
146
  def save_as_pkl(self, po=None):
@@ -148,8 +154,3 @@ class DefaultDicts:
148
154
  po.all = self.all
149
155
  po.vars = self.vars
150
156
  po.save_variable_dict()
151
-
152
-
153
-
154
- if __name__ == "__main__":
155
- DefaultDicts().save_as_pkl()