-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (54 loc) · 1.9 KB
/
main.py
File metadata and controls
64 lines (54 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
Run the complete workflow for the centerline computation from terminal
"""
import argparse
import json
from vessel_centerline.centerline_io import centerline_complete_workflow
def parse_args():
parser = argparse.ArgumentParser(description="Compute centerlines with VTK")
parser.add_argument(
"--search-points",
action="store_true",
help="Get the coordinates of all the cap centers that are automatically found by the algorithm. You can use this coordinates to chose input and target points",
)
parser.add_argument(
"--model-path",
type=str,
help="path to 3D vessel model, must be .stl or .vtp file",
)
parser.add_argument(
"--source-point",
default=None,
type=json.loads,
help="coordinates of centerline source point [x, y, z]",
)
parser.add_argument(
"--target-points",
default=None,
nargs="*",
type=json.loads,
help="coordinates of centerline target points, list of lists: [[x1, y1, z1],[x2, y2, x2], ...]",
)
parser.add_argument(
"--source-orientation",
default=None,
type=str,
help="orientation of the source point on the model: 'up', 'down', 'left' or 'right'",
)
args = parser.parse_args()
assert (
(args.source_point and args.target_points)
or args.source_orientation
or args.search_points
), "you must specify source and target points coordinates or source orientation, otherwise you can search for points coordinates with find-points option"
return args
if __name__ == "__main__":
args = parse_args()
centerline_complete_workflow(
model_path=args.model_path,
search_points=args.search_points,
source_point=args.source_point,
target_points=args.target_points,
source_orientation=args.source_orientation,
save_output_files=True,
)