dcnum 0.10.0__tar.gz → 0.11.1__tar.gz

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.

Files changed (71) hide show
  1. {dcnum-0.10.0 → dcnum-0.11.1}/.github/workflows/deploy_pypi.yml +8 -13
  2. {dcnum-0.10.0 → dcnum-0.11.1}/CHANGELOG +8 -1
  3. {dcnum-0.10.0 → dcnum-0.11.1}/PKG-INFO +1 -1
  4. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/_version.py +2 -2
  5. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/read/hdf5_data.py +3 -0
  6. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/segm/__init__.py +1 -0
  7. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/segm/segmenter.py +7 -5
  8. dcnum-0.11.1/dcnum/segm/segmenter_gpu.py +46 -0
  9. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum.egg-info/PKG-INFO +1 -1
  10. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum.egg-info/SOURCES.txt +1 -0
  11. {dcnum-0.10.0 → dcnum-0.11.1}/pyproject.toml +1 -8
  12. {dcnum-0.10.0 → dcnum-0.11.1}/.github/workflows/check.yml +0 -0
  13. {dcnum-0.10.0 → dcnum-0.11.1}/.gitignore +0 -0
  14. {dcnum-0.10.0 → dcnum-0.11.1}/.readthedocs.yml +0 -0
  15. {dcnum-0.10.0 → dcnum-0.11.1}/LICENSE +0 -0
  16. {dcnum-0.10.0 → dcnum-0.11.1}/README.rst +0 -0
  17. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/__init__.py +0 -0
  18. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/__init__.py +0 -0
  19. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/event_extractor_manager_thread.py +0 -0
  20. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_background/__init__.py +0 -0
  21. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_background/base.py +0 -0
  22. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_background/bg_roll_median.py +0 -0
  23. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_background/bg_sparse_median.py +0 -0
  24. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_brightness/__init__.py +0 -0
  25. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_brightness/bright_all.py +0 -0
  26. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_brightness/common.py +0 -0
  27. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_moments/__init__.py +0 -0
  28. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_moments/ct_opencv.py +0 -0
  29. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_moments/mt_legacy.py +0 -0
  30. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_texture/__init__.py +0 -0
  31. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_texture/common.py +0 -0
  32. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/feat_texture/tex_all.py +0 -0
  33. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/gate.py +0 -0
  34. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/feat/queue_event_extractor.py +0 -0
  35. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/meta/__init__.py +0 -0
  36. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/meta/ppid.py +0 -0
  37. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/read/__init__.py +0 -0
  38. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/read/cache.py +0 -0
  39. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/read/const.py +0 -0
  40. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/segm/segm_thresh.py +0 -0
  41. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/segm/segmenter_cpu.py +0 -0
  42. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/segm/segmenter_manager_thread.py +0 -0
  43. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/write/__init__.py +0 -0
  44. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/write/deque_writer_thread.py +0 -0
  45. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/write/queue_collector_thread.py +0 -0
  46. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum/write/writer.py +0 -0
  47. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum.egg-info/dependency_links.txt +0 -0
  48. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum.egg-info/requires.txt +0 -0
  49. {dcnum-0.10.0 → dcnum-0.11.1}/dcnum.egg-info/top_level.txt +0 -0
  50. {dcnum-0.10.0 → dcnum-0.11.1}/docs/conf.py +0 -0
  51. {dcnum-0.10.0 → dcnum-0.11.1}/docs/extensions/github_changelog.py +0 -0
  52. {dcnum-0.10.0 → dcnum-0.11.1}/docs/index.rst +0 -0
  53. {dcnum-0.10.0 → dcnum-0.11.1}/docs/requirements.txt +0 -0
  54. {dcnum-0.10.0 → dcnum-0.11.1}/setup.cfg +0 -0
  55. {dcnum-0.10.0 → dcnum-0.11.1}/tests/conftest.py +0 -0
  56. {dcnum-0.10.0 → dcnum-0.11.1}/tests/data/fmt-hdf5_cytoshot_full-features_2023.zip +0 -0
  57. {dcnum-0.10.0 → dcnum-0.11.1}/tests/data/fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip +0 -0
  58. {dcnum-0.10.0 → dcnum-0.11.1}/tests/helper_methods.py +0 -0
  59. {dcnum-0.10.0 → dcnum-0.11.1}/tests/requirements.txt +0 -0
  60. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_feat_background_bg_roll_median.py +0 -0
  61. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_feat_brightness.py +0 -0
  62. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_feat_haralick.py +0 -0
  63. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_feat_moments_based.py +0 -0
  64. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_init.py +0 -0
  65. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_ppid.py +0 -0
  66. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_ppid_segm.py +0 -0
  67. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_read_concat_hdf5.py +0 -0
  68. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_read_hdf5.py +0 -0
  69. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_segm_thresh.py +0 -0
  70. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_write_deque_writer_thread.py +0 -0
  71. {dcnum-0.10.0 → dcnum-0.11.1}/tests/test_write_writer.py +0 -0
@@ -6,21 +6,16 @@ on:
6
6
  - '*'
7
7
 
8
8
  jobs:
9
- build_wheels:
10
- name: Build wheels on ${{ matrix.os }}
11
- runs-on: ${{ matrix.os }}
12
- strategy:
13
- matrix:
14
- python-version: ['3.10', '3.11']
15
- os: [ubuntu-20.04, windows-2019, macos-11]
16
-
9
+ build_sdist:
10
+ name: Build source distribution
11
+ runs-on: ubuntu-latest
17
12
  steps:
18
13
  - uses: actions/checkout@v3
19
14
  with:
20
15
  fetch-depth: 0
21
16
 
22
- - name: Build wheels
23
- uses: pypa/cibuildwheel@v2.12.1
17
+ - name: Build sdist
18
+ run: pipx run build --sdist
24
19
 
25
20
  - name: publish
26
21
  env:
@@ -28,9 +23,9 @@ jobs:
28
23
  TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
29
24
  run: |
30
25
  pipx install twine
31
- twine upload --skip-existing wheelhouse/*
26
+ twine upload --skip-existing dist/*
32
27
 
33
- build_sdist:
28
+ build_wheels:
34
29
  name: Build source distribution
35
30
  runs-on: ubuntu-latest
36
31
  steps:
@@ -39,7 +34,7 @@ jobs:
39
34
  fetch-depth: 0
40
35
 
41
36
  - name: Build sdist
42
- run: pipx run build --sdist
37
+ run: pipx run build --wheel
43
38
 
44
39
  - name: publish
45
40
  env:
@@ -1,4 +1,11 @@
1
- 0.0.10
1
+ 0.11.1
2
+ - fix: fix GPUSegmenter labeling
3
+ 0.11.0
4
+ - feat: introduce GPUSegmenter base class
5
+ - fix: handle bytes-values in HDF5 attributes
6
+ - ref: correctly introduce `requires_background_correction` for segmenters
7
+ - setup: don't requrie cibuildwheel
8
+ 0.10.0
2
9
  - enh: some minor improvements in efficiency
3
10
  - ref: increment DCNUM_PPID_GENERATION for the sake of clarity
4
11
  - ref: unify dealing with num_workers and debugging
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.10.0
3
+ Version: 0.11.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Paul Müller
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -1,4 +1,4 @@
1
1
  # file generated by setuptools_scm
2
2
  # don't change, don't track in version control
3
- __version__ = version = '0.10.0'
4
- __version_tuple__ = version_tuple = (0, 10, 0)
3
+ __version__ = version = '0.11.1'
4
+ __version_tuple__ = version_tuple = (0, 11, 1)
@@ -91,6 +91,9 @@ class HDF5Data:
91
91
  locking=False,
92
92
  ) as h5:
93
93
  self.meta = dict(h5.attrs)
94
+ for key in self.meta:
95
+ if isinstance(self.meta[key], bytes):
96
+ self.meta[key] = self.meta[key].decode("utf-8")
94
97
  for key in h5.get("logs", []):
95
98
  alog = list(h5["logs"][key])
96
99
  if isinstance(alog[0], bytes):
@@ -3,6 +3,7 @@ import functools
3
3
 
4
4
  from .segmenter import Segmenter
5
5
  from .segmenter_cpu import CPUSegmenter
6
+ from .segmenter_gpu import GPUSegmenter
6
7
  from .segmenter_manager_thread import SegmenterManagerThread
7
8
  from . import segm_thresh
8
9
 
@@ -19,8 +19,8 @@ class Segmenter(abc.ABC):
19
19
  #: Default keyword arguments for mask post-processing. See `process_mask`
20
20
  #: for available options.
21
21
  mask_default_kwargs = {}
22
- #: If the segmenter requires a background image, set this to True
23
- requires_background = False
22
+ #: If the segmenter requires a background-corrected image, set this to True
23
+ requires_background_correction = False
24
24
 
25
25
  def __init__(self, kwargs_mask=None, debug=False, **kwargs):
26
26
  """Base segemnter
@@ -173,7 +173,9 @@ class Segmenter(abc.ABC):
173
173
  labels_uint8 = np.array(labels, dtype=np.uint8)
174
174
  labels_dilated = cv2.dilate(labels_uint8, element)
175
175
  labels_eroded = cv2.erode(labels_dilated, element)
176
- labels, _ = ndi.label(labels_eroded > 0)
176
+ labels, _ = ndi.label(
177
+ input=labels_eroded > 0,
178
+ structure=ndi.generate_binary_structure(2, 2))
177
179
 
178
180
  if fill_holes:
179
181
  # Floodfill only works with uint8 (too small) or int32
@@ -206,7 +208,7 @@ class Segmenter(abc.ABC):
206
208
  mol = segm_wrap(image)
207
209
  if mol.dtype == bool:
208
210
  # convert mask to label
209
- labels, num_labels = ndi.label(
211
+ labels, _ = ndi.label(
210
212
  input=mol,
211
213
  structure=ndi.generate_binary_structure(2, 2))
212
214
  else:
@@ -232,7 +234,7 @@ class Segmenter(abc.ABC):
232
234
  def segment_approach(image):
233
235
  """Perform segmentation and return integer label or binary mask image
234
236
 
235
- This is the approach the subclasses implements.
237
+ This is the approach the subclasses implement.
236
238
  """
237
239
 
238
240
  @abc.abstractmethod
@@ -0,0 +1,46 @@
1
+ import abc
2
+ import pathlib
3
+
4
+ import numpy as np
5
+ import scipy.ndimage as ndi
6
+
7
+
8
+ from .segmenter import Segmenter
9
+
10
+
11
+ class GPUSegmenter(Segmenter, abc.ABC):
12
+ mask_postprocessing = False
13
+
14
+ def __init__(self, model_file=None, *args, **kwargs):
15
+ super(GPUSegmenter, self).__init__(*args, **kwargs)
16
+ self.model_path = self._get_model_path(model_file)
17
+
18
+ @staticmethod
19
+ def _get_model_path(model_file):
20
+ """Custom hook that may be defined by subclasses"""
21
+ return pathlib.Path(model_file)
22
+
23
+ def segment_batch(self,
24
+ image_data: np.ndarray,
25
+ start: int = None,
26
+ stop: int = None):
27
+ if stop is None or start is None:
28
+ start = 0
29
+ stop = len(image_data)
30
+
31
+ image_slice = image_data[start:stop]
32
+ segm = self.segment_frame_wrapper()
33
+
34
+ labels = segm(image_slice)
35
+
36
+ # Make sure we have integer labels
37
+ if labels.dtype == bool:
38
+ new_labels = np.zeros_like(labels, dtype=np.uint16)
39
+ for ii in range(len(labels)):
40
+ ndi.label(
41
+ input=labels[ii],
42
+ output=new_labels[ii],
43
+ structure=ndi.generate_binary_structure(2, 2))
44
+ labels = new_labels
45
+
46
+ return labels
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.10.0
3
+ Version: 0.11.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Paul Müller
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -40,6 +40,7 @@ dcnum/segm/__init__.py
40
40
  dcnum/segm/segm_thresh.py
41
41
  dcnum/segm/segmenter.py
42
42
  dcnum/segm/segmenter_cpu.py
43
+ dcnum/segm/segmenter_gpu.py
43
44
  dcnum/segm/segmenter_manager_thread.py
44
45
  dcnum/write/__init__.py
45
46
  dcnum/write/deque_writer_thread.py
@@ -1,12 +1,5 @@
1
1
  [build-system]
2
- # Defined by PEP 518:
3
- # use oldest-supported-numpy (https://github.com/pypa/pip/issues/9542#issuecomment-771200755)
4
- requires = [
5
- # for building Cython extensions
6
- "cython", "oldest-supported-numpy", "setuptools", "wheel",
7
- # for version management
8
- "setuptools>=45", "setuptools_scm[toml]>=6.2"
9
- ]
2
+ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
10
3
  build-backend = "setuptools.build_meta"
11
4
 
12
5
  [project]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes