dcnum 0.16.8__py3-none-any.whl → 0.17.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.
Potentially problematic release.
This version of dcnum might be problematic. Click here for more details.
- dcnum/_version.py +2 -2
- dcnum/feat/feat_background/base.py +0 -8
- dcnum/feat/gate.py +0 -7
- dcnum/feat/queue_event_extractor.py +1 -19
- dcnum/meta/__init__.py +1 -0
- dcnum/meta/paths.py +30 -0
- dcnum/meta/ppid.py +2 -9
- dcnum/read/const.py +2 -3
- dcnum/read/hdf5_data.py +0 -14
- dcnum/segm/segm_thresh.py +4 -0
- dcnum/segm/segmenter.py +2 -10
- dcnum/segm/segmenter_gpu.py +0 -6
- {dcnum-0.16.8.dist-info → dcnum-0.17.1.dist-info}/METADATA +1 -1
- {dcnum-0.16.8.dist-info → dcnum-0.17.1.dist-info}/RECORD +17 -16
- {dcnum-0.16.8.dist-info → dcnum-0.17.1.dist-info}/LICENSE +0 -0
- {dcnum-0.16.8.dist-info → dcnum-0.17.1.dist-info}/WHEEL +0 -0
- {dcnum-0.16.8.dist-info → dcnum-0.17.1.dist-info}/top_level.txt +0 -0
dcnum/_version.py
CHANGED
|
@@ -4,7 +4,6 @@ import inspect
|
|
|
4
4
|
import multiprocessing as mp
|
|
5
5
|
import pathlib
|
|
6
6
|
import uuid
|
|
7
|
-
import warnings
|
|
8
7
|
|
|
9
8
|
import h5py
|
|
10
9
|
import numpy as np
|
|
@@ -212,13 +211,6 @@ class Background(abc.ABC):
|
|
|
212
211
|
def process_approach(self):
|
|
213
212
|
"""The actual background computation approach"""
|
|
214
213
|
|
|
215
|
-
@classmethod
|
|
216
|
-
def get_ppid_from_kwargs(cls, kwargs):
|
|
217
|
-
warnings.warn(
|
|
218
|
-
"Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
|
|
219
|
-
DeprecationWarning)
|
|
220
|
-
return cls.get_ppid_from_ppkw(kwargs)
|
|
221
|
-
|
|
222
214
|
|
|
223
215
|
@functools.cache
|
|
224
216
|
def get_available_background_methods():
|
dcnum/feat/gate.py
CHANGED
|
@@ -139,13 +139,6 @@ class Gate:
|
|
|
139
139
|
ppid=pp_gate_kwargs)
|
|
140
140
|
return kwargs
|
|
141
141
|
|
|
142
|
-
@classmethod
|
|
143
|
-
def get_ppid_from_kwargs(cls, kwargs):
|
|
144
|
-
warnings.warn(
|
|
145
|
-
"Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
|
|
146
|
-
DeprecationWarning)
|
|
147
|
-
return cls.get_ppid_from_ppkw(kwargs)
|
|
148
|
-
|
|
149
142
|
def gate_event(self, event):
|
|
150
143
|
"""Return None if the event should not be used, else `event`"""
|
|
151
144
|
if self.box_gates and event:
|
|
@@ -7,7 +7,6 @@ import os
|
|
|
7
7
|
import queue
|
|
8
8
|
import threading
|
|
9
9
|
import traceback
|
|
10
|
-
import warnings
|
|
11
10
|
|
|
12
11
|
import numpy as np
|
|
13
12
|
|
|
@@ -126,8 +125,7 @@ class QueueEventExtractor:
|
|
|
126
125
|
num_extractors: int,
|
|
127
126
|
log_queue: mp.Queue,
|
|
128
127
|
log_level: int = logging.INFO,
|
|
129
|
-
|
|
130
|
-
ptp_median: None = None):
|
|
128
|
+
):
|
|
131
129
|
"""Get initialization arguments for :cass:`.QueueEventExtractor`
|
|
132
130
|
|
|
133
131
|
This method was created for convenience reasons:
|
|
@@ -147,8 +145,6 @@ class QueueEventExtractor:
|
|
|
147
145
|
Queue the worker uses for sending log messages
|
|
148
146
|
log_level: int
|
|
149
147
|
Logging level to use in the worker process
|
|
150
|
-
preselect, ptp_median:
|
|
151
|
-
Deprecated
|
|
152
148
|
|
|
153
149
|
Returns
|
|
154
150
|
-------
|
|
@@ -160,13 +156,6 @@ class QueueEventExtractor:
|
|
|
160
156
|
# queue with event-wise feature dictionaries
|
|
161
157
|
event_queue = mp_spawn.Queue()
|
|
162
158
|
|
|
163
|
-
if preselect is not None:
|
|
164
|
-
warnings.warn("The `preselect` argument is deprecated!",
|
|
165
|
-
DeprecationWarning)
|
|
166
|
-
if ptp_median is not None:
|
|
167
|
-
warnings.warn("The `ptp_median` argument is deprecated!",
|
|
168
|
-
DeprecationWarning)
|
|
169
|
-
|
|
170
159
|
# Note that the order must be identical to __init__
|
|
171
160
|
args = collections.OrderedDict()
|
|
172
161
|
args["data"] = data
|
|
@@ -382,13 +371,6 @@ class QueueEventExtractor:
|
|
|
382
371
|
self.log_queue.close()
|
|
383
372
|
self.log_queue.join_thread()
|
|
384
373
|
|
|
385
|
-
@classmethod
|
|
386
|
-
def get_ppid_from_kwargs(cls, kwargs):
|
|
387
|
-
warnings.warn(
|
|
388
|
-
"Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
|
|
389
|
-
DeprecationWarning)
|
|
390
|
-
return cls.get_ppid_from_ppkw(kwargs)
|
|
391
|
-
|
|
392
374
|
|
|
393
375
|
class EventExtractorProcess(QueueEventExtractor, mp_spawn.Process):
|
|
394
376
|
"""Multiprocessing worker for regular segmentation and extraction"""
|
dcnum/meta/__init__.py
CHANGED
dcnum/meta/paths.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
|
|
3
|
+
search_path_registry = {}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def register_search_path(topic: str,
|
|
7
|
+
search_path: str | pathlib.Path):
|
|
8
|
+
"""Register a search path for a given topic
|
|
9
|
+
|
|
10
|
+
Search paths are a global solution for organizing the locations
|
|
11
|
+
of resources that are part of an analysis pipeline. For instance,
|
|
12
|
+
if the location of such a file that depends on where your pipeline is
|
|
13
|
+
running, you can register multiple search paths and the file will
|
|
14
|
+
be found using :func:`find_file`.
|
|
15
|
+
"""
|
|
16
|
+
topic_list = search_path_registry.setdefault(topic, [])
|
|
17
|
+
topic_list.append(pathlib.Path(search_path))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def find_file(topic: str,
|
|
21
|
+
file_name: str):
|
|
22
|
+
"""Find a file in the search path for the given topic"""
|
|
23
|
+
search_paths = search_path_registry.get(topic, [])
|
|
24
|
+
for pp in search_paths:
|
|
25
|
+
pf = pp / file_name
|
|
26
|
+
if pf.is_file():
|
|
27
|
+
return pf
|
|
28
|
+
else:
|
|
29
|
+
raise KeyError(f"Could not find {file_name} for {topic} in the "
|
|
30
|
+
f"registered search paths {search_paths}")
|
dcnum/meta/ppid.py
CHANGED
|
@@ -71,14 +71,8 @@ def get_class_method_info(class_obj: ClassWithPPIDCapabilities,
|
|
|
71
71
|
are extracted.
|
|
72
72
|
"""
|
|
73
73
|
doc = class_obj.__doc__ or class_obj.__init__.__doc__
|
|
74
|
-
if hasattr(class_obj, "key"):
|
|
75
|
-
warnings.warn(f"{class_obj.__class__} implements `key` which is "
|
|
76
|
-
f"deprecated. Please rename to `get_ppid_code`.",
|
|
77
|
-
DeprecationWarning)
|
|
78
|
-
setattr(class_obj, "get_ppid_code", class_obj.key)
|
|
79
74
|
info = {
|
|
80
75
|
"code": class_obj.get_ppid_code(),
|
|
81
|
-
"key": class_obj.get_ppid_code(), # Deprecated
|
|
82
76
|
"doc": doc,
|
|
83
77
|
"title": doc.split("\n")[0],
|
|
84
78
|
}
|
|
@@ -116,11 +110,10 @@ def kwargs_to_ppid(cls: ClassWithPPIDCapabilities,
|
|
|
116
110
|
f"segmenter and had to implement `__init__`, make sure "
|
|
117
111
|
f"that it accepts all kwonly-arguments its super class "
|
|
118
112
|
f"accepts. If this is not the case, you are probably "
|
|
119
|
-
f"passing
|
|
113
|
+
f"passing invalid kwargs to the segmenter."
|
|
120
114
|
)
|
|
121
115
|
if allow_invalid_keys:
|
|
122
|
-
warnings.warn(msg
|
|
123
|
-
DeprecationWarning)
|
|
116
|
+
warnings.warn(msg, UserWarning)
|
|
124
117
|
else:
|
|
125
118
|
raise KeyError(msg)
|
|
126
119
|
kwannot = info["annotations"][method]
|
dcnum/read/const.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
#: Scalar features that apply to all events in a frame
|
|
1
|
+
#: Scalar features that apply to all events in a frame and which are
|
|
2
|
+
#: not computed from image or image_bg data.
|
|
2
3
|
PROTECTED_FEATURES = [
|
|
3
|
-
"bg_med",
|
|
4
4
|
"flow_rate",
|
|
5
5
|
"frame",
|
|
6
6
|
"g_force",
|
|
7
|
-
"index_online",
|
|
8
7
|
"pressure",
|
|
9
8
|
"temp",
|
|
10
9
|
"temp_amb",
|
dcnum/read/hdf5_data.py
CHANGED
|
@@ -162,20 +162,6 @@ class HDF5Data:
|
|
|
162
162
|
|
|
163
163
|
if state["pixel_size"] is not None:
|
|
164
164
|
self.pixel_size = state["pixel_size"]
|
|
165
|
-
else:
|
|
166
|
-
# Set known pixel size if possible
|
|
167
|
-
did = self.meta.get("setup:identifier", "EMPTY")
|
|
168
|
-
if (did.startswith("RC-")
|
|
169
|
-
and (self.pixel_size < 0.255 or self.pixel_size > 0.275)):
|
|
170
|
-
warnings.warn(
|
|
171
|
-
f"Correcting for invalid pixel size in '{self.path}'!")
|
|
172
|
-
warnings.warn(
|
|
173
|
-
"Correcting the pixel size is deprecated in dcnum; please "
|
|
174
|
-
"make sure your input data are clean before processing",
|
|
175
|
-
DeprecationWarning
|
|
176
|
-
)
|
|
177
|
-
# Set default pixel size for Rivercyte devices
|
|
178
|
-
self.pixel_size = 0.2645
|
|
179
165
|
|
|
180
166
|
self.image_cache_size = state["image_cache_size"]
|
|
181
167
|
|
dcnum/segm/segm_thresh.py
CHANGED
|
@@ -15,6 +15,10 @@ class SegmentThresh(CPUSegmenter):
|
|
|
15
15
|
|
|
16
16
|
Parameters
|
|
17
17
|
----------
|
|
18
|
+
thresh: int
|
|
19
|
+
grayscale threhold value for creating the mask image;
|
|
20
|
+
For a background-corrected image, pixels with values below
|
|
21
|
+
this value are considered to be part of the mask.
|
|
18
22
|
"""
|
|
19
23
|
super(SegmentThresh, self).__init__(thresh=thresh, *args, **kwargs)
|
|
20
24
|
|
dcnum/segm/segmenter.py
CHANGED
|
@@ -4,7 +4,6 @@ import functools
|
|
|
4
4
|
import inspect
|
|
5
5
|
import logging
|
|
6
6
|
from typing import Dict
|
|
7
|
-
import warnings
|
|
8
7
|
|
|
9
8
|
import cv2
|
|
10
9
|
import numpy as np
|
|
@@ -132,10 +131,10 @@ class Segmenter(abc.ABC):
|
|
|
132
131
|
# Start with the default mask kwargs defined for this subclass
|
|
133
132
|
kwargs_mask_used = copy.deepcopy(cls.mask_default_kwargs)
|
|
134
133
|
kwargs_mask_used.update(kwargs_mask)
|
|
135
|
-
|
|
134
|
+
code = cls.get_ppid_code()
|
|
136
135
|
csegm = kwargs_to_ppid(cls, "segment_approach", kwargs)
|
|
137
136
|
cmask = kwargs_to_ppid(cls, "process_mask", kwargs_mask_used)
|
|
138
|
-
return ":".join([
|
|
137
|
+
return ":".join([code, csegm, cmask])
|
|
139
138
|
|
|
140
139
|
@staticmethod
|
|
141
140
|
def get_ppkw_from_ppid(segm_ppid):
|
|
@@ -280,13 +279,6 @@ class Segmenter(abc.ABC):
|
|
|
280
279
|
def segment_batch(self, data, start=None, stop=None):
|
|
281
280
|
"""Return the integer labels for an entire batch"""
|
|
282
281
|
|
|
283
|
-
@classmethod
|
|
284
|
-
def get_ppid_from_kwargs(cls, *args, **kwargs):
|
|
285
|
-
warnings.warn(
|
|
286
|
-
"Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs.",
|
|
287
|
-
DeprecationWarning)
|
|
288
|
-
return cls.get_ppid_from_ppkw(*args, **kwargs)
|
|
289
|
-
|
|
290
282
|
|
|
291
283
|
@functools.cache
|
|
292
284
|
def get_available_segmenters():
|
dcnum/segm/segmenter_gpu.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import abc
|
|
2
|
-
import pathlib
|
|
3
2
|
from typing import Dict
|
|
4
3
|
|
|
5
4
|
import numpy as np
|
|
@@ -39,11 +38,6 @@ class GPUSegmenter(Segmenter, abc.ABC):
|
|
|
39
38
|
debug=debug,
|
|
40
39
|
**kwargs)
|
|
41
40
|
|
|
42
|
-
@staticmethod
|
|
43
|
-
def _get_model_path(model_file):
|
|
44
|
-
"""Custom hook that may be defined by subclasses"""
|
|
45
|
-
return pathlib.Path(model_file)
|
|
46
|
-
|
|
47
41
|
def segment_batch(self,
|
|
48
42
|
image_data: np.ndarray,
|
|
49
43
|
start: int = None,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
dcnum/__init__.py,sha256=hcawIKS7utYiOyVhOAX9t7K3xYzP1b9862VV0b6qSrQ,74
|
|
2
|
-
dcnum/_version.py,sha256=
|
|
2
|
+
dcnum/_version.py,sha256=_lgKa5p_bLODIZJPNplciMDP-zYDU8I4ZC5LbeKWQ08,413
|
|
3
3
|
dcnum/feat/__init__.py,sha256=JqlgzOgDJhoTk8WVYcIiKTWq9EAM16_jGivzOtN6JGo,325
|
|
4
4
|
dcnum/feat/event_extractor_manager_thread.py,sha256=Ocid_t1awH6pOmurCmKYkC51XsXB0-DoN3fzjFDgE4c,7129
|
|
5
|
-
dcnum/feat/gate.py,sha256=
|
|
6
|
-
dcnum/feat/queue_event_extractor.py,sha256=
|
|
5
|
+
dcnum/feat/gate.py,sha256=svbObmqpYdqPawpfrsEjTiUPJXf24GrNi8PXTKT-z44,7225
|
|
6
|
+
dcnum/feat/queue_event_extractor.py,sha256=3CIjZOwOD8JZZTgbE9_jC81B8lbNtVElSV371Q9zoSc,15005
|
|
7
7
|
dcnum/feat/feat_background/__init__.py,sha256=OTmMuazHNaSrZb2XW4cnJ6PlgJLbKrPbaidpEixYa0A,341
|
|
8
|
-
dcnum/feat/feat_background/base.py,sha256=
|
|
8
|
+
dcnum/feat/feat_background/base.py,sha256=DKcNSQOSi0cuo4zFbqtgDJnRiYDwoKkw2GQxpnK14fA,8119
|
|
9
9
|
dcnum/feat/feat_background/bg_copy.py,sha256=EbeIy28gyPJr01Xens881IC1BtaTS5q-BkXPd3b6cLk,726
|
|
10
10
|
dcnum/feat/feat_background/bg_roll_median.py,sha256=HgiGoyfLkygIlCoo8cBbf3gQt5uvM2S6_ez_V1hhCb4,12834
|
|
11
11
|
dcnum/feat/feat_background/bg_sparse_median.py,sha256=LbWbDxAruGagidHt9wybyqkXp9OKi3eWXceujirpsqY,17608
|
|
@@ -22,24 +22,25 @@ dcnum/logic/__init__.py,sha256=7J3GrwJInNQbrLk61HRIV7X7p69TAIbMYpR34hh6u14,177
|
|
|
22
22
|
dcnum/logic/ctrl.py,sha256=7m1HL_kO62d8Kt_o4gX3bhxbI4pwOhv3HWHRmbCaMp0,27022
|
|
23
23
|
dcnum/logic/job.py,sha256=M0Q-Rfcm-zkTXTQc79W6YSNUjUlgmRPG0Ikbdn1aOpY,4608
|
|
24
24
|
dcnum/logic/json_encoder.py,sha256=dy44ArmdnxpUfxxONmKdIv-fde3aTXPjZDN0HPATaxs,467
|
|
25
|
-
dcnum/meta/__init__.py,sha256=
|
|
26
|
-
dcnum/meta/
|
|
25
|
+
dcnum/meta/__init__.py,sha256=AVqRgyKXO1orKnE305h88IBvoZ1oz6X11HN1WP5nGvg,60
|
|
26
|
+
dcnum/meta/paths.py,sha256=J_ikeHzd7gEeRgAKjuayz3x6q4h1fOiDadM-ZxhAGm4,1053
|
|
27
|
+
dcnum/meta/ppid.py,sha256=f3xT6k9EMhrmk2T_e-2LHE9qdXeGMZJcNOIIpr-_eb4,7706
|
|
27
28
|
dcnum/read/__init__.py,sha256=iV2wrBMdwJgpXaphNiiAVybndDzTTv0CAGRNXyvxcLY,157
|
|
28
29
|
dcnum/read/cache.py,sha256=HXbRFyTNT08_imv2460hMKVrfRrU6WnbJoO71HR1j8E,5800
|
|
29
|
-
dcnum/read/const.py,sha256=
|
|
30
|
-
dcnum/read/hdf5_data.py,sha256=
|
|
30
|
+
dcnum/read/const.py,sha256=ccME3dOK7DEXNhkTD90I7KF8zagzZufnbFkrYwQeIUo,307
|
|
31
|
+
dcnum/read/hdf5_data.py,sha256=dO2VZKBA7bOOku37sdv5SJgZ8vbAGHd1k5cmcylEonQ,18169
|
|
31
32
|
dcnum/segm/__init__.py,sha256=iiq_1A9DU5wMUcKnsZ53E7NyzCkbZCJeUDimzunE-OM,247
|
|
32
|
-
dcnum/segm/segm_thresh.py,sha256=
|
|
33
|
-
dcnum/segm/segmenter.py,sha256=
|
|
33
|
+
dcnum/segm/segm_thresh.py,sha256=Z6buG3ia8uFJKTLE6BICM3n7Yw8IN-9f6_umIlx0xUk,1395
|
|
34
|
+
dcnum/segm/segmenter.py,sha256=Y535ro4BTyE5Uj5lYIZ0xMbpKg2TIs5wCpv1Gg-yvTU,10625
|
|
34
35
|
dcnum/segm/segmenter_cpu.py,sha256=tCY105rVr9_0RIq2618qnF1ueHRj7UtuK_nUBoAg-nY,10743
|
|
35
|
-
dcnum/segm/segmenter_gpu.py,sha256=
|
|
36
|
+
dcnum/segm/segmenter_gpu.py,sha256=Au1MQdAalVsmJ-cmb3OcCmEMBfXSDuJjdXJTGqEIcG8,1962
|
|
36
37
|
dcnum/segm/segmenter_manager_thread.py,sha256=2znDaKedSueomcU1pbHtFmVcGoHzp--sf494VgJF_Tk,5342
|
|
37
38
|
dcnum/write/__init__.py,sha256=Cpn3LqL18hh8OScUnGp_AnNfpWPpKW-oAJZH6ot7aRA,241
|
|
38
39
|
dcnum/write/deque_writer_thread.py,sha256=KpJ6po8JPlM696MITN-bhNnWQcy9E-qlhg9g-uzoPZg,1710
|
|
39
40
|
dcnum/write/queue_collector_thread.py,sha256=YQ6pvKNmCDf1C6HVx6gOA-q-FBoI6nkhOo-tAVYnyag,11906
|
|
40
41
|
dcnum/write/writer.py,sha256=QGYNda102f2_12YWXu5WEBEQaTXhNnuQ20g-Dej-cek,10535
|
|
41
|
-
dcnum-0.
|
|
42
|
-
dcnum-0.
|
|
43
|
-
dcnum-0.
|
|
44
|
-
dcnum-0.
|
|
45
|
-
dcnum-0.
|
|
42
|
+
dcnum-0.17.1.dist-info/LICENSE,sha256=YRChA1C8A2E-amJbudwMcbTCZy_HzmeY0hMIvduh1MM,1089
|
|
43
|
+
dcnum-0.17.1.dist-info/METADATA,sha256=RLo_EIVokUSP35TZP2lBr_FjfeLGwzj4UMamaU0HMGE,2194
|
|
44
|
+
dcnum-0.17.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
45
|
+
dcnum-0.17.1.dist-info/top_level.txt,sha256=Hmh38rgG_MFTVDpUDGuO2HWTSq80P585Het4COQzFTg,6
|
|
46
|
+
dcnum-0.17.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|