Beispiel #1
0
 def test_removed_object(self):
     arr = np.zeros((30, 30, 30), dtype=np.uint8)
     arr[10:-10, 10:-10, 10:-10] = 1
     arr2 = np.copy(arr)
     arr2[15:-15, 15:-15, 15:-15] = 2
     res = convex_fill(arr2)
     assert np.all(res == arr)
     arr2[15:-15, 15:-10, 15:-15] = 2
     res = convex_fill(arr2)
     assert np.all(res == arr)
Beispiel #2
0
 def test_missing_value(self):
     arr = np.zeros((30, 30, 30), dtype=np.uint8)
     arr[10:-10, 10:-10, 10:-10] = 2
     res = convex_fill(arr)
     assert np.all(res == arr)
     arr = np.zeros((30, 60, 30), dtype=np.uint8)
     arr[10:-10, 10:-40, 10:-10] = 1
     arr[10:-10, -30:-10, 10:-10] = 3
     res = convex_fill(arr)
     assert np.all(res == arr)
Beispiel #3
0
 def test_fill(self):
     arr = np.zeros((30, 30, 30), dtype=np.uint8)
     arr[10:-10, 10:-10, 10:-10] = 1
     arr2 = np.copy(arr)
     arr2[15:-15, 15:-15, 15:-15] = 0
     res = convex_fill(arr2)
     assert np.all(res == arr)
     arr2[15:-15, 15:-10, 15:-15] = 0
     res = convex_fill(arr2)
     assert np.all(res == arr)
     arr = np.zeros((30, 60, 30), dtype=np.uint8)
     arr[10:-10, 10:-40, 10:-10] = 1
     arr[10:-10, -30:-10, 10:-10] = 2
     arr2 = np.copy(arr)
     arr2[15:-15, 15:-15, 20:-10] = 0
     arr2[15:-15, -30:-10, 20:-10] = 0
     res = convex_fill(arr2)
     assert np.all(res == arr)