forked from jono-m/OrganoID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrganoID.py
34 lines (28 loc) · 1.09 KB
/
OrganoID.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
# OrganoID.py -- Entry-point for the OrganoID suite.
import argparse
from CommandLine.Augment import Augment
from CommandLine.Run import Run
from CommandLine.Split import Split
from CommandLine.Train import Train
# List of sub-programs.
programs = [Augment, Run, Split, Train]
# Parse sub-program selection
parser = argparse.ArgumentParser(
description="OrganoID: deep learning for organoid image analysis.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
subparsers = parser.add_subparsers(dest="subparser_name")
# Instantiate sub-programs
programs = [program() for program in programs]
# Load sub-program arguments
for program in programs:
program.SetupParser(
subparsers.add_parser(program.Name(),
help=program.Description(),
formatter_class=argparse.ArgumentDefaultsHelpFormatter))
# Parse all command-line arguments.
args = parser.parse_args()
# Run the selected sub-program with the parsed arguments.
for program in programs:
if program.Name() == args.subparser_name:
program.RunProgram(args)
break