decision -= 1
	status = npp.undo()
	if not status:
	    print("Won't undo")
	    decision += 1
	    num_examined += 1
	else:
	    num_undo += 1
    #npp.set_body_mode(25000, 0)
print(("Num body: ", num_examined))
print(("Num undo: ", num_undo))

# synapse mode
#npp.set_edge_mode(0.1, 0.9, 0.5)
num_examined = 0
npp.set_synapse_mode(0.1)

num_undo = 0
while npp.get_estimated_num_remaining_edges() > 0:
    priority_info = npp.get_next_edge()
    xyzlocation = priority_info.location
    (body1, body2) = priority_info.body_pair

    # proofread body pair at location
    npp.set_edge_result(priority_info.body_pair, decision%2)
    decision+=1
    num_examined += 1
    undo += 1
    if not undo%5:
	status = npp.undo()
	decision -= 1
Beispiel #2
0
def auto_proofread(body2gtbody, rag_file, size_threshold, master_logger, test_stack, session_location):
    nomerge_hist = []
    tot_hist = []
    nomerge_hist2 = []
    tot_hist2 = []
    dirtybodies = set()
    for iter1 in range(0, 101):
        nomerge_hist.append(0)
        tot_hist.append(0)
        nomerge_hist2.append(0)
        tot_hist2.append(0)

    neuroproof.initialize_priority_scheduler(rag_file, 0.1, 0.9, 0.1)

    bodyremap = {}

    num_body = 0   
    neuroproof.set_body_mode(size_threshold, 0) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_body += 1

    num_synapse = 0   
    neuroproof.set_synapse_mode(0.1) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_synapse += 1

    num_orphan = 0   
    neuroproof.set_orphan_mode(size_threshold, size_threshold, size_threshold) 
    while neuroproof.get_estimated_num_remaining_edges() > 0:
        process_edge(body2gtbody, nomerge_hist, tot_hist, nomerge_hist2, tot_hist2, dirtybodies, bodyremap)
        num_orphan += 1

    master_logger.info("Probability Actual Agreement with Groundtruth Flat")
    for iter1 in range(0, 101):
        if tot_hist[iter1] == 0:
            per = 0
        else:
            per = (float(nomerge_hist[iter1])/float(tot_hist[iter1]) * 100)
        print iter1, ", ", per , ", " , tot_hist[iter1] 

    master_logger.info("Probability Actual Agreement with Groundtruth Est")
    for iter1 in range(0, 101):
        if tot_hist2[iter1] == 0:
            per = 0
        else:
            per = (float(nomerge_hist2[iter1])/float(tot_hist2[iter1]) * 100)
        print iter1, ", ", per , ", " , tot_hist2[iter1] 

    body2body = {}
    for key, vallist in bodyremap.items():
        for body in vallist:
            body2body[body] = key

    os.system("cp -R " + test_stack + "/superpixel_maps " + session_location + "/") 
    os.system("cp " + test_stack + "/superpixel_to_segment_map.txt " + session_location + "/") 

    mapping_file = open(test_stack + "/segment_to_body_map.txt")
    outfile = open(session_location + "/segment_to_body_map.txt", 'w')

    for line in mapping_file.readlines():
        vals = line.split(' ')
        
        seg = int(vals[0])
        body = int(vals[1])

        if body in body2body:
            body = body2body[body]
        outfile.write(str(seg) + " " + str(body) + "\n")

    master_logger.info("Num body: " + str(num_body))
    master_logger.info("Num synapse: " + str(num_synapse))
    master_logger.info("Num orphan: " + str(num_orphan))
    master_logger.info("Num total: " + str(num_body + num_synapse + num_orphan))
Beispiel #3
0
        decision -= 1
        status = npp.undo()
        if not status:
            print("Won't undo")
            decision += 1
            num_examined += 1
        else:
            num_undo += 1
    #npp.set_body_mode(25000, 0)
print(("Num body: ", num_examined))
print(("Num undo: ", num_undo))

# synapse mode
#npp.set_edge_mode(0.1, 0.9, 0.5)
num_examined = 0
npp.set_synapse_mode(0.1)

num_undo = 0
while npp.get_estimated_num_remaining_edges() > 0:
    priority_info = npp.get_next_edge()
    xyzlocation = priority_info.location
    (body1, body2) = priority_info.body_pair

    # proofread body pair at location
    npp.set_edge_result(priority_info.body_pair, decision % 2)
    decision += 1
    num_examined += 1
    undo += 1
    if not undo % 5:
        status = npp.undo()
        decision -= 1