@@ -66,7 +66,7 @@ def get_colored_tree(test_node_list, gold_node_list, switch, km, color):
6666
6767def score_point_distance (gold_tree : swc_node .SwcTree , test_tree : swc_node .SwcTree ,
6868 test_node_list : list , gold_node_list : list ,
69- threshold_dis : float , color : list , metric_mode : int ):
69+ threshold_dis : float , color : list ):
7070 """
7171 get minimum matching distance by running KM algorithm
7272 than calculte the return value according to matching result
@@ -78,9 +78,6 @@ def score_point_distance(gold_tree: swc_node.SwcTree, test_tree: swc_node.SwcTre
7878 threshold_dis: if the distance of two node are larger than this threshold,
7979 they are considered unlimited far
8080 color(List): color id of tp, fn, fp nodes
81- metric_mode(1 or 2):
82- mode = 1: distance between nodes are calculated as euclidean distance
83- mode = 2: distance between nodes are calculated as distance on the gold tree
8481 Returns:
8582 gold_len(int): length of gold_node_list
8683 test_len(int): length of test_node_list
@@ -92,8 +89,8 @@ def score_point_distance(gold_tree: swc_node.SwcTree, test_tree: swc_node.SwcTre
9289 pt_cost: a composite value calculated by tp, fn, fp and threshold
9390 iso_node_num: number of nodes in test tree without parents or children
9491 """
95- test_gold_dict = point_match_utils .get_swc2swc_dicts (src_node_list = test_swc_tree .get_node_list (),
96- tar_node_list = gold_swc_tree .get_node_list ())
92+ test_gold_dict = point_match_utils .get_swc2swc_dicts (src_node_list = test_tree .get_node_list (),
93+ tar_node_list = gold_tree .get_node_list ())
9794 # disgraph is a 2D ndarray store the distance between nodes in gold and test
9895 # test_node_list contains only branch or leaf nodes
9996 dis_graph , switch , test_len , gold_len = km_utils .get_dis_graph (gold_tree = gold_tree ,
@@ -102,7 +99,7 @@ def score_point_distance(gold_tree: swc_node.SwcTree, test_tree: swc_node.SwcTre
10299 gold_node_list = gold_node_list ,
103100 test_gold_dict = test_gold_dict ,
104101 threshold_dis = threshold_dis ,
105- metric_mode = metric_mode )
102+ metric_mode = 1 )
106103 # create a KM object and calculate the minimum match
107104 km = km_utils .KM (maxn = max (test_len , gold_len )+ 10 , nx = test_len , ny = gold_len , G = dis_graph )
108105 km .solve ()
@@ -150,7 +147,6 @@ def branch_leaf_metric(gold_swc_tree, test_swc_tree, config):
150147 """
151148 # read configs
152149 threshold_dis = config ["threshold_dis" ]
153- metric_mode = config ["metric_mode" ]
154150 threshold_mode = config ["threshold_mode" ]
155151
156152 # in threshold mode 2, threshold is a multiple of the average length of edges
@@ -176,8 +172,7 @@ def branch_leaf_metric(gold_swc_tree, test_swc_tree, config):
176172 test_node_list = test_branch_swc_list ,
177173 gold_node_list = gold_branch_swc_list ,
178174 threshold_dis = threshold_dis ,
179- color = color ,
180- metric_mode = metric_mode )
175+ color = color )
181176
182177 branch_result = {
183178 "gold_len" : branch_result_tuple [0 ],
@@ -199,8 +194,8 @@ def branch_leaf_metric(gold_swc_tree, test_swc_tree, config):
199194 gold_swc_tree = swc_node .SwcTree ()
200195 test_swc_tree = swc_node .SwcTree ()
201196
202- test_swc_tree .load ("../../data/test_data/topo_metric_data/gold_fake_data4 .swc" )
203- gold_swc_tree .load ("../../data/test_data/topo_metric_data/test_fake_data4 .swc" )
197+ gold_swc_tree .load ("../../data/example_selected/a .swc" )
198+ test_swc_tree .load ("../../output/random_data/move/a/010/move_03 .swc" )
204199
205200 config = read_json .read_json ("..\\ ..\\ config\\ branch_metric.json" )
206201 config_schema = read_json .read_json ("..\\ ..\\ config\\ schemas\\ branch_metric_schema.json" )
@@ -209,9 +204,6 @@ def branch_leaf_metric(gold_swc_tree, test_swc_tree, config):
209204 except Exception as e :
210205 raise Exception ("[Error: ]Error in analyzing config json file" )
211206
212- config ["metric_mode" ] = 2
213- config ["threshold_dis" ] = 1
214- config ["threshold_mode" ] = 2
215207 branch_result = \
216208 branch_leaf_metric (test_swc_tree = test_swc_tree , gold_swc_tree = gold_swc_tree , config = config )
217209 print ("---------------Result---------------" )
0 commit comments