How to use the neuroglancer.EquivalenceMap function in neuroglancer

To help you get started, we’ve selected a few neuroglancer 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 google / neuroglancer / python / neuroglancer / tool / agglomeration_split_tool.py View on Github external
agglo_id = max(agglo_ids, key=lambda x: agglo_id_counts[x])

        if len(agglo_ids) > 1:
            logging.info('Warning: more than one agglomerated component.  ' +
                         'Choosing component %d with maximum number of seed points.', agglo_id)
            logging.info('agglo_id_counts = %r', agglo_id_counts)

    input_edges = graph.get_agglo_edges(agglo_id)
    if supervoxels is not None:
        input_edges = [x for x in input_edges if x.segment_ids[0] in supervoxels and x.segment_ids[1] in supervoxels]
    graph = build_graph(input_edges)
    if debug_graph:
        graph.check_consistency()

    cur_eqs = neuroglancer.EquivalenceMap()
    logging.info('Agglomerating')
    threshold = float('inf')
    while True:
        entry = graph.get_next_edge()
        if entry is None:
            if verbose_merging:
                logging.info('Stopping because entry is None')
            break
        if entry[0] > threshold:
            if verbose_merging:
                logging.info('Stopping because edge score %r is > threshold %r', entry[0],
                             threshold)
            break
        segment_ids = entry[1]
        seeds_a = supervoxel_map.get(segment_ids[0])
        seeds_b = supervoxel_map.get(segment_ids[1])