cellfinder 1.3.0rc1__py3-none-any.whl → 1.3.1__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.
- cellfinder/__init__.py +1 -0
- cellfinder/core/classify/classify.py +8 -0
- cellfinder/core/classify/cube_generator.py +2 -2
- cellfinder/core/detect/filters/volume/structure_splitting.py +11 -5
- cellfinder/core/main.py +1 -1
- cellfinder/napari/curation.py +1 -1
- cellfinder/napari/detect/detect.py +8 -2
- cellfinder/napari/detect/detect_containers.py +2 -0
- cellfinder/napari/detect/thread_worker.py +2 -2
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/METADATA +12 -6
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/RECORD +15 -15
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/WHEEL +1 -1
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/LICENSE +0 -0
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/entry_points.txt +0 -0
- {cellfinder-1.3.0rc1.dist-info → cellfinder-1.3.1.dist-info}/top_level.txt +0 -0
cellfinder/__init__.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from datetime import datetime
|
|
2
3
|
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
3
4
|
|
|
4
5
|
import keras
|
|
@@ -50,6 +51,8 @@ def main(
|
|
|
50
51
|
# Too many workers doesn't increase speed, and uses huge amounts of RAM
|
|
51
52
|
workers = get_num_processes(min_free_cpu_cores=n_free_cpus)
|
|
52
53
|
|
|
54
|
+
start_time = datetime.now()
|
|
55
|
+
|
|
53
56
|
logger.debug("Initialising cube generator")
|
|
54
57
|
inference_generator = CubeGeneratorFromFile(
|
|
55
58
|
points,
|
|
@@ -90,6 +93,11 @@ def main(
|
|
|
90
93
|
cell.type = predictions[idx] + 1
|
|
91
94
|
points_list.append(cell)
|
|
92
95
|
|
|
96
|
+
time_elapsed = datetime.now() - start_time
|
|
97
|
+
print(
|
|
98
|
+
"Classfication complete - all points done in : {}".format(time_elapsed)
|
|
99
|
+
)
|
|
100
|
+
|
|
93
101
|
return points_list
|
|
94
102
|
|
|
95
103
|
|
|
@@ -40,7 +40,7 @@ class CubeGeneratorFromFile(Sequence):
|
|
|
40
40
|
background_array: types.array,
|
|
41
41
|
voxel_sizes: Tuple[int, int, int],
|
|
42
42
|
network_voxel_sizes: Tuple[int, int, int],
|
|
43
|
-
batch_size: int =
|
|
43
|
+
batch_size: int = 64,
|
|
44
44
|
cube_width: int = 50,
|
|
45
45
|
cube_height: int = 50,
|
|
46
46
|
cube_depth: int = 20,
|
|
@@ -345,7 +345,7 @@ class CubeGeneratorFromDisk(Sequence):
|
|
|
345
345
|
signal_list: List[Union[str, Path]],
|
|
346
346
|
background_list: List[Union[str, Path]],
|
|
347
347
|
labels: Optional[List[int]] = None, # only if training or validating
|
|
348
|
-
batch_size: int =
|
|
348
|
+
batch_size: int = 64,
|
|
349
349
|
shape: Tuple[int, int, int] = (50, 50, 20),
|
|
350
350
|
channels: int = 2,
|
|
351
351
|
classes: int = 2,
|
|
@@ -74,6 +74,7 @@ def ball_filter_imgs(
|
|
|
74
74
|
good_tiles_mask = np.ones((1, 1, volume.shape[2]), dtype=np.bool_)
|
|
75
75
|
|
|
76
76
|
plane_width, plane_height = volume.shape[:2]
|
|
77
|
+
current_z = ball_z_size // 2
|
|
77
78
|
|
|
78
79
|
bf = BallFilter(
|
|
79
80
|
plane_width,
|
|
@@ -86,9 +87,7 @@ def ball_filter_imgs(
|
|
|
86
87
|
threshold_value=threshold_value,
|
|
87
88
|
soma_centre_value=soma_centre_value,
|
|
88
89
|
)
|
|
89
|
-
cell_detector = CellDetector(
|
|
90
|
-
plane_width, plane_height, start_z=ball_z_size // 2
|
|
91
|
-
)
|
|
90
|
+
cell_detector = CellDetector(plane_width, plane_height, start_z=current_z)
|
|
92
91
|
|
|
93
92
|
# FIXME: hard coded type
|
|
94
93
|
ball_filtered_volume = np.zeros(volume.shape, dtype=np.uint32)
|
|
@@ -98,7 +97,11 @@ def ball_filter_imgs(
|
|
|
98
97
|
if bf.ready:
|
|
99
98
|
bf.walk()
|
|
100
99
|
middle_plane = bf.get_middle_plane()
|
|
101
|
-
|
|
100
|
+
|
|
101
|
+
# first valid middle plane is the current_z, not z
|
|
102
|
+
ball_filtered_volume[:, :, current_z] = middle_plane[:]
|
|
103
|
+
current_z += 1
|
|
104
|
+
|
|
102
105
|
# DEBUG: TEST: transpose
|
|
103
106
|
previous_plane = cell_detector.process(
|
|
104
107
|
middle_plane.copy(), previous_plane
|
|
@@ -134,7 +137,10 @@ def iterative_ball_filter(
|
|
|
134
137
|
vol, cell_centres = ball_filter_imgs(
|
|
135
138
|
vol, threshold_value, soma_centre_value
|
|
136
139
|
)
|
|
137
|
-
|
|
140
|
+
|
|
141
|
+
# vol is unsigned, so can't let zeros underflow to max value
|
|
142
|
+
vol[:, :, :] = np.where(vol != 0, vol - 1, 0)
|
|
143
|
+
|
|
138
144
|
n_structures = len(cell_centres)
|
|
139
145
|
ns.append(n_structures)
|
|
140
146
|
centres.append(cell_centres)
|
cellfinder/core/main.py
CHANGED
|
@@ -18,7 +18,7 @@ def main(
|
|
|
18
18
|
trained_model: Optional[os.PathLike] = None,
|
|
19
19
|
model_weights: Optional[os.PathLike] = None,
|
|
20
20
|
model: model_type = "resnet50_tv",
|
|
21
|
-
batch_size: int =
|
|
21
|
+
batch_size: int = 64,
|
|
22
22
|
n_free_cpus: int = 2,
|
|
23
23
|
network_voxel_sizes: Tuple[int, int, int] = (5, 1, 1),
|
|
24
24
|
soma_diameter: int = 16,
|
cellfinder/napari/curation.py
CHANGED
|
@@ -253,8 +253,9 @@ def detect_widget() -> FunctionGui:
|
|
|
253
253
|
max_cluster_size: int,
|
|
254
254
|
classification_options,
|
|
255
255
|
skip_classification: bool,
|
|
256
|
-
trained_model: Optional[Path],
|
|
257
256
|
use_pre_trained_weights: bool,
|
|
257
|
+
trained_model: Optional[Path],
|
|
258
|
+
batch_size: int,
|
|
258
259
|
misc_options,
|
|
259
260
|
start_plane: int,
|
|
260
261
|
end_plane: int,
|
|
@@ -298,6 +299,8 @@ def detect_widget() -> FunctionGui:
|
|
|
298
299
|
should be attempted
|
|
299
300
|
use_pre_trained_weights : bool
|
|
300
301
|
Select to use pre-trained model weights
|
|
302
|
+
batch_size : int
|
|
303
|
+
How many points to classify at one time
|
|
301
304
|
skip_classification : bool
|
|
302
305
|
If selected, the classification step is skipped and all cells from
|
|
303
306
|
the detection stage are added
|
|
@@ -372,7 +375,10 @@ def detect_widget() -> FunctionGui:
|
|
|
372
375
|
if use_pre_trained_weights:
|
|
373
376
|
trained_model = None
|
|
374
377
|
classification_inputs = ClassificationInputs(
|
|
375
|
-
skip_classification,
|
|
378
|
+
skip_classification,
|
|
379
|
+
use_pre_trained_weights,
|
|
380
|
+
trained_model,
|
|
381
|
+
batch_size,
|
|
376
382
|
)
|
|
377
383
|
|
|
378
384
|
if analyse_local:
|
|
@@ -114,6 +114,7 @@ class ClassificationInputs(InputContainer):
|
|
|
114
114
|
skip_classification: bool = False
|
|
115
115
|
use_pre_trained_weights: bool = True
|
|
116
116
|
trained_model: Optional[Path] = Path.home()
|
|
117
|
+
batch_size: int = 64
|
|
117
118
|
|
|
118
119
|
def as_core_arguments(self) -> dict:
|
|
119
120
|
args = super().as_core_arguments()
|
|
@@ -131,6 +132,7 @@ class ClassificationInputs(InputContainer):
|
|
|
131
132
|
skip_classification=dict(
|
|
132
133
|
value=cls.defaults()["skip_classification"]
|
|
133
134
|
),
|
|
135
|
+
batch_size=dict(value=cls.defaults()["batch_size"]),
|
|
134
136
|
)
|
|
135
137
|
|
|
136
138
|
|
|
@@ -72,10 +72,10 @@ class Worker(WorkerBase):
|
|
|
72
72
|
def classify_callback(batch: int) -> None:
|
|
73
73
|
self.update_progress_bar.emit(
|
|
74
74
|
"Classifying cells",
|
|
75
|
-
# Default cellfinder-core batch size is
|
|
75
|
+
# Default cellfinder-core batch size is 64. This seems to give
|
|
76
76
|
# a slight underestimate of the number of batches though, so
|
|
77
77
|
# allow for batch number to go over this
|
|
78
|
-
max(self.npoints_detected //
|
|
78
|
+
max(self.npoints_detected // 64 + 1, batch + 1),
|
|
79
79
|
batch + 1,
|
|
80
80
|
)
|
|
81
81
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cellfinder
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Automated 3D cell detection in large microscopy images
|
|
5
5
|
Author-email: "Adam Tyson, Christian Niedworok, Charly Rousseau" <code@adamltyson.com>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -16,11 +16,11 @@ Classifier: Intended Audience :: Science/Research
|
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
23
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: brainglobe-utils >=0.5.0
|
|
@@ -101,8 +101,14 @@ pip install cellfinder>=1.0.0
|
|
|
101
101
|
Be sure to specify a version greater than version `v1.0.0` - prior to this version the `cellfinder` package had a very different structure that is incompatible with BrainGlobe version 1 and the other tools in the BrainGlobe suite.
|
|
102
102
|
See [our blog posts](https://brainglobe.info/blog/) for more information on the release of BrainGlobe version 1.
|
|
103
103
|
|
|
104
|
-
##
|
|
104
|
+
## Seeking help or contributing
|
|
105
|
+
We are always happy to help users of our tools, and welcome any contributions. If you would like to get in contact with us for any reason, please see the [contact page of our website](https://brainglobe.info/contact.html).
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
## Citation
|
|
108
|
+
If you find this package useful, and use it in your research, please cite the following paper:
|
|
109
|
+
> Tyson, A. L., Rousseau, C. V., Niedworok, C. J., Keshavarzi, S., Tsitoura, C., Cossell, L., Strom, M. and Margrie, T. W. (2021) “A deep learning algorithm for 3D cell detection in whole mouse brain image datasets’ PLOS Computational Biology, 17(5), e1009074
|
|
110
|
+
[https://doi.org/10.1371/journal.pcbi.1009074](https://doi.org/10.1371/journal.pcbi.1009074)
|
|
107
111
|
|
|
108
|
-
If you
|
|
112
|
+
**If you use this, or any other tools in the brainglobe suite, please
|
|
113
|
+
[let us know](https://brainglobe.info/contact.html), and
|
|
114
|
+
we'd be happy to promote your paper/talk etc.**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
cellfinder/__init__.py,sha256=
|
|
1
|
+
cellfinder/__init__.py,sha256=S5oQ3EORuyQTMYC4uUuzGKZ23J3Ya6q-1DOBib1KfiA,1166
|
|
2
2
|
cellfinder/cli_migration_warning.py,sha256=gPtNrtnXvWpl5q0k_EGAQZg0DwcpCmuBTgpg56n5NfA,1578
|
|
3
3
|
cellfinder/core/__init__.py,sha256=pRFuQsl78HEK0S6gvhJw70QLbjjSBzP-GFO0AtVaGtk,62
|
|
4
|
-
cellfinder/core/main.py,sha256=
|
|
4
|
+
cellfinder/core/main.py,sha256=t2mkq6iieEytbPckehBB43juwN5E-vhzstLSs620vdM,3625
|
|
5
5
|
cellfinder/core/types.py,sha256=lTqWE4v0SMM0qLAZJdyAzqV1nLgDtobEpglNJcXt160,106
|
|
6
6
|
cellfinder/core/classify/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
cellfinder/core/classify/augment.py,sha256=8dMbM7KhimM6NMgdMC53oHoCfYj1CIB-h3Yk8CZAxPw,6321
|
|
8
|
-
cellfinder/core/classify/classify.py,sha256=
|
|
9
|
-
cellfinder/core/classify/cube_generator.py,sha256=
|
|
8
|
+
cellfinder/core/classify/classify.py,sha256=33ZvNDmgVabH_6p4jV9Xi8bLKwDZnVhzlImrL_TlnBk,3269
|
|
9
|
+
cellfinder/core/classify/cube_generator.py,sha256=jC5aogTVy213PHouViSR9CgKkuOks3yk6csQC5kRoOE,17125
|
|
10
10
|
cellfinder/core/classify/resnet.py,sha256=vGa85y_NcQnOXwAt5EtatLx5mrO8IoShCcNKtJ5-EFg,10034
|
|
11
11
|
cellfinder/core/classify/tools.py,sha256=s5PEKAsZVbVuoferZ_nqMUM0f2bV_8WEKsdKe3SXEuE,2560
|
|
12
12
|
cellfinder/core/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -22,7 +22,7 @@ cellfinder/core/detect/filters/plane/tile_walker.py,sha256=lhKrq-MB35bR0_JYgj7WM
|
|
|
22
22
|
cellfinder/core/detect/filters/volume/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
cellfinder/core/detect/filters/volume/ball_filter.py,sha256=ZEg8FNty-VD5N9j4FLZ18G-BuSvxjHs2-QTblwKcZgw,13894
|
|
24
24
|
cellfinder/core/detect/filters/volume/structure_detection.py,sha256=mTHi0_A9FCK39I6fZm2dfMpDxIkfaidOIf6eCjTw-70,11307
|
|
25
|
-
cellfinder/core/detect/filters/volume/structure_splitting.py,sha256=
|
|
25
|
+
cellfinder/core/detect/filters/volume/structure_splitting.py,sha256=DnYcCkcdEaubzaWxbM7Ee8icyHq3dN8CcvZj_i0QvGM,7880
|
|
26
26
|
cellfinder/core/detect/filters/volume/volume_filter.py,sha256=BJ8bStlNvMWsGlBekeqXpS8d9YKoLe3ifMfrEPpva2Q,7035
|
|
27
27
|
cellfinder/core/download/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
cellfinder/core/download/cli.py,sha256=X9L9ZIkWqs58hX8G8q_0AKN4gk8BhydGxI9nLpdHQQE,1764
|
|
@@ -39,21 +39,21 @@ cellfinder/core/tools/tools.py,sha256=G8oDGNRuWkzEJDnnC4r3SNGgpVbqbelCZR5ODk9JRz
|
|
|
39
39
|
cellfinder/core/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
40
|
cellfinder/core/train/train_yml.py,sha256=9QXv2wk24G8hYskMnBij7OngEELUWySK2fH4NFbYWw4,13260
|
|
41
41
|
cellfinder/napari/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
-
cellfinder/napari/curation.py,sha256=
|
|
42
|
+
cellfinder/napari/curation.py,sha256=nbxCwY2bhEPM15Wf3S_Ff8qGdLSWojr4X48mmAJqD3U,21447
|
|
43
43
|
cellfinder/napari/input_container.py,sha256=tkm0dkPt7kSL8Xkvs1fh8M6vKWw57QLIt_wv74HFkGk,2150
|
|
44
44
|
cellfinder/napari/napari.yaml,sha256=WMR1CIAmYIVyQngbdbomTRZLvlDbb6LxsXsvTRClQnE,921
|
|
45
45
|
cellfinder/napari/sample_data.py,sha256=oUST23q09MM8dxHbUCmO0AjtXG6OlR_32LLqP0EU2UA,732
|
|
46
46
|
cellfinder/napari/utils.py,sha256=AwTs76M9azutHhHj2yuaKErDEQ5F6pFbIIakBfzen6M,3824
|
|
47
47
|
cellfinder/napari/detect/__init__.py,sha256=BD9Bg9NTAr6yRTq2A_p58U6j4w5wbY0sdXwhPJ3MSMY,34
|
|
48
|
-
cellfinder/napari/detect/detect.py,sha256=
|
|
49
|
-
cellfinder/napari/detect/detect_containers.py,sha256=
|
|
50
|
-
cellfinder/napari/detect/thread_worker.py,sha256=
|
|
48
|
+
cellfinder/napari/detect/detect.py,sha256=VB3SLZvqJhjuypjpaZuV9JscQ-sE8yVHG8RzEsZWfeA,13809
|
|
49
|
+
cellfinder/napari/detect/detect_containers.py,sha256=j9NTsIyyDNrhlI2dc7hvc7QlxvI1NRHlCe137v7fsPg,5467
|
|
50
|
+
cellfinder/napari/detect/thread_worker.py,sha256=PWM3OE-FpK-dpdhaE_Gi-2lD3u8sL-SJ13mp0pMhTyI,3078
|
|
51
51
|
cellfinder/napari/train/__init__.py,sha256=xo4CK-DvSecInGEc2ohcTgQYlH3iylFnGvKTCoq2WkI,35
|
|
52
52
|
cellfinder/napari/train/train.py,sha256=zJY7zKcLqDTDtD76thmbwViEU4tTFCmXZze-zHsTpoo,5941
|
|
53
53
|
cellfinder/napari/train/train_containers.py,sha256=1wZ_GPe7B5XsLYs5XIx4m8GMw5KeVhg6SchhPtXu4V8,4386
|
|
54
|
-
cellfinder-1.3.
|
|
55
|
-
cellfinder-1.3.
|
|
56
|
-
cellfinder-1.3.
|
|
57
|
-
cellfinder-1.3.
|
|
58
|
-
cellfinder-1.3.
|
|
59
|
-
cellfinder-1.3.
|
|
54
|
+
cellfinder-1.3.1.dist-info/LICENSE,sha256=Tw8iMytIDXLSmcIUsbQmRWojstl9yOWsPCx6ZT6dZLY,1564
|
|
55
|
+
cellfinder-1.3.1.dist-info/METADATA,sha256=tdKnKSv42LLsTm89qJdCx0EuRLSDj8XN1gzl8XuB8cM,7097
|
|
56
|
+
cellfinder-1.3.1.dist-info/WHEEL,sha256=-oYQCr74JF3a37z2nRlQays_SX2MqOANoqVjBBAP2yE,91
|
|
57
|
+
cellfinder-1.3.1.dist-info/entry_points.txt,sha256=cKKjU8GPiN-TRelG2sT2JCKAcB9XDCjP6g9atE9pSoY,247
|
|
58
|
+
cellfinder-1.3.1.dist-info/top_level.txt,sha256=jyTQzX-tDjbsMr6s-E71Oy0IKQzmHTXSk4ZhpG5EDSE,11
|
|
59
|
+
cellfinder-1.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|