def run(self): opts, args = self.parse_args() if args: vrange = parseVolRangeOption(opts.vol_range, self) try: image = readImage(args[0], vrange=vrange) except: image = None print 'Could not find image %s, try loading manually' % args[0] else: image = None recon_gui(image=image, logfile=opts.log_file)
def run(self): opts, args = self.parse_args() if args: vrange = parseVolRangeOption(opts.vol_range, self) try: image = readImage(args[0], vrange=vrange) except: image = None print 'Could not find image %s, try loading manually'%args[0] else: image = None recon_gui(image=image, logfile=opts.log_file)
def getOptions(self): """ Bundle command-line arguments and options into a single options object, including a resolved list of callable data operations. Uses OptionParser to fill in the options list from command line input; appends volume range specifications, and input/output directories as options; asks for an index of requested operations from configureOperations() """ options, args = self.parse_args() options.vrange = parseVolRangeOption(options.vol_range, self) # Two usages are special cases: # oplist example will be handled after an oplist is found.. # operation help doesn't require arguments, so handle it here if options.ophelp is not None: self._printOpHelp(options.ophelp) sys.exit(0) if options.opsexample: if not args: self.error("You must provide a fid-directory to get an example oplist") # just append a false output file name to be safe args.append("foo") # Recon can be run with these combos defined: # (_, _) (first logic stage, try to find fid files in pwd) # (args, _) (2nd logic stage, try to find default oplist) # (_, oplist) (3rd logic stage, try a couple things here) # (args,oplist) (last stage, not ambiguous) if not options.oplist and len(args) != 2: try: args = self._argsFromPWD() except: self.print_help() sys.exit(0) if not options.oplist: options.oplist = self._findOplist(args[0]) options.operations = self.configureOperations(open(options.oplist,'r')) if len(args) != 2: # only care if we need to set up ReadImage and WriteImage later if not (self._running('ReadImage', options.operations) and \ self._running('WriteImage', options.operations)): args = self._argsFromPWD() if not self._running('ReadImage', options.operations): # append ReadImage op to BEGINNING of list op_args = {'filename': os.path.abspath(args[0]), 'vrange': options.vrange} opclass = self._opmanager.getOperation('ReadImage') options.operations.insert(0,(opclass, op_args)) if not self._running('WriteImage', options.operations): op_args = {'filename': os.path.abspath(args[1]), 'suffix': options.suffix, 'filedim': options.filedim, 'format': options.file_format, 'datatype': options.output_datatype} opclass = self._opmanager.getOperation('WriteImage') options.operations.append((opclass, op_args)) # run some checks on the operations sequence self.confirmOps(options.operations) if options.fastArray: global _FAST_ARRAY _FAST_ARRAY = True return options