def test_zmax(self): # # Test where the edge is the x minimum # stack = volume.VExtent(10, 30, 10, 35, 20, 45) ostack = volume.VExtent(10, 30, 10, 35, 20, 50) v = stack.intersection(ostack) d = volume.get_distance_from_edge(v, stack, ostack) expected = np.array([[[i] * 20] * 25 for i in range(25, 0, -1)]) np.testing.assert_equal(d, expected)
def test_xmax(self): # # Test where the edge is the x minimum # stack = volume.VExtent(0, 20, 10, 35, 20, 50) ostack = volume.VExtent(10, 30, 10, 35, 20, 50) v = stack.intersection(ostack) d = volume.get_distance_from_edge(v, stack, ostack) expected = np.array([[np.arange(10, 0, -1)] * 25] * 30) np.testing.assert_equal(d, expected)
def test_two(self): # # Test two at once # stack = volume.VExtent(10, 30, 20, 35, 20, 45) ostack = volume.VExtent(10, 30, 10, 35, 20, 50) v = stack.intersection(ostack) d = volume.get_distance_from_edge(v, stack, ostack) expected_y = np.array([[[i] * 20 for i in range(1, 16)]] * 25) expected_z = np.array([[[i] * 20] * 15 for i in range(25, 0, -1)]) expected = np.minimum(expected_y, expected_z) np.testing.assert_equal(d, expected)