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
@@ -1,102 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- This script contains the class for studying oscillating clusters on videos in 2D
4
- """
5
- import cv2
6
- import numpy as np
7
- from numpy import (
8
- append, float32, sum, mean, zeros, empty, array, nonzero, unique,
9
- isin, logical_or, logical_not, greater, uint8,
10
- uint32, min, any, zeros)
11
- from cellects.image_analysis.morphological_operations import cross_33, get_minimal_distance_between_2_shapes
12
-
13
-
14
- class ClusterFluxStudy:
15
- """
16
-
17
- """
18
- def __init__(self, dims):
19
- self.dims = dims
20
-
21
- self.pixels_data = np.empty((4, 0), dtype=np.uint32)
22
- self.clusters_id = np.zeros(self.dims[1:], dtype=np.uint32)
23
- # self.alive_clusters_in_flux = np.empty(0, dtype=np.uint32)#list()
24
- self.cluster_total_number = 0
25
-
26
- def update_flux(self, t, contours, current_flux, period_tracking, clusters_final_data):
27
- # Save the data from pixels that are not anymore in efflux
28
- lost = np.greater(self.clusters_id > 0, current_flux > 0)
29
- # Some pixels of that cluster faded, save their data
30
- lost_data = np.nonzero(lost)
31
- lost_data = np.array((period_tracking[lost], # lost_coord[0], lost_coord[1],
32
- self.clusters_id[lost], lost_data[0], lost_data[1]), dtype=np.uint32)
33
- # Add this to the array containing the data of each cluster that are still alive
34
- self.pixels_data = np.append(self.pixels_data, lost_data, axis=1)
35
- # Stop considering these pixels in period_tracking because they switched
36
- period_tracking[lost] = 0
37
- current_period_tracking = np.zeros(self.dims[1:], dtype=bool)
38
- for curr_clust_id in np.unique(current_flux)[1:]:
39
- # Get all pixels that were in the same flux previously
40
- curr_clust = current_flux == curr_clust_id
41
- already = self.clusters_id * curr_clust
42
- new = np.greater(curr_clust, self.clusters_id > 0)
43
-
44
- if not np.any(already):
45
- # It is an entirely new cluster:
46
- cluster_pixels = new
47
- self.cluster_total_number += 1
48
- cluster_name = self.cluster_total_number
49
- else:
50
- # Check whether parts of that cluster correspond to several clusters in clusters_id
51
- cluster_names = np.unique(already)[1:]
52
- # keep only one cluster name to gather clusters that just became connected
53
- cluster_name = np.min(cluster_names)
54
- # Put the same cluster name for new ones and every pixels that were
55
- # a part of a cluster touching the current cluster
56
- cluster_pixels = np.logical_or(np.isin(self.clusters_id, cluster_names), new)
57
- # If they are more than one,
58
- if len(cluster_names) > 1:
59
- # Update these cluster names in pixels_data
60
- self.pixels_data[1, np.isin(self.pixels_data[1, :], cluster_names)] = cluster_name
61
- # Update clusters_id
62
- self.clusters_id[cluster_pixels] = cluster_name
63
- # Update period_tracking
64
- current_period_tracking[curr_clust] = True
65
-
66
- period_tracking[current_period_tracking] += 1
67
- # Remove lost pixels from clusters_id
68
- self.clusters_id[lost] = 0
69
- # Find out which clusters are still alive or not
70
- still_alive_clusters = np.isin(self.pixels_data[1, :], np.unique(self.clusters_id))
71
- clusters_to_archive = np.unique(self.pixels_data[1, np.logical_not(still_alive_clusters)])
72
- # store their data in clusters_final_data
73
- clusters_data = np.zeros((len(clusters_to_archive), 6), dtype=np.float32)
74
- for clust_i, cluster in enumerate(clusters_to_archive):
75
- cluster_bool = self.pixels_data[1, :] == cluster
76
- cluster_size = np.sum(cluster_bool)
77
- cluster_img = np.zeros(self.dims[1:], dtype=np.uint8)
78
- cluster_img[self.pixels_data[2, cluster_bool], self.pixels_data[3, cluster_bool]] = 1
79
- nb, im, stats, centro = cv2.connectedComponentsWithStats(cluster_img)
80
- if np.any(cv2.dilate(cluster_img, kernel=cross_33, borderType=cv2.BORDER_CONSTANT, borderValue=0) * contours):
81
- minimal_distance = 1
82
- else:
83
- if cluster_size > 200:
84
-
85
- eroded_cluster_img = cv2.erode(cluster_img, cross_33)
86
- cluster_img = np.nonzero(cluster_img - eroded_cluster_img)
87
- contours[cluster_img] = 2
88
- else:
89
- contours[self.pixels_data[2, cluster_bool], self.pixels_data[3, cluster_bool]] = 2
90
- # Get the minimal distance between the border of the cell(s) (noted 1 in contours)
91
- # and the border of the cluster in the cell(s) (now noted 2 in contours)
92
- minimal_distance = get_minimal_distance_between_2_shapes(contours)
93
- data_to_save = np.array([[np.mean(self.pixels_data[0, cluster_bool]), t,
94
- cluster_size, minimal_distance, centro[1, 0], centro[1, 1]]], dtype=np.float32)
95
- clusters_data[clust_i,:] = data_to_save
96
- # and remove their data from pixels_data
97
- clusters_final_data = np.append(clusters_final_data, clusters_data, axis=0)
98
- self.pixels_data = self.pixels_data[:, still_alive_clusters]
99
-
100
- return period_tracking, clusters_final_data
101
-
102
-
Binary file
@@ -1,176 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: cellects
3
- Version: 0.1.3
4
- Summary: Cell Expansion Computer Tracking Software.
5
- Author: Aurèle Boussard
6
- Project-URL: Homepage, https://github.com/Aurele-B/Cellects
7
- Project-URL: Issues, https://github.com/Aurele-B/Cellects/issues
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: <3.14,>=3.11
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE.odt
14
- Requires-Dist: coloredlogs
15
- Requires-Dist: exif
16
- Requires-Dist: ExifRead
17
- Requires-Dist: numba
18
- Requires-Dist: opencv-python
19
- Requires-Dist: pandas
20
- Requires-Dist: psutil
21
- Requires-Dist: PySide6>=6.5
22
- Requires-Dist: scipy
23
- Requires-Dist: screeninfo
24
- Requires-Dist: numpy>=1.26
25
- Requires-Dist: scikit-image
26
- Requires-Dist: tqdm
27
- Requires-Dist: h5py
28
- Requires-Dist: matplotlib
29
- Requires-Dist: natsort
30
- Provides-Extra: test
31
- Requires-Dist: pytest; extra == "test"
32
- Requires-Dist: pytest-env; extra == "test"
33
- Requires-Dist: pytest-cov; extra == "test"
34
- Provides-Extra: doc
35
- Requires-Dist: mkdocs; extra == "doc"
36
- Requires-Dist: mkdocs-material; extra == "doc"
37
- Requires-Dist: pymdown-extensions; extra == "doc"
38
-
39
- Cellects: Cell Expansion Computer Tracking Software
40
- ===================================================
41
-
42
- Description
43
- -----------
44
-
45
- Cellects is a tracking software for organisms whose shape and size change over time.
46
- Cellects’ main strengths are its broad scope of action,
47
- automated computation of a variety of geometrical descriptors, easy installation and user-friendly interface.
48
-
49
-
50
- ---
51
- ## Quick Start
52
- ### 1. With Cellects_installer.exe (windows)
53
- - Download [Cellects_installer.exe](https://drive.google.com/file/d/1v2ppaln0LJ5QhXXq1D-zduhfun5D2ZXX/view?usp=drive_link)
54
- - Double-click on the Cellects_installer.exe file to start installation
55
- Note 1: Windows may warn you that it's unsafe; that's normal, because we are not a registered developer. Click "More info" and "Run Anyway".
56
- Note 2: For the same reason, some antivirus software can prevent installation.
57
-
58
- - To run Cellects, explore the newly created folder to find and execute Cellects.exe
59
- <br />
60
-
61
- ### 2. Using pip (Mac, Windows or Linux)
62
- - Install [python 3.13](https://www.python.org/downloads/release/python-3139/)
63
-
64
- - Best practice(optional): create and activate a python environment
65
- Use a terminal to create the environment:
66
- ```bash
67
- cd path/toward/an/existing/folder/
68
- python -m venv ./cellects_env
69
- ```
70
- Activation on Windows:
71
- ```bash
72
- cellects_env\Scripts\activate
73
- ```
74
- Activation on Unix or MacOS:
75
- ```bash
76
- source cellects_env/bin/activate
77
- ```
78
-
79
- - Installation:
80
- ```bash
81
- pip install cellects
82
- ```
83
-
84
- - Run Cellects:
85
- ```bash
86
- Cellects
87
- ```
88
-
89
- To uninstall, use:
90
- ```bash
91
- pip uninstall cellects
92
- ```
93
- Note: creating a python environment avoids compatibilities issues with other python scripts.
94
- However, the user have to activate this environment every time before running Cellects.
95
-
96
- ### 3. To access the source code (Mac, Windows or Linux)
97
- - Install [python 3.13](https://www.python.org/downloads/release/python-3139/)
98
- - Install [git](https://git-scm.com/downloads)
99
- - On Mac: also install [brew](https://brew.sh/)
100
- - Choose a place to install Cellects and use a terminal to write:
101
- ```bash
102
- cd path/toward/an/existing/folder/
103
- ```
104
- Note: The repository will be cloned to that folder; if updating an existing project, use a different folder name and rename it after verifying the new version.
105
- - Clone [Cellects repository](https://github.com/Aurele-B/Cellects.git) in terminal (or any IDE) with:
106
- ```bash
107
- git clone https://github.com/Aurele-B/Cellects.git
108
- cd ./Cellects
109
- pip install --upgrade pip
110
- python -m venv ./cellects_env
111
- ```
112
- On Windows, run:
113
- ```bash
114
- cellects_env\Scripts\activate
115
- ```
116
- On Unix or MacOS, run:
117
- ```bash
118
- source cellects_env/bin/activate
119
- ```
120
- Install Cellects dependencies in editable mode:
121
- ```bash
122
- pip install -e .
123
- ```
124
- Run Cellects:
125
- ```bash
126
- Cellects
127
- ```
128
-
129
- ## Developer Guide
130
-
131
- ### Run Tests
132
- Cellects uses `pytest` + `pytest-cov`.
133
- Install test dependencies:
134
-
135
- ```bash
136
- pip install -e ".[test]"
137
- ```
138
-
139
- Run the test suite (with coverage enabled by default via `pyproject.toml`):
140
-
141
- ```bash
142
- pytest
143
- ```
144
-
145
- You can access the coverage report with `coverage html` and open `htmlcov/index.html` in your browser.
146
-
147
- ```bash
148
- open htmlcov/index.html # macOS
149
- xdg-open htmlcov/index.html # Linux
150
- start htmlcov\index.html # Windows (PowerShell)
151
- ```
152
-
153
- Or explicitly:
154
- ```bash
155
- pytest --cov=src/cellects --cov-report=term-missing
156
- ```
157
-
158
- ### Build Documentation
159
- Install doc dependencies:
160
-
161
- ```bash
162
- pip install -e ".[doc]"
163
- ```
164
-
165
- Serve the docs locally:
166
- ```bash
167
- mkdocs serve
168
- ```
169
-
170
- Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser.
171
-
172
- ---
173
-
174
- ## Resources
175
- - [User manual](https://github.com/Aurele-B/Cellects/blob/main/_old_doc/UserManual.md)
176
- - [Usage example (video)](https://www.youtube.com/watch?v=N-k4p_aSPC0)
@@ -1,44 +0,0 @@
1
- cellects/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cellects/__main__.py,sha256=qiUkIOuyq3RuyHmYZM3drRbqe5DWP7IVyOGsEy425Lc,1449
3
- cellects/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- cellects/config/all_vars_dict.py,sha256=jcmYUeTiVtEkvIbZAYIASP5oCNiM909YQhaRHCY9y-U,6103
5
- cellects/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- cellects/core/cellects_paths.py,sha256=vwFEYXVAD16w0euoTuJ8Ca0tUyelsoiDNmWqryU5k-k,880
7
- cellects/core/cellects_threads.py,sha256=St1bAZTWdsrAYu1DBUyOwWSUJv5sellfaNVF3W14LfQ,88336
8
- cellects/core/motion_analysis.py,sha256=7_fohdeRBFRbJot3g14E6gh58TP9muE4O5fuePqr84A,141997
9
- cellects/core/one_image_analysis.py,sha256=hU9pa0coVA5s_CTiKgn4najlb8J3LQgEIocXCMi_4nM,68583
10
- cellects/core/one_video_per_blob.py,sha256=8YKttLdf0gNO3yASdhvAdo-GEh9btDkXrzku7f-t4h0,35536
11
- cellects/core/program_organizer.py,sha256=gRA3RLdj5i9wPzbqooHd6NoLkPYon5o57HaA7u1d0zQ,77988
12
- cellects/core/script_based_run.py,sha256=Y9FuJ2I5I3_T6vwAQ6w22vdGbkxmjLVAdDWPyoziVGU,6565
13
- cellects/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- cellects/gui/advanced_parameters.py,sha256=-xWA1_BqpG6yf7yMhbcFfiS2SoWj0iiHFYqlP4WlC8k,80164
15
- cellects/gui/cellects.py,sha256=qgHLvrAVR1YatSsuOBl5u7aXCUqVHEbhse7EFkTINOA,7574
16
- cellects/gui/custom_widgets.py,sha256=e5vf-yJpuh-gys76h7gjTnA7llB8rKPuEBGYdzKqY-8,34219
17
- cellects/gui/first_window.py,sha256=wYQaA-VQFWp_YDjbCXl0e_PgD59-y8kUXRdD2tDelbQ,24803
18
- cellects/gui/if_several_folders_window.py,sha256=ixi6X4WDQ5CtunEPVFJWip8Sf5ba1Hk2t801lX5CNVk,12508
19
- cellects/gui/image_analysis_window.py,sha256=W5NA1lYEf6qgf8H37YaKhhtxwk1Svm2hsoySi7I8kXI,118197
20
- cellects/gui/required_output.py,sha256=mheZN-89DwglelLyr5AqScByptNajRQIE99-5bcfwdE,12213
21
- cellects/gui/video_analysis_window.py,sha256=yUfKB4_N88H8Uh2bqR_9ZRlTbtpKivpn5GcX8pPchuY,37967
22
- cellects/icons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- cellects/icons/cellects_icon.icns,sha256=3GM5rpVKUoy-gAYEee5gGPh9lQx9KZqh9iRqYCT83Aw,393392
24
- cellects/icons/cellects_icon.ico,sha256=Eqlci8zZ0zdsRh2kSQAu4aHAPbR2NEzSbJPgaRQNenI,208076
25
- cellects/image_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- cellects/image_analysis/cell_leaving_detection.py,sha256=f0wWTACMQASSdXpDtJGe7STJTj6xs1UO1JJzI2FgDBk,2951
27
- cellects/image_analysis/cluster_flux_study.py,sha256=lHKo2OFN_FvmyX9kP7ubRadTVVxuXDeuRWQuydvyAGQ,5496
28
- cellects/image_analysis/image_segmentation.py,sha256=g1UXEfb7UFAv0UzZOxFiMJ0rZb0wrnQ4dC69PSJk_NI,28184
29
- cellects/image_analysis/morphological_operations.py,sha256=a4_SWxk9lik6RZ-DmPrjnkqaV_LUt3h8ar4IQ_F_GTQ,67908
30
- cellects/image_analysis/network_functions.py,sha256=ahxbWWcq7AxXxelaoEALGqdTbWmDWumNWoUALF2MxoU,88545
31
- cellects/image_analysis/one_image_analysis_threads.py,sha256=AjAEbJmtldlf23UxWs5my7xz2NIYy3wm25o13pnnYq8,17253
32
- cellects/image_analysis/progressively_add_distant_shapes.py,sha256=GuTfU57A6JweJHa9dpv7dTVoLX3n2fY6EL9Ul_ukBqU,25799
33
- cellects/image_analysis/shape_descriptors.py,sha256=8E36-A6hdgJLnj0jVj9_flFDCe2-DBCgpvjNNycyF2I,36546
34
- cellects/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- cellects/utils/decorators.py,sha256=kjZWSK71l5-LrrH7BZHb0kdFaAikC_qZu14_KjIUCms,361
36
- cellects/utils/formulas.py,sha256=Blw_dgYXb3sbxadONvHUUPoC6qlEVC1NJPMnEimNIxo,20397
37
- cellects/utils/load_display_save.py,sha256=FMp9NA4sbwiJ2uQcj2p98uxDLMOt7tyf57klHXr5EFM,38213
38
- cellects/utils/utilitarian.py,sha256=hdCN6PP0z25N-JCElEcGdTzIjyKVG_TYl3BiFmZ2a2k,17248
39
- cellects-0.1.3.dist-info/LICENSE.odt,sha256=tvKfCylOEuclQm5zOnNWBx0Fp4n7M5yqSmTr6SAekbY,37132
40
- cellects-0.1.3.dist-info/METADATA,sha256=lTFwu0sRHFhtBKTDpvA9MYQGHSZL8UReisMfcSl_EoI,4873
41
- cellects-0.1.3.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
42
- cellects-0.1.3.dist-info/entry_points.txt,sha256=JT6rEvKpUuKyDPvfOYma-IMQNvfnKMstFMAoVJhXIGc,60
43
- cellects-0.1.3.dist-info/top_level.txt,sha256=8VlvCH4ka3bqugIpQnOVjc3UV9Vavfx5SXNyUV9_lGw,9
44
- cellects-0.1.3.dist-info/RECORD,,