['p', 'prior', 'prior', 'benson17'], ['f', 'surf-format', 'surface_format', 'curv'], ['F', 'vol-format', 'volume_format', 'mgz'], ['o', 'surf-outdir', 'surface_path', None], ['O', 'vol-outdir', 'volume_path', None], ['y', 'eccen-tag', 'eccen_tag', 'inferred_eccen'], ['w', 'angle-tag', 'angle_tag', 'inferred_angle'], ['l', 'label-tag', 'label_tag', 'inferred_varea'], ['j', 'radius-tag', 'radius_tag', 'inferred_sigma'], ['u', 'registration-name', 'registration_name', 'retinotopy'], ['M', 'max-output-eccen', 'max_out_eccen', '90'], ['I', 'max-input-eccen', 'max_in_eccen', '90'], ['J', 'min-input-eccen', 'min_in_eccen', '0'], ['d', 'subjects-dir', 'subjects_dir', None]] _retinotopy_parser = pimms.argv_parser(_retinotopy_parser_instructions) def _guess_surf_file(fl): # MGH/MGZ files try: return fsmgh.load(fl).get_data().flatten() except: pass # FreeSurfer Curv files try: return fsio.read_morph_data(fl) except: pass # Nifti files try: return np.squeeze(nib.load(fl).get_data()) except: raise ValueError('Could not determine filetype for: %s' % fl) def _guess_vol_file(fl): # MGH/MGZ files try: return fsmgh.load(fl) except: pass
('v', 'verbose', 'verbose', False), ('x', 'no-volume-export', 'no_vol_export', False), ('z', 'no-surface-export', 'no_surf_export', False), ('n', 'no-overwrite', 'no_overwrite', False), # Options ('e', 'eccen-tag', 'eccen_tag', 'benson14_eccen'), ('a', 'angle-tag', 'angle_tag', 'benson14_angle'), ('l', 'label-tag', 'label_tag', 'benson14_varea'), ('s', 'sigma-tag', 'sigma_tag', 'benson14_sigma'), ('d', 'subjects-dir', 'subjects_dir', None), ('t', 'template', 'template', 'benson14'), ('o', 'surf-format', 'surf_format', 'curv'), ('v', 'vol-format', 'vol_format', 'mgz'), ('R', 'reg', 'registration', 'fsaverage') ] _benson14_parser = pimms.argv_parser(_benson14_parser_instructions) def main(*args): ''' benson14_retinotopy.main(args...) runs the benson14_retinotopy command; see benson14_retinotopy.info for more information. ''' # Parse the arguments... (args, opts) = _benson14_parser(*args) # help? if opts['help']: print(info, file=sys.stdout) return 1 # verbose? if opts['verbose']:
be processed as flags or options, even if they begin with a -. ''' _surface_to_ribbon_parser_instructions = [ # Flags ('h', 'help', 'help', False), ('v', 'verbose', 'verbose', False), # Options ['l', 'lh', 'lh_file', None], ['r', 'rh', 'rh_file', None], ['i', 'image', 'image', None], ['f', 'fill', 'fill', 0], ['m', 'method', 'method', 'auto'], ['t', 'type', 'dtype', None], ['d', 'subjects-dir', 'subjects_dir', None] ] _surface_to_ribbon_parser = pimms.argv_parser( _surface_to_ribbon_parser_instructions) def read_surf_file(flnm): if flnm.endswith(".mgh") or flnm.endswith(".mgz"): data = np.array(fsmgh.load(flnm).dataobj).flatten() else: data = fsio.read_morph_data(flnm) return data def main(args): ''' surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are