Ejemplo n.º 1
0
def test_open_labels(suffix):
    viewer = ViewerModel()
    blobs = binary_blobs(length=128, volume_fraction=0.1, n_dim=2)
    labeled = ndi.label(blobs)[0].astype(np.uint8)
    with temporary_file(suffix) as fout:
        imwrite(fout, labeled, format=suffix)
        viewer.add_labels(path=fout)
        assert len(viewer.layers) == 1
        assert np.all(labeled == viewer.layers[0].data)
Ejemplo n.º 2
0
def test_open_labels(builtins, suffix):
    viewer = ViewerModel()
    blobs = binary_blobs(length=128, volume_fraction=0.1, n_dim=2)
    labeled = ndi.label(blobs)[0].astype(np.uint8)
    with temporary_file(suffix) as fout:
        imwrite(fout, labeled, format=suffix)
        viewer.open(fout, layer_type='labels', plugin=builtins.name)
        assert len(viewer.layers) == 1
        assert np.all(labeled == viewer.layers[0].data)
        assert isinstance(viewer.layers[0], Labels)