lifted_mc.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:nature_methods_multicut_pipeline 作者: ilastik 项目源码 文件源码
def compute_and_save_lifted_nh(ds,
        segId,
        liftedNeighborhood,
        with_defects = False):

    uvs_local = modified_adjacency(ds, segId) if (with_defects and ds.defect_slices) else ds._adjacent_segments(segId)
    n_nodes = uvs_local.max() + 1

    # TODO maybe we should remove the uvs connected to a ignore segment if we have a seg mask
    # should be done if this takes too much time if we have a seg mask
    if ds.has_seg_mask:
        where_uv = (uvs_local != ds.ignore_seg_value).all(axis=1)
        uvs_local = uvs_local[where_uv]

    originalGraph = agraph.Graph(n_nodes)
    originalGraph.insertEdges(uvs_local)

    print ds.ds_name
    print "Computing lifted neighbors for range:", liftedNeighborhood
    lm = agraph.liftedMcModel(originalGraph)
    agraph.addLongRangeNH(lm , liftedNeighborhood)
    uvIds = lm.liftedGraph().uvIds()

    return uvIds[uvs_local.shape[0]:,:]


# TODO adapt to defects
# we assume that uv is consecutive
#@cacher_hdf5()
# sample size 0 means we do not sample!
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号