|
5 | 5 | import fastmorph |
6 | 6 | import scipy.ndimage |
7 | 7 |
|
8 | | -def test_spherical_dilate(): |
| 8 | +@pytest.mark.parametrize("in_place", [False, True]) |
| 9 | +def test_spherical_dilate(in_place): |
9 | 10 | labels = np.zeros((10,10,10), dtype=bool) |
10 | | - res = fastmorph.spherical_dilate(labels, radius=1000) |
| 11 | + res = fastmorph.spherical_dilate(labels, radius=1000, in_place=in_place) |
11 | 12 | assert np.all(res == False) |
12 | 13 |
|
| 14 | + labels = np.zeros((10,10,10), dtype=bool) |
13 | 15 | labels[5,5,5] = True |
14 | 16 | radius = 5 * np.sqrt(3) + 0.000001 |
15 | | - res = fastmorph.spherical_dilate(labels, radius=radius) |
| 17 | + res = fastmorph.spherical_dilate(labels, radius=radius, in_place=in_place) |
16 | 18 | assert np.all(res == True) |
17 | 19 |
|
18 | | - res = fastmorph.spherical_dilate(labels, radius=1) |
| 20 | + labels = np.zeros((10,10,10), dtype=bool) |
| 21 | + labels[5,5,5] = True |
| 22 | + res = fastmorph.spherical_dilate(labels, radius=1, in_place=in_place) |
19 | 23 | assert np.count_nonzero(res) == 7 |
20 | 24 |
|
21 | | - res = fastmorph.spherical_dilate(labels, radius=np.sqrt(2)) |
| 25 | + labels = np.zeros((10,10,10), dtype=bool) |
| 26 | + labels[5,5,5] = True |
| 27 | + res = fastmorph.spherical_dilate(labels, radius=np.sqrt(2), in_place=in_place) |
22 | 28 | assert np.count_nonzero(res) == 19 |
23 | | - |
24 | | - res = fastmorph.spherical_dilate(labels, radius=np.sqrt(3)) |
| 29 | + |
| 30 | + labels = np.zeros((10,10,10), dtype=bool) |
| 31 | + labels[5,5,5] = True |
| 32 | + res = fastmorph.spherical_dilate(labels, radius=np.sqrt(3), in_place=in_place) |
25 | 33 | assert np.count_nonzero(res) == 27 |
26 | 34 |
|
27 | 35 | @pytest.mark.parametrize("in_place", [False, True]) |
|
0 commit comments