nbmorph 0.3.0__tar.gz → 0.3.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.
Files changed (25) hide show
  1. {nbmorph-0.3.0/src/nbmorph.egg-info → nbmorph-0.3.1}/PKG-INFO +1 -1
  2. {nbmorph-0.3.0 → nbmorph-0.3.1}/pyproject.toml +1 -1
  3. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/box_kernel.py +3 -2
  4. {nbmorph-0.3.0 → nbmorph-0.3.1/src/nbmorph.egg-info}/PKG-INFO +1 -1
  5. {nbmorph-0.3.0 → nbmorph-0.3.1}/tests/test_minmax.py +18 -0
  6. {nbmorph-0.3.0 → nbmorph-0.3.1}/LICENSE +0 -0
  7. {nbmorph-0.3.0 → nbmorph-0.3.1}/README.md +0 -0
  8. {nbmorph-0.3.0 → nbmorph-0.3.1}/setup.cfg +0 -0
  9. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/__init__.py +0 -0
  10. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/diamond_kernel.py +0 -0
  11. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/minmax.py +0 -0
  12. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/mode.py +0 -0
  13. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/morphology.py +0 -0
  14. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/ops.py +0 -0
  15. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/sorting_networks.py +0 -0
  16. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/utils.py +0 -0
  17. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph/zero_edges.py +0 -0
  18. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph.egg-info/SOURCES.txt +0 -0
  19. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph.egg-info/dependency_links.txt +0 -0
  20. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph.egg-info/requires.txt +0 -0
  21. {nbmorph-0.3.0 → nbmorph-0.3.1}/src/nbmorph.egg-info/top_level.txt +0 -0
  22. {nbmorph-0.3.0 → nbmorph-0.3.1}/tests/test_mode.py +0 -0
  23. {nbmorph-0.3.0 → nbmorph-0.3.1}/tests/test_morphology.py +0 -0
  24. {nbmorph-0.3.0 → nbmorph-0.3.1}/tests/test_sorting_networks.py +0 -0
  25. {nbmorph-0.3.0 → nbmorph-0.3.1}/tests/test_zero_edges.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbmorph
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A small package with Numba-accelerated morphological operations.
5
5
  Author-email: Marius Causemann <mariusca@simula.no>
6
6
  License: MIT License
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "nbmorph"
5
- version = "0.3.0"
5
+ version = "0.3.1"
6
6
  authors = [
7
7
  { name="Marius Causemann", email="mariusca@simula.no" },
8
8
  ]
@@ -19,7 +19,7 @@ def min27(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9,
19
19
  return min((
20
20
  min((v0, v1, v2, v3, v4, v5, v6, v7, v8)),
21
21
  min((v9, v10, v11, v12, v13, v14, v15, v16, v17)),
22
- max((v18, v19, v20, v21, v22, v23, v24, v25, v26))
22
+ min((v18, v19, v20, v21, v22, v23, v24, v25, v26))
23
23
  ))
24
24
 
25
25
  @numba.njit(inline="always")
@@ -64,7 +64,8 @@ def choose_op27(opname,
64
64
  v10, v11, v12, v13, v14, v15, v16, v17,v18,
65
65
  v19, v20, v21, v22, v23, v24, v25, v26,
66
66
  onlyzero=False):
67
- if onlyzero and v0 >0: return v0
67
+ # v13 is the centre voxel: the 27 values arrive in z-1/z/z+1 slice order.
68
+ if onlyzero and v13 >0: return v13
68
69
  match opname:
69
70
  case "min":
70
71
  return min27(v0, v1, v2, v3, v4, v5, v6, v7, v8,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbmorph
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A small package with Numba-accelerated morphological operations.
5
5
  Author-email: Marius Causemann <mariusca@simula.no>
6
6
  License: MIT License
@@ -24,3 +24,21 @@ def test_minimum_diamond():
24
24
  labels[1, 0, 1] = 1
25
25
  result = nbmorph.minimum_diamond(labels)
26
26
  assert result[1, 1, 1] == 1
27
+
28
+
29
+ def test_minimum_box_footprint_is_full_3x3x3():
30
+ """A single zero voxel must spread to all 27 voxels of the box footprint."""
31
+ labels = np.ones((5, 5, 5), dtype=np.uint8)
32
+ labels[2, 2, 2] = 0
33
+ result = nbmorph.minimum_box(labels)
34
+ assert (result == 0).sum() == 27
35
+ assert (result[1:4, 1:4, 1:4] == 0).all()
36
+
37
+
38
+ def test_maximum_box_footprint_is_full_3x3x3():
39
+ """A single high voxel must spread to all 27 voxels of the box footprint."""
40
+ labels = np.ones((5, 5, 5), dtype=np.uint8)
41
+ labels[2, 2, 2] = 5
42
+ result = nbmorph.maximum_box(labels)
43
+ assert (result == 5).sum() == 27
44
+ assert (result[1:4, 1:4, 1:4] == 5).all()
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