Exemplo n.º 1
0
def test_largest_cc():
    """ Check the extraction of the largest connected component.
    """
    a = np.zeros((6, 6, 6))
    a[1:3, 1:3, 1:3] = 1
    yield assert_equal, a, _largest_cc(a)
    b = a.copy()
    b[5, 5, 5] = 1
    yield assert_equal, a, _largest_cc(b)
Exemplo n.º 2
0
def largest_cc(mask):
    """ Largest connect components extraction code that fails gracefully 
        when mask is too big for C extension code.
    """
    try:
        mask = _largest_cc(mask)
    except TypeError:
        pass
    return mask.astype(np.bool)