dcnum 0.23.0__tar.gz → 0.23.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 (118) hide show
  1. {dcnum-0.23.0 → dcnum-0.23.1}/.github/workflows/check.yml +1 -1
  2. {dcnum-0.23.0 → dcnum-0.23.1}/CHANGELOG +3 -0
  3. {dcnum-0.23.0 → dcnum-0.23.1}/PKG-INFO +1 -1
  4. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/_version.py +2 -2
  5. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/meta/ppid.py +16 -2
  6. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/torch_preproc.py +12 -7
  7. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum.egg-info/PKG-INFO +1 -1
  8. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_torch_preproc.py +12 -12
  9. {dcnum-0.23.0 → dcnum-0.23.1}/.github/workflows/deploy_pypi.yml +0 -0
  10. {dcnum-0.23.0 → dcnum-0.23.1}/.gitignore +0 -0
  11. {dcnum-0.23.0 → dcnum-0.23.1}/.readthedocs.yml +0 -0
  12. {dcnum-0.23.0 → dcnum-0.23.1}/LICENSE +0 -0
  13. {dcnum-0.23.0 → dcnum-0.23.1}/README.rst +0 -0
  14. {dcnum-0.23.0 → dcnum-0.23.1}/docs/conf.py +0 -0
  15. {dcnum-0.23.0 → dcnum-0.23.1}/docs/extensions/github_changelog.py +0 -0
  16. {dcnum-0.23.0 → dcnum-0.23.1}/docs/index.rst +0 -0
  17. {dcnum-0.23.0 → dcnum-0.23.1}/docs/requirements.txt +0 -0
  18. {dcnum-0.23.0 → dcnum-0.23.1}/pyproject.toml +0 -0
  19. {dcnum-0.23.0 → dcnum-0.23.1}/setup.cfg +0 -0
  20. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/__init__.py +0 -0
  21. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/__init__.py +0 -0
  22. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/event_extractor_manager_thread.py +0 -0
  23. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_background/__init__.py +0 -0
  24. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_background/base.py +0 -0
  25. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_background/bg_copy.py +0 -0
  26. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_background/bg_roll_median.py +0 -0
  27. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_background/bg_sparse_median.py +0 -0
  28. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_brightness/__init__.py +0 -0
  29. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_brightness/bright_all.py +0 -0
  30. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_brightness/common.py +0 -0
  31. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_contour/__init__.py +0 -0
  32. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_contour/contour.py +0 -0
  33. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_contour/moments.py +0 -0
  34. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_contour/volume.py +0 -0
  35. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_texture/__init__.py +0 -0
  36. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_texture/common.py +0 -0
  37. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/feat_texture/tex_all.py +0 -0
  38. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/gate.py +0 -0
  39. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/feat/queue_event_extractor.py +0 -0
  40. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/logic/__init__.py +0 -0
  41. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/logic/ctrl.py +0 -0
  42. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/logic/job.py +0 -0
  43. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/logic/json_encoder.py +0 -0
  44. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/meta/__init__.py +0 -0
  45. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/meta/paths.py +0 -0
  46. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/read/__init__.py +0 -0
  47. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/read/cache.py +0 -0
  48. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/read/const.py +0 -0
  49. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/read/hdf5_data.py +0 -0
  50. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/read/mapped.py +0 -0
  51. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/__init__.py +0 -0
  52. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_thresh.py +0 -0
  53. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/__init__.py +0 -0
  54. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/segm_torch_base.py +0 -0
  55. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/segm_torch_mpo.py +0 -0
  56. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/segm_torch_sto.py +0 -0
  57. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/torch_model.py +0 -0
  58. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segm_torch/torch_postproc.py +0 -0
  59. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segmenter.py +0 -0
  60. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segmenter_manager_thread.py +0 -0
  61. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segmenter_mpo.py +0 -0
  62. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/segm/segmenter_sto.py +0 -0
  63. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/write/__init__.py +0 -0
  64. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/write/deque_writer_thread.py +0 -0
  65. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/write/queue_collector_thread.py +0 -0
  66. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum/write/writer.py +0 -0
  67. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum.egg-info/SOURCES.txt +0 -0
  68. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum.egg-info/dependency_links.txt +0 -0
  69. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum.egg-info/requires.txt +0 -0
  70. {dcnum-0.23.0 → dcnum-0.23.1}/src/dcnum.egg-info/top_level.txt +0 -0
  71. {dcnum-0.23.0 → dcnum-0.23.1}/tests/conftest.py +0 -0
  72. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_cytoshot_extended-moments-features.zip +0 -0
  73. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_cytoshot_full-features_2023.zip +0 -0
  74. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_cytoshot_full-features_2024.zip +0 -0
  75. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip +0 -0
  76. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_shapein_empty.zip +0 -0
  77. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/fmt-hdf5_shapein_raw-with-variable-length-logs.zip +0 -0
  78. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/segm-torch-model_unet-dcnum-test_g1_910c2.zip +0 -0
  79. {dcnum-0.23.0 → dcnum-0.23.1}/tests/data/segm-torch-test-data_unet-dcnum-test_g1_910c2.zip +0 -0
  80. {dcnum-0.23.0 → dcnum-0.23.1}/tests/helper_methods.py +0 -0
  81. {dcnum-0.23.0 → dcnum-0.23.1}/tests/requirements.txt +0 -0
  82. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_background_base.py +0 -0
  83. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_background_bg_copy.py +0 -0
  84. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_background_bg_roll_median.py +0 -0
  85. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_background_bg_sparsemed.py +0 -0
  86. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_brightness.py +0 -0
  87. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_event_extractor_manager.py +0 -0
  88. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_gate.py +0 -0
  89. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_haralick.py +0 -0
  90. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_moments_based.py +0 -0
  91. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_moments_based_extended.py +0 -0
  92. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_feat_volume.py +0 -0
  93. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_init.py +0 -0
  94. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_logic_job.py +0 -0
  95. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_logic_join.py +0 -0
  96. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_logic_json.py +0 -0
  97. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_logic_pipeline.py +0 -0
  98. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_paths.py +0 -0
  99. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_base.py +0 -0
  100. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_bg.py +0 -0
  101. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_data.py +0 -0
  102. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_feat.py +0 -0
  103. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_gate.py +0 -0
  104. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_meta_ppid_segm.py +0 -0
  105. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_read_basin.py +0 -0
  106. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_read_concat_hdf5.py +0 -0
  107. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_read_hdf5.py +0 -0
  108. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_read_hdf5_basins.py +0 -0
  109. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_read_hdf5_index_mapping.py +0 -0
  110. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_base.py +0 -0
  111. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_mpo.py +0 -0
  112. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_no_mask_proc.py +0 -0
  113. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_sto.py +0 -0
  114. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_thresh.py +0 -0
  115. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_segm_torch.py +0 -0
  116. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_write_deque_writer_thread.py +0 -0
  117. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_write_queue_collector_thread.py +0 -0
  118. {dcnum-0.23.0 → dcnum-0.23.1}/tests/test_write_writer.py +0 -0
@@ -31,7 +31,7 @@ jobs:
31
31
  run: |
32
32
  # https://github.com/luispedro/mahotas/issues/144
33
33
  pip install mahotas==1.4.13
34
- pip install -e .
34
+ pip install .[torch]
35
35
  - name: List installed packages
36
36
  run: |
37
37
  pip freeze
@@ -1,3 +1,6 @@
1
+ 0.23.1
2
+ - enh: support passing custom default arguments to get_class_method_info
3
+ - tests: fix torch preprocessing tests
1
4
  0.23.0
2
5
  - feat: implement segmentation using PyTorch models
3
6
  - fix: always compute image_bg if it is not in the input file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.23.0
3
+ Version: 0.23.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Maximilian Schlögel, Paul Müller, Raghava Alajangi
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.23.0'
16
- __version_tuple__ = version_tuple = (0, 23, 0)
15
+ __version__ = version = '0.23.1'
16
+ __version_tuple__ = version_tuple = (0, 23, 1)
@@ -59,7 +59,9 @@ def convert_to_dtype(value, dtype):
59
59
 
60
60
 
61
61
  def get_class_method_info(class_obj: ClassWithPPIDCapabilities,
62
- static_kw_methods: List = None):
62
+ static_kw_methods: List = None,
63
+ static_kw_defaults: Dict = None,
64
+ ):
63
65
  """Return dictionary of class info with static keyword methods docs
64
66
 
65
67
  Parameters
@@ -69,7 +71,16 @@ def get_class_method_info(class_obj: ClassWithPPIDCapabilities,
69
71
  static_kw_methods: list of callable
70
72
  The methods to inspect; all kwargs-only keyword arguments
71
73
  are extracted.
74
+ static_kw_defaults: dict
75
+ If a key in this dictionary matches an item in `static_kw_methods`,
76
+ then these are the default values returned in the "defaults"
77
+ dictionary. This is used in cases where a base class does
78
+ implement some annotations, but the subclass does not actually
79
+ use them, because e.g. they are taken from a property such as is
80
+ the case for the mask postprocessing of segmenter classes.
72
81
  """
82
+ if static_kw_defaults is None:
83
+ static_kw_defaults = {}
73
84
  doc = class_obj.__doc__ or class_obj.__init__.__doc__
74
85
  info = {
75
86
  "code": class_obj.get_ppid_code(),
@@ -82,7 +93,10 @@ def get_class_method_info(class_obj: ClassWithPPIDCapabilities,
82
93
  for mm in static_kw_methods:
83
94
  meth = getattr(class_obj, mm)
84
95
  spec = inspect.getfullargspec(meth)
85
- defau[mm] = spec.kwonlydefaults or {}
96
+ if mm_defaults := static_kw_defaults.get(mm):
97
+ defau[mm] = mm_defaults
98
+ else:
99
+ defau[mm] = spec.kwonlydefaults or {}
86
100
  annot[mm] = spec.annotations
87
101
  info["defaults"] = defau
88
102
  info["annotations"] = annot
@@ -4,8 +4,8 @@ import numpy as np
4
4
 
5
5
 
6
6
  def preprocess_images(images: np.ndarray,
7
- norm_mean: float,
8
- norm_std: float,
7
+ norm_mean: float | None,
8
+ norm_std: float | None,
9
9
  image_shape: Tuple[int, int] = None,
10
10
  ):
11
11
  """Transform image data to something torch models expect
@@ -24,10 +24,11 @@ def preprocess_images(images: np.ndarray,
24
24
  2D image, it will be reshaped to a 3D image with a batch_size of 1.
25
25
  norm_mean:
26
26
  Mean value used for standard score data normalization, i.e.
27
- `normalized = `(images / 255 - norm_mean) / norm_std`
27
+ `normalized = `(images / 255 - norm_mean) / norm_std`; Set
28
+ to None to disable normalization.
28
29
  norm_std:
29
- Standard deviation used for standard score data normalization
30
- (see above)
30
+ Standard deviation used for standard score data normalization;
31
+ Set to None to disable normalization (see above).
31
32
  image_shape
32
33
  Image shape for which the model was created (height, width).
33
34
  If the image shape does not match the input image shape, then
@@ -102,8 +103,12 @@ def preprocess_images(images: np.ndarray,
102
103
  # Replace img_norm
103
104
  img_proc = img_pad
104
105
 
105
- # normalize images
106
- img_norm = (img_proc.astype(np.float32) / 255 - norm_mean) / norm_std
106
+ if norm_mean is None or norm_std is None:
107
+ # convert to float32
108
+ img_norm = img_proc.astype(np.float32)
109
+ else:
110
+ # normalize images
111
+ img_norm = (img_proc.astype(np.float32) / 255 - norm_mean) / norm_std
107
112
 
108
113
  # Add a "channels" axis for the ML models.
109
114
  return img_norm[:, np.newaxis, :, :]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.23.0
3
+ Version: 0.23.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Maximilian Schlögel, Paul Müller, Raghava Alajangi
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -11,8 +11,8 @@ def test_reshape_crop_both():
11
11
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
12
12
  out = torch_preproc.preprocess_images(images=image,
13
13
  image_shape=(6, 6),
14
- norm_std=1,
15
- norm_mean=1,
14
+ norm_std=None,
15
+ norm_mean=None,
16
16
  )
17
17
  assert out.shape == (1, 1, 6, 6)
18
18
  imout = out[0, 0, :, :]
@@ -23,8 +23,8 @@ def test_reshape_crop_height():
23
23
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
24
24
  out = torch_preproc.preprocess_images(images=image,
25
25
  image_shape=(6, 8),
26
- norm_std=1,
27
- norm_mean=1,
26
+ norm_std=None,
27
+ norm_mean=None,
28
28
  )
29
29
  assert out.shape == (1, 1, 6, 8)
30
30
  imout = out[0, 0, :, :]
@@ -35,8 +35,8 @@ def test_reshape_crop_width():
35
35
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
36
36
  out = torch_preproc.preprocess_images(images=image,
37
37
  image_shape=(8, 6),
38
- norm_std=1,
39
- norm_mean=1,
38
+ norm_std=None,
39
+ norm_mean=None,
40
40
  )
41
41
  assert out.shape == (1, 1, 8, 6)
42
42
  imout = out[0, 0, :, :]
@@ -47,8 +47,8 @@ def test_reshape_pad_both():
47
47
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
48
48
  out = torch_preproc.preprocess_images(images=image,
49
49
  image_shape=(10, 10),
50
- norm_std=1,
51
- norm_mean=1,
50
+ norm_std=None,
51
+ norm_mean=None,
52
52
  )
53
53
  assert out.shape == (1, 1, 10, 10)
54
54
  imout = out[0, 0, :, :]
@@ -64,8 +64,8 @@ def test_reshape_pad_height():
64
64
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
65
65
  out = torch_preproc.preprocess_images(images=image,
66
66
  image_shape=(10, 8),
67
- norm_std=1,
68
- norm_mean=1,
67
+ norm_std=None,
68
+ norm_mean=None,
69
69
  )
70
70
  assert out.shape == (1, 1, 10, 8)
71
71
  imout = out[0, 0, :, :]
@@ -79,8 +79,8 @@ def test_reshape_pad_width_crop_height():
79
79
  image = np.arange(64, dtype=np.float32).reshape(8, 8)
80
80
  out = torch_preproc.preprocess_images(images=image,
81
81
  image_shape=(6, 10),
82
- norm_std=1,
83
- norm_mean=1,
82
+ norm_std=None,
83
+ norm_mean=None,
84
84
  )
85
85
  assert out.shape == (1, 1, 6, 10)
86
86
  imout = out[0, 0, :, :]
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes