How to use the stardist.star_dist function in stardist

To help you get started, we’ve selected a few stardist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_types_gpu(img, n_rays):
    mode = "opencl"
    gt = star_dist(img, n_rays=n_rays, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):
        x = star_dist(img.astype(dtype), n_rays=n_rays, mode=mode)
        print("test_stardist2D with mode {mode} for shape {img.shape} and type {dtype}".format(mode =mode, img = img, dtype = dtype))
        check_similar(gt, x)
github mpicbg-csbd / stardist / tests / test_nms2D.py View on Github external
def test_acc(img):
    prob = edt_prob(img)
    dist = star_dist(img, n_rays=32, mode="cpp")
    coord = dist_to_coord(dist)
    points = non_maximum_suppression(coord, prob, prob_thresh=0.4)
    img2 = polygons_to_label(coord, prob, points, shape=img.shape)
    m = matching(img, img2)
    acc = m.accuracy
    print("accuracy {acc:.2f}".format(acc=acc))
    assert acc > 0.9
github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_types(img, n_rays):
    mode = "cpp"
    gt = star_dist(img, n_rays=n_rays, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):
        x = star_dist(img.astype(dtype), n_rays=n_rays, mode=mode)
        print("test_stardist2D (mode {mode}) for shape {img.shape} and type {dtype}".format(mode =mode, img = img, dtype = dtype))
        check_similar(gt, x)
github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_types(img, n_rays):
    mode = "cpp"
    gt = star_dist(img, n_rays=n_rays, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):
        x = star_dist(img.astype(dtype), n_rays=n_rays, mode=mode)
        print("test_stardist2D (mode {mode}) for shape {img.shape} and type {dtype}".format(mode =mode, img = img, dtype = dtype))
        check_similar(gt, x)
github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_cpu_gpu(img, n_rays):
    s_cpp = star_dist(img, n_rays=n_rays, mode="cpp")
    s_ocl = star_dist(img, n_rays=n_rays, mode="opencl")
    check_similar(s_cpp, s_ocl)
github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_types_gpu(img, n_rays):
    mode = "opencl"
    gt = star_dist(img, n_rays=n_rays, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):
        x = star_dist(img.astype(dtype), n_rays=n_rays, mode=mode)
        print("test_stardist2D with mode {mode} for shape {img.shape} and type {dtype}".format(mode =mode, img = img, dtype = dtype))
        check_similar(gt, x)
github mpicbg-csbd / stardist / tests / test_stardist2D.py View on Github external
def test_cpu_gpu(img, n_rays):
    s_cpp = star_dist(img, n_rays=n_rays, mode="cpp")
    s_ocl = star_dist(img, n_rays=n_rays, mode="opencl")
    check_similar(s_cpp, s_ocl)
github mpicbg-csbd / stardist / tests / test_nms2D.py View on Github external
def test_bbox_search(img):
    prob = edt_prob(img)
    dist = star_dist(img, n_rays=32, mode="cpp")
    coord = dist_to_coord(dist)
    nms_a = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=False)
    nms_b = non_maximum_suppression(coord, prob, prob_thresh=0.4, verbose=False, max_bbox_search=True)
    check_similar(nms_a, nms_b)