forked from 05dirnbe/nefi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnefi2.py
executable file
·44 lines (39 loc) · 1.5 KB
/
nefi2.py
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
#!/usr/bin/env python3
import argparse
import os
import sys
# chdir to ~/.nefi2 before local imports
# uncomment this for compiling builds
if not (sys.platform == 'win32' or sys.platform == 'win64'):
os.chdir(os.path.dirname(os.path.realpath(__file__)))
from nefi2.main import Main
def runner(args):
"""
Load all available categories and algorithms into the pipeline.
Args:
| *args* : a Namespace object of supplied command-line arguments
"""
if args.dir or args.file:
Main.batch_mode(args)
else:
Main.gui_mode()
if __name__ == '__main__':
prs = argparse.ArgumentParser(description="""NEFI2 is a tool created to
extract networks from images. Given a suitable 2D image of a network as
input, NEFI2 outputs a mathematical representation of the structure of the
depicted network as a weighted undirected planar graph.""")
prs.add_argument('-p', '--pipeline',
help='Specify a saved pipeline xml file.',
required=False)
prs.add_argument('-d', '--dir',
help='Specify a directory with images '
'for batch processing.',
required=False)
prs.add_argument('-f', '--file',
help='Specify an image file to process.',
required=False)
prs.add_argument('-o', '--out',
help='Specify output directory.',
required=False)
arguments = prs.parse_args()
runner(arguments)