def test_contour_from_array_at_label_simple_border_omit_axis_z():
    arr = np.zeros([50, 50, 50])
    arr[:, :, 25:] = 1

    arr_contour = contour_from_array_at_label(arr, 1, omit_axis='z')

    np.testing.assert_array_equal(arr_contour, np.zeros_like(arr_contour))
def test_contour_from_array_at_label_simple_border_omit_axis_y():
    arr = np.zeros([50, 50, 50])
    arr[:, :, 25:] = 1

    arr_contour = contour_from_array_at_label(arr, 1, omit_axis='y')

    im_expected = np.zeros([50, 50, 50])
    im_expected[:, :, 24:26] = 1

    np.testing.assert_array_equal(arr_contour, im_expected)
def test_contour_from_array_at_label_empty_image():
    arr = np.zeros([50, 50, 50])
    arr_contour = contour_from_array_at_label(arr, 1)

    np.testing.assert_array_equal(arr_contour, np.zeros_like(arr_contour))
def test_contour_from_array_at_label_error():
    arr = np.zeros([50, 50, 50])

    with np.testing.assert_raises(IOError):
        contour_from_array_at_label(arr, 1, omit_axis='spam')