Пример #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()
Пример #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)