def main(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", help="images", nargs="*") parser.add_argument("-o", "--output", help="output directory", type=str, default='temp') parser.add_argument("-f", "--functions", help="functions", nargs="*", default=None) parser.add_argument("-p", "--param", nargs="*", help="parameters", default=[]) args = parser.parse_args() params = ParamParser(args.param).run() if args.functions is None: print help(segment_operation) return holder.args = args args.input = parse_image_files(args.input) caller(args.input, args.output, args.functions, params)
def main(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", help="images", nargs="*") parser.add_argument("-o", "--output", help="output directory", type=str, default='temp') parser.add_argument("-f", "--functions", help="functions", nargs="*") parser.add_argument('-p', '--param', nargs='+', help='parameters', action='append') # parser.add_argument("-p", "--param", nargs="*", help="parameters", default=[]) args = parser.parse_args() if args.functions is None: print help(preprocess_operation) return params = ParamParser(args.param).run() args.input = parse_image_files(args.input) holder.args = args caller(args.input, args.output, args.functions, params)
def main(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--inputs", help="images", nargs="*") parser.add_argument("-l", "--inputs_labels", help="images", nargs="*", default=None) parser.add_argument("-o", "--output", help="output directory", type=str, default='temp') parser.add_argument("-f", "--functions", help="functions", nargs="*") parser.add_argument("-p", "--param", nargs="+", help="parameters", action='append') args = parser.parse_args() params = ParamParser(args.param).run() inputs = parse_image_files(args.inputs) if args.inputs_labels is not None: args.inputs_labels = parse_image_files(args.inputs_labels) caller = _retrieve_caller_based_on_function(args.functions[0]) if len(args.functions) == 1 and args.functions[0] == 'apply': pass # ch_names = operation['ch_names'] if 'ch_names' in operation else images # obj_names = operation['obj_names'] if 'obj_names' in operation else labels # caller(zip(*inputs), zip(*args.inputs_labels), args.output, obj_names, ch_names) elif args.inputs_labels is None: caller(inputs, args.output, args.functions, params=params) else: caller(inputs, args.inputs_labels, args.output, args.functions, params=params)