Skip to content

Commit c1dec9d

Browse files
authored
Merge pull request #53 from CSDLLab/2021_0607_add_config_help
add config documentation
2 parents 2230456 + ab621eb commit c1dec9d

File tree

8 files changed

+63
-121
lines changed

8 files changed

+63
-121
lines changed

config/.config_documentation.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## How to set configs
2+
### 1. SSD metric
3+
|parameter|type|description|
4+
|---|:---:|---|
5+
|threshold_mode|int|mode(1 or 2):<br />1 means static threshold, final threshold equal to ssd_threshold.<br />2 means dynamic threshold, final threshold equal to ssd_threshold * src_node.radius|
6+
|ssd_threshold|float| For each node in gold standard tree, ssd find its closest node in test tree. If the distance of these two nodes is less than ssd_threshold, this node is successfully reconstructed and it will contribute to recall or precision, otherwise the distance will be contribute to ssd score. |
7+
|up_sample_threshold|float|up sample rate of gold standard and test test tree. Smaller sample rate threshold means higher sample rate, denser upsampled tree.
8+
|scale|tuple(1*3)| scaling of gold and test tree in x,y,z coordinates.
9+
|debug|boolean|show debug information or not|
10+
11+
### 2. length metric
12+
|parameter|type|description|
13+
|---|:---:|---|
14+
|rad_mode|int|mode(1 or 2):<br />1 means static threshold, final threshold equal to rad_threshold.<br />2 means dynamic threshold, final threshold equal to rad_threshold * src_node.radius|
15+
|rad_threshold|float|This threshold measures the distance between nodes on gold standard tree and the closest edge on test tree.
16+
|len_threshold|float|This threshold measures the difference between edges on gold standard tree and their corresponding trace on test tree.
17+
|scale|tuple(1*3)|scaling of gold and test tree in x,y,z coordinates. |
18+
|debug|boolean|show debug information or not|
19+
20+
### 3. branch metric
21+
|parameter|type|description|
22+
|---|:---:|---|
23+
|threshold_dis|float| If the distance of two nodes on two trees is less than this threshold, they are probably matched.
24+
|scale|tuple(1*3)| scaling of gold and test tree in x,y,z coordinates.|
25+
|true_positive_type|int| Identify the type of true positive nodes in swc. (This and following two parameters may affect the color of nodes in visualization program) |
26+
|false_negative_type|int| Identify the type of false negative nodes in swc. |
27+
|false_positive_type|int| Identify the type of false positive nodes in swc. |
28+
29+
### 4. diadem metric
30+
|parameter|type|description|
31+
|---|:---:|---|
32+
|weight_mode|int|Choose different map between degree and weight.<br/>(a). WEIGHT_DEGREE = 1<br/>weight is the degree of node <br/>(b). WEIGHT_SQRT_DEGREE = 2<br/>weight is the sqrt of degree <br/>(c). WEIGHT_DEGREE_HARMONIC_MEAN = 3<br/>weight is the harmonic mean of degree of left and right son. <br/>(d). WEIGHT_PATH_LENGTH = 4<br/>weight is the length of path from node to its root<br/>|
33+
|remove_spur|boolean| remove spur or not |
34+
|count_excess_nodes|boolean| count excess nodes in test tree or not |
35+
|list_miss|boolean| list missed nodes(reconstruct failed nodes) or not|
36+
|list_distant_matches|boolean| distant match means the parent of a branch is not a matched node, but ancestor is. If this branch is matched, they are distant matched|
37+
|list_continuations|boolean| Continuation refer to nodes with only one one. List this kind of nodes or not. |
38+
|find_proper_root|boolean| find a pair of matched node as roots of two trees or not |
39+
|scale|tuple(1*3)|scaling of gold and test tree in x,y,z coordinates.|
40+
|xy_threshold|float| node distance threshold in xy surface.|
41+
|z_threshold|float| node distance threshold in z axis. |
42+
|default_xy_path_error_threshold|float| path length difference threshold in xy surface.
43+
|default_z_path_error_threshold|float| path length difference threshold in z axis. |
44+
|debug|boolean| show debug information or not |
45+
46+
### 5. link metric
47+
|parameter|type|description|
48+
|---|:---:|---|
49+
|scale|tuple(1*3)|scaling of gold and test tree in x,y,z coordinates.|

config/fake_reconstruction_configs/skeletonize.schema.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

config/fake_reconstruction_configs/test1best.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

config/fake_reconstruction_configs/test3best.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

config/fake_reconstruction_configs/test4best.json

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
This folder is used to place the temporary reconstruct configs.
2-
Dont' delete this folder.

pyneval/cli/pyneval.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,38 +107,39 @@ def read_parameters():
107107
parser.add_argument(
108108
"--gold",
109109
"-G",
110-
help="path to the gold-standard SWC file",
111-
required=True
110+
help="path of the gold standard SWC file",
111+
required=False
112112
)
113113
parser.add_argument(
114114
"--test",
115115
"-T",
116-
help="a list of SWC files for evaluation",
117-
required=True,
116+
help="a list of reconstructed SWC files or folders for evaluation",
117+
required=False,
118118
nargs='*',
119119
)
120120
parser.add_argument(
121121
"--metric",
122122
"-M",
123123
help="metric choice: " + get_metric_summary(False) + ".",
124-
required=True
124+
required=False
125125
)
126126
parser.add_argument(
127127
"--output",
128128
"-O",
129-
help="metric output path, including different scores of the metric",
129+
help="output path of metric results, output file is in json format with different scores of the metric",
130130
required=False
131131
)
132132
parser.add_argument(
133133
"--detail",
134134
"-D",
135-
help="detail \"type\" marked for gold/test SWC file, including marked swc trees",
135+
help="output path of detail metric result, swc format presented.\n"
136+
"identify different type according to metric result for each node",
136137
required=False
137138
)
138139
parser.add_argument(
139140
"--config",
140141
"-C",
141-
help="custom configuration file for the specified metric",
142+
help="path of custom configuration file for the specified metric",
142143
required=False
143144
)
144145
parser.add_argument(
@@ -166,10 +167,9 @@ def set_configs(abs_dir, args):
166167
# argument: metric
167168
metric = get_root_metric(args.metric)
168169
if not metric:
169-
print("\nERROR: The metric '{}' is not supported.".format(args.metric))
170-
print("\nValid options for --metric:\n")
171-
print(get_metric_summary(True))
172-
return 1
170+
raise Exception("\nERROR: The metric '{}' is not supported.".format(args.metric) +
171+
"\nValid options for --metric:\n" +
172+
get_metric_summary(True))
173173

174174
# argument: test
175175
test_swc_paths = [os.path.join(abs_dir, path) for path in args.test]
@@ -245,10 +245,7 @@ def run():
245245
abs_dir = os.path.abspath("")
246246
init(abs_dir)
247247

248-
try:
249-
args = read_parameters()
250-
except:
251-
raise Exception("[Error: ] Error in reading parameters")
248+
args = read_parameters()
252249
gold_swc_tree, test_swc_trees, metric, output_dir, detail_dir, config, is_debug = set_configs(abs_dir, args)
253250

254251
for test_swc_tree in test_swc_trees:

pyneval/io/read_swc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def read_swc_trees(swc_file_paths, tree_name_dict=None):
1717
swc_tree_list = []
1818
if os.path.isfile(swc_file_paths):
1919
if not (swc_file_paths[-4:] == ".swc" or swc_file_paths[-4:] == ".SWC"):
20-
print(swc_file_paths + "is not a tif file")
20+
print(swc_file_paths + "is not a swc file")
2121
return None
2222
swc_tree = SwcTree()
2323
swc_tree.load(swc_file_paths)

0 commit comments

Comments
 (0)