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.
- cellects/__init__.py +0 -0
- cellects/__main__.py +49 -0
- cellects/config/__init__.py +0 -0
- cellects/config/all_vars_dict.py +154 -0
- cellects/core/__init__.py +0 -0
- cellects/core/cellects_paths.py +30 -0
- cellects/core/cellects_threads.py +1464 -0
- cellects/core/motion_analysis.py +1931 -0
- cellects/core/one_image_analysis.py +1065 -0
- cellects/core/one_video_per_blob.py +679 -0
- cellects/core/program_organizer.py +1347 -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 +789 -0
- cellects/gui/first_window.py +449 -0
- cellects/gui/if_several_folders_window.py +239 -0
- cellects/gui/image_analysis_window.py +1909 -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/extract_exif.py +61 -0
- cellects/image_analysis/fractal_analysis.py +184 -0
- cellects/image_analysis/fractal_functions.py +108 -0
- cellects/image_analysis/image_segmentation.py +272 -0
- cellects/image_analysis/morphological_operations.py +867 -0
- cellects/image_analysis/network_functions.py +1244 -0
- cellects/image_analysis/one_image_analysis_threads.py +289 -0
- cellects/image_analysis/progressively_add_distant_shapes.py +246 -0
- cellects/image_analysis/shape_descriptors.py +981 -0
- cellects/utils/__init__.py +0 -0
- cellects/utils/formulas.py +881 -0
- cellects/utils/load_display_save.py +1016 -0
- cellects/utils/utilitarian.py +516 -0
- cellects-0.1.0.dev1.dist-info/LICENSE.odt +0 -0
- cellects-0.1.0.dev1.dist-info/METADATA +131 -0
- cellects-0.1.0.dev1.dist-info/RECORD +46 -0
- cellects-0.1.0.dev1.dist-info/WHEEL +5 -0
- cellects-0.1.0.dev1.dist-info/entry_points.txt +2 -0
- cellects-0.1.0.dev1.dist-info/top_level.txt +1 -0
cellects/__init__.py
ADDED
|
File without changes
|
cellects/__main__.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Launcher of cellects software.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
import logging
|
|
6
|
+
import sys
|
|
7
|
+
import coloredlogs
|
|
8
|
+
from PySide6 import QtWidgets, QtGui
|
|
9
|
+
from cellects.core.cellects_paths import ICONS_DIR
|
|
10
|
+
|
|
11
|
+
# These two lines allow the taskbar icon to be cellects_icon instead if python icon.
|
|
12
|
+
if sys.platform.startswith('win'):
|
|
13
|
+
import ctypes
|
|
14
|
+
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('company.app.1')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
LOGLEVEL = "INFO" #"DEBUG"
|
|
18
|
+
|
|
19
|
+
def _initialize_coloredlogs(loglevel: str = 'DEBUG') -> None:
|
|
20
|
+
"""Initialize logging parameters with coloredlogs library."""
|
|
21
|
+
coloredlogs.install(
|
|
22
|
+
logger=logging.basicConfig(),
|
|
23
|
+
level=loglevel,
|
|
24
|
+
fmt='[%(asctime)s] [%(levelname)s] %(message)s',
|
|
25
|
+
datefmt='%H:%M:%S')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def run_cellects():
|
|
29
|
+
"""Entry point of cellects software."""
|
|
30
|
+
_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())
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
run_cellects()
|
|
File without changes
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
This script generates the default parameters of the GUI of Cellects.
|
|
4
|
+
It can be used to write these parameters in a file named all_vars_dict.
|
|
5
|
+
Then, the gui updates this file as users adjust the GUI parameters.
|
|
6
|
+
These parameters are stored in a dictionary with keys corresponding to the parameter's name and values to its tunable
|
|
7
|
+
value.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
from cellects.image_analysis.shape_descriptors import descriptors_categories, descriptors
|
|
12
|
+
import numpy as np
|
|
13
|
+
from cellects.core.cellects_paths import ALL_VARS_PKL_FILE
|
|
14
|
+
from cellects.utils.load_display_save import PickleRick
|
|
15
|
+
from cellects.core.cellects_paths import TEST_DIR
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class DefaultDicts:
|
|
19
|
+
def __init__(self):
|
|
20
|
+
# po.load_variable_dict()
|
|
21
|
+
self.all = {
|
|
22
|
+
# Interface settings:
|
|
23
|
+
'compute_all_options': True,
|
|
24
|
+
'expert_mode': False,
|
|
25
|
+
'is_auto': False,
|
|
26
|
+
'night_mode': False,
|
|
27
|
+
'arena': 1,
|
|
28
|
+
'video_option': 0,
|
|
29
|
+
|
|
30
|
+
# Analysis settings:
|
|
31
|
+
'are_gravity_centers_moving': 0,
|
|
32
|
+
'are_zigzag': 'columns',
|
|
33
|
+
'automatic_size_thresholding': True,
|
|
34
|
+
'color_number': 2,
|
|
35
|
+
'cores': 1,
|
|
36
|
+
'automatically_crop': False,
|
|
37
|
+
'descriptors': descriptors_categories,
|
|
38
|
+
'display_shortcuts': False,
|
|
39
|
+
'connect_distant_shape_during_segmentation': False,
|
|
40
|
+
'all_specimens_have_same_direction': True,
|
|
41
|
+
'extract_time_interval': True,
|
|
42
|
+
'do_multiprocessing': False,
|
|
43
|
+
'extension': '.tif',
|
|
44
|
+
'first_detection_frame': 1,
|
|
45
|
+
'folder_number': 1,
|
|
46
|
+
'first_folder_sample_number': 1,
|
|
47
|
+
'first_move_threshold_in_mm²': 10,
|
|
48
|
+
'folder_list': [],
|
|
49
|
+
'global_pathway': str(TEST_DIR / "experiment"),
|
|
50
|
+
'im_or_vid': 0,
|
|
51
|
+
'image_horizontal_size_in_mm': 700,
|
|
52
|
+
'minimal_appearance_size': 10,
|
|
53
|
+
'more_than_two_colors': False,
|
|
54
|
+
'bio_mask': None,
|
|
55
|
+
'back_mask': None,
|
|
56
|
+
'keep_cell_and_back_for_all_folders': False,
|
|
57
|
+
|
|
58
|
+
# 'overwrite_cellects_data': True,
|
|
59
|
+
'overwrite_unaltered_videos': False,
|
|
60
|
+
'radical': 'im',
|
|
61
|
+
'raw_images': False,
|
|
62
|
+
'sample_number_per_folder': [1],
|
|
63
|
+
'scale_with_image_or_cells': 1,
|
|
64
|
+
'set_spot_shape': True,
|
|
65
|
+
'set_spot_size': True,
|
|
66
|
+
'starting_blob_hsize_in_mm': 15,
|
|
67
|
+
'starting_blob_shape': None
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
self.vars = {
|
|
71
|
+
'analyzed_individuals': np.empty(0, dtype=np.uint16),
|
|
72
|
+
'arena_shape': 'rectangle', # 'circle',
|
|
73
|
+
'bio_label': 1,
|
|
74
|
+
'bio_label2': 1,
|
|
75
|
+
'color_number': 2,
|
|
76
|
+
'convert_for_motion': {
|
|
77
|
+
'lab': np.array((0, 0, 1), np.int8),
|
|
78
|
+
'logical': 'None'},
|
|
79
|
+
'convert_for_origin': {
|
|
80
|
+
'lab': np.array((0, 0, 1), np.int8),
|
|
81
|
+
'logical': 'None'},
|
|
82
|
+
'detection_range_factor': 2,
|
|
83
|
+
'first_move_threshold': None,
|
|
84
|
+
'img_number': 0,
|
|
85
|
+
'iso_digi_analysis': True,
|
|
86
|
+
'luminosity_threshold': 127,
|
|
87
|
+
'max_size_for_connection': 300,
|
|
88
|
+
'min_size_for_connection': 20,
|
|
89
|
+
'origin_state': 'fluctuating',
|
|
90
|
+
'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,
|
|
96
|
+
'fractal_analysis': False,
|
|
97
|
+
'fractal_box_side_threshold': 32,
|
|
98
|
+
'fractal_zoom_step': 0,
|
|
99
|
+
'subtract_background': False,
|
|
100
|
+
'correct_errors_around_initial': False,
|
|
101
|
+
'prevent_fast_growth_near_periphery': False,
|
|
102
|
+
'periphery_width': 40,
|
|
103
|
+
'max_periphery_growth': 20,
|
|
104
|
+
# According to Smith and Saldana (1992),
|
|
105
|
+
# P. polycephalum shuttle streaming has a period of 100-200s
|
|
106
|
+
'already_greyscale': False,
|
|
107
|
+
'descriptors_in_long_format': True,
|
|
108
|
+
'do_slope_segmentation': False,
|
|
109
|
+
'do_threshold_segmentation': True,
|
|
110
|
+
'drift_already_corrected': False,
|
|
111
|
+
'appearance_detection_method': 'largest',
|
|
112
|
+
'frame_by_frame_segmentation': False,
|
|
113
|
+
'repeat_video_smoothing': 1,
|
|
114
|
+
'keep_unaltered_videos': False,
|
|
115
|
+
'maximal_growth_factor': 0.05,
|
|
116
|
+
'min_ram_free': 0.87,
|
|
117
|
+
'expected_oscillation_period': 2, # (min)
|
|
118
|
+
'minimal_oscillating_cluster_size': 10, # (pixels)
|
|
119
|
+
'output_in_mm': True,
|
|
120
|
+
'save_processed_videos': True,
|
|
121
|
+
'several_blob_per_arena': False,
|
|
122
|
+
'time_step': 1,
|
|
123
|
+
'true_if_use_light_AND_slope_else_OR': False,
|
|
124
|
+
'do_fading': False,
|
|
125
|
+
'fading': 0,
|
|
126
|
+
'video_fps': 60,
|
|
127
|
+
'videos_extension': '.mp4',
|
|
128
|
+
'exif': [],
|
|
129
|
+
'lose_accuracy_to_save_memory': True,
|
|
130
|
+
'save_coord_specimen': False,
|
|
131
|
+
'save_coord_contour': False,
|
|
132
|
+
'save_coord_thickening_slimming': False,
|
|
133
|
+
'save_coord_network': False,
|
|
134
|
+
'grid_segmentation': False,
|
|
135
|
+
# Data stored during analysis:
|
|
136
|
+
'descriptors': descriptors,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
def save_as_pkl(self, po=None):
|
|
140
|
+
if po is None:
|
|
141
|
+
if os.path.isfile('PickleRick0.pkl'):
|
|
142
|
+
os.remove('PickleRick0.pkl')
|
|
143
|
+
pickle_rick = PickleRick(0)
|
|
144
|
+
pickle_rick.write_file(self.all, ALL_VARS_PKL_FILE)
|
|
145
|
+
else:
|
|
146
|
+
po = po
|
|
147
|
+
po.all = self.all
|
|
148
|
+
po.vars = self.vars
|
|
149
|
+
po.save_variable_dict()
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
if __name__ == "__main__":
|
|
154
|
+
DefaultDicts().save_as_pkl()
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Generate the different paths used by cellects.
|
|
4
|
+
Adjust the path names according to the current position of the software.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
# Current file -> src/cellects/cellect_paths.py
|
|
11
|
+
CURR_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
|
|
12
|
+
CELLECTS_DIR = CURR_DIR.parent # = src/cellects
|
|
13
|
+
|
|
14
|
+
# Package-internal dirs
|
|
15
|
+
CONFIG_DIR = CELLECTS_DIR / "config"
|
|
16
|
+
CORE_DIR = CELLECTS_DIR / "core"
|
|
17
|
+
GUI_DIR = CELLECTS_DIR / "gui"
|
|
18
|
+
ICONS_DIR = CELLECTS_DIR / "icons"
|
|
19
|
+
IMAGE_ANALYSIS_DIR = CELLECTS_DIR / "image_analysis"
|
|
20
|
+
UTILS_DIR = CELLECTS_DIR / "utils"
|
|
21
|
+
|
|
22
|
+
# Repo root (src/..)
|
|
23
|
+
REPO_ROOT = CELLECTS_DIR.parent
|
|
24
|
+
|
|
25
|
+
# Repo-level dirs
|
|
26
|
+
DATA_DIR = REPO_ROOT / "data"
|
|
27
|
+
TEST_DIR = REPO_ROOT / "tests"
|
|
28
|
+
|
|
29
|
+
# Example packaged file
|
|
30
|
+
ALL_VARS_PKL_FILE = CONFIG_DIR / "all_vars.pkl"
|