Пример #1
0
def index():
    # pkl-list get
    pkl_list = sorted(
        [pkl for pkl in os.listdir('model') if pkl.endswith('.pkl')])
    pkl_select = [
        'Depth {:s} Branch {:s}'.format(
            a.replace('.pkl', '').split('-')[2],
            a.replace('.pkl', '').split('-')[3]) for a in pkl_list
    ]
    return render_template('search.html',
                           bg_path=BG_PATH,
                           logo_path=LOGO_PATH,
                           pkl_list=pkl_select,
                           tar_path=utils.random_image('static/data'))
Пример #2
0
import numpy as np
import pytest
from stardist import star_dist3D, Rays_GoldenSpiral, relabel_image_stardist3D
from utils import random_image, real_image3d, check_similar, circle_image


@pytest.mark.parametrize('img', (real_image3d()[1], random_image(
    (33, 44, 55))))
@pytest.mark.parametrize('n_rays', (4, 16, 32))
@pytest.mark.parametrize('grid', ((1, 1, 1), (1, 2, 4)))
def test_types(img, n_rays, grid):
    mode = "cpp"
    rays = Rays_GoldenSpiral(n_rays)
    gt = star_dist3D(img, rays=rays, grid=grid, mode=mode)
    for dtype in (np.int8, np.int16, np.int32, np.uint8, np.uint16, np.uint32):
        x = star_dist3D(img.astype(dtype), rays=rays, grid=grid, mode=mode)
        print(
            "test_stardist3D (mode {mode}) for shape {img.shape} and type {dtype}"
            .format(mode=mode, img=img, dtype=dtype))
        check_similar(gt, x)


@pytest.mark.gpu
@pytest.mark.parametrize('img', (real_image3d()[1], random_image(
    (33, 44, 55))))
@pytest.mark.parametrize('n_rays', (4, 16, 32))
@pytest.mark.parametrize('grid', ((1, 1, 1), (1, 2, 4)))
def test_types_gpu(img, n_rays, grid):
    mode = "opencl"
    rays = Rays_GoldenSpiral(n_rays)
    gt = star_dist3D(img, rays=rays, grid=grid, mode=mode)
Пример #3
0
import numpy as np
import pytest
from stardist import star_dist, edt_prob, non_maximum_suppression, dist_to_coord, polygons_to_label
from stardist.matching import matching
from utils import random_image, real_image2d, check_similar


@pytest.mark.parametrize('img', (real_image2d()[1], random_image((128, 123))))
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)


@pytest.mark.parametrize('img', (real_image2d()[1], ))
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)
Пример #4
0
import numpy as np
import pytest
from stardist import star_dist3D, Rays_GoldenSpiral, relabel_image_stardist3D
from utils import random_image, real_image3d, check_similar, circle_image, Timer
from time import time

@pytest.mark.parametrize('img', (real_image3d()[1], random_image((33, 44, 55))))
@pytest.mark.parametrize('n_rays', (4, 16, 32))
@pytest.mark.parametrize('grid', ((1, 1, 1), (1, 2, 4)))
def test_types(img, n_rays, grid):
    mode = "cpp"
    rays = Rays_GoldenSpiral(n_rays)
    gt = star_dist3D(img, rays=rays, grid=grid, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):
        x = star_dist3D(img.astype(dtype), rays=rays, grid=grid, mode=mode)
        print("test_stardist3D (mode {mode}) for shape {img.shape} and type {dtype}".format(
            mode=mode, img=img, dtype=dtype))
        check_similar(gt, x)


@pytest.mark.gpu
@pytest.mark.parametrize('img', (real_image3d()[1], random_image((33, 44, 55))))
@pytest.mark.parametrize('n_rays', (4, 16, 32))
@pytest.mark.parametrize('grid', ((1, 1, 1), (1, 2, 4)))
def test_types_gpu(img, n_rays, grid):
    mode = "opencl"
    rays = Rays_GoldenSpiral(n_rays)
    gt = star_dist3D(img, rays=rays, grid=grid, mode=mode)
    for dtype in (np.int8, np.int16, np.int32,
                  np.uint8, np.uint16, np.uint32):