示例#1
0
文件: test_big.py 项目: ylch/stardist
def test_cover3D(block_size, context, grid):
    lbl = real_image3d()[1]
    lbl = lbl.astype(np.int32)

    max_sizes = tuple(calculate_extents(lbl, func=np.max))
    min_overlap = tuple(1 + v for v in max_sizes)
    lbl = repeat(lbl, (2, 4, 4))
    assert max_sizes == tuple(calculate_extents(lbl, func=np.max))

    reassemble(lbl, 'ZYX', block_size, min_overlap, context, grid)
示例#2
0
print(conf)
vars(conf)


if use_gpu:
    from csbdeep.utils.tf import limit_gpu_memory
    # adjust as necessary: limit GPU memory to be used by TensorFlow to leave some to OpenCL-based computations
    limit_gpu_memory(args.limit_gpu_mem)




model = StarDist2D(conf, name=args.model_name, basedir=args.model_dir)


median_size = calculate_extents(list(Y), np.median)
fov = np.array(model._axes_tile_overlap('YX'))
if any(median_size > fov):
    print("WARNING: median object size larger than field of view of the neural network.")



augmenter = None

# def augmenter(x, y):
#     """Augmentation of a single input/label image pair.
#     x is an input image
#     y is the corresponding ground-truth label image
#     """
#     # modify a copy of x and/or y...
#     return x, y
示例#3
0
def compute_anisotropy_from_data(data):
    extents = calculate_extents(data)
    anisotropy = tuple(np.max(extents) / extents)
    return anisotropy