def test_popping_layer():
    """Test popping a layer off layerlist."""
    layers = LayerList()
    layer = Image(np.random.random((10, 10)))
    layers.append(layer)
    assert len(layers) == 1
    layers.pop(0)
    assert len(layers) == 0
Beispiel #2
0
def _convert(ll: LayerList, type_: str):
    from .base.base import Layer

    for lay in list(ll.selection):
        idx = ll.index(lay)
        data = lay.data.astype(int) if type_ == 'labels' else lay.data
        ll.pop(idx)
        ll.insert(idx, Layer.create(data, {'name': lay.name}, type_))