Skip to content

Commit

Permalink
add test case corresponding to rapidsaigh-520
Browse files Browse the repository at this point in the history
  • Loading branch information
grlee77 committed Feb 24, 2023
1 parent fa926e6 commit cb07daa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/cucim/src/cucim/skimage/filters/tests/test_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from cucim.skimage._shared.testing import expected_warnings
from cucim.skimage.filters import median
from cucim.skimage import morphology

try:
from math import prod
Expand Down Expand Up @@ -249,3 +250,17 @@ def test_median_preserve_dtype(image, dtype):
)
def test_median(img, behavior):
median(img, behavior=behavior)


def test_median_nonsquare():
"""Test non-uniform footprint.
https://github.com/rapidsai/cucim/issues/520
"""
rng = cp.random.default_rng()
img = rng.integers(0, 256, (128, 128), dtype=cp.uint8)
footprint = morphology.disk(5)
mode = 'nearest'
out = median(img, footprint, mode=mode, behavior='ndimage')
expected = ndimage.median_filter(img, footprint=footprint, mode=mode)
cp.testing.assert_array_equal(out, expected)

0 comments on commit cb07daa

Please sign in to comment.