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!
lifted_mc.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录