Beispiel #1
0
def test_tubes_from_paths():
    """Tests that, given valid paths, valid tubes are created."""
    sess = NeuroglancerSession(url, 0, url_seg)
    img, bbox, verts = sess.pull_voxel(2, 300,
                                       radius=5)  # A valid bbox with data.
    G_paths = sess.get_segments(2, bbox)
    bbox = bbox.to_list()
    paths = G_paths[1]  # valid paths
    size = np.subtract(bbox[3:], bbox[:3])
    tubes = tube_seg.tubes_from_paths(size, paths)
    assert (tubes != 0).any()
Beispiel #2
0
def test_tubes_from_paths_bad_inputs():
    """Tests that the tubes_from_paths method raises errors when given bad inputs."""
    sess = NeuroglancerSession(url, 0, url_seg)
    img, bbox, verts = sess.pull_voxel(2, 300,
                                       radius=5)  # A valid bbox with data.
    G_paths = sess.get_segments(2, bbox)
    G = G_paths[0]
    paths = G_paths[1]  # valid paths
    bbox = bbox.to_list()
    size = np.subtract(bbox[3:], bbox[:3])
    with pytest.raises(TypeError):
        tube_seg.tubes_from_paths("asdf", paths)
    with pytest.raises(ValueError):
        tube_seg.tubes_from_paths((-1, -1, -1), paths)
    with pytest.raises(TypeError):
        tube_seg.tubes_from_paths(size, "asdf")
    with pytest.raises(TypeError):
        tube_seg.tubes_from_paths(size, [[0, 0, "asdf"]])
    with pytest.raises(TypeError):
        tube_seg.tubes_from_paths(size, paths, radius="asdf")
    with pytest.raises(ValueError):
        tube_seg.tubes_from_paths(size, paths, radius=-1)
Beispiel #3
0
def test_pull():
    url = "s3://mouse-light-viz/precomputed_volumes/brain1"
    ngl = NeuroglancerSession(url, mip=4, url_segments=url + "_segments")
    img, bounds, voxel = ngl.pull_voxel(2, 300)
    img2 = ngl.pull_bounds_img(bounds)
    assert np.all(np.squeeze(np.array(img)) == np.squeeze(np.array(img2)))