Exemplo n.º 1
0
def test_background():
    img = data.binary_blobs(length=128, blob_size_fraction=0.15, n_dim=3)
    l_ndi = _label_bool(img, background=0)
    l_cy = clabel(img, background=0)
    testing.assert_equal(l_ndi, l_cy)

    l_ndi = _label_bool(img, background=1)
    l_cy = clabel(img, background=1)
    testing.assert_equal(l_ndi, l_cy)
Exemplo n.º 2
0
def test_connectivity():
    img = data.binary_blobs(length=128, blob_size_fraction=0.15, n_dim=3)
    for c in (1, 2, 3):
        l_ndi = _label_bool(img, connectivity=c)
        l_cy = clabel(img, connectivity=c)
        testing.assert_equal(l_ndi, l_cy)

    for c in (0, 4):
        with pytest.raises(ValueError):
            l_ndi = _label_bool(img, connectivity=c)
        with pytest.raises(ValueError):
            l_cy = clabel(img, connectivity=c)
Exemplo n.º 3
0
def test_return_num():
    img = data.binary_blobs(length=128, blob_size_fraction=0.15, n_dim=3)
    l_ndi = _label_bool(img, return_num=True)
    l_cy = clabel(img, return_num=True)
    testing.assert_equal(l_ndi, l_cy)
Exemplo n.º 4
0
def test_no_option():
    img = data.binary_blobs(length=128, blob_size_fraction=0.15, n_dim=3)
    l_ndi = _label_bool(img)
    l_cy = clabel(img)
    testing.assert_equal(l_ndi, l_cy)