Esempio n. 1
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.gvars = SUBJ.VarsObject('uber_proc gui vars')
        self.vars = SUBJ.VarsObject('uber_proc vars')

        # rcr -delete
        self.SSD = None

        self.gvars.centralW = QtGui.QWidget()

        self.init_proc_vars()

        self.gvars.wlist = []
        self.add_initial_widgets()
        self.add_single_subj_widgets()
        self.add_group_widgets()
        self.add_subject_list_widget()

        # then add all of these into a main layout
        self.gvars.vbox = QtGui.QVBoxLayout(self.gvars.centralW)
        for w in self.gvars.wlist:
            self.gvars.vbox.addWidget(w)
        self.setCentralWidget(self.gvars.centralW)

        self.vars.stat_mesg = 'Ready'
        if self.vars.verb > 1: self.vars.show(self.vars.stat_mesg)
        self.update_status_bar()
Esempio n. 2
0
    def __init__(self, cvars=None, uvars=None):

        # ------------------------------------------------------------
        # variables

        # LV: variables local to this interface, not passed
        self.LV = SUBJ.VarsObject("local AP_Subject vars")
        self.LV.indent = 8  # default indent for main options
        self.LV.istr = ' ' * self.LV.indent
        self.LV.retdir = ''  # return directory (for jumping around)

        # merge passed user variables with defaults
        self.cvars = g_ctrl_defs.copy()
        self.uvars = g_user_defs.copy()
        self.cvars.merge(cvars, typedef=g_ctrl_defs)
        self.uvars.merge(uvars, typedef=g_user_defs)

        # output variables
        self.rvars = g_res_defs.copy()  # init result vars
        self.align_script = ''  # resulting script
        self.errors = []  # list of error strings
        self.warnings = []  # list of warning strings
        # ------------------------------------------------------------

        # ------------------------------------------------------------
        # preperatory settings

        if self.check_inputs(): return  # require at least anat and epi

        self.set_directories()  # data dirs: anat, epi

        if self.uvars.verb > 3: self.LV.show('ready to start script')

        # do the work
        self.create_script()
Esempio n. 3
0
    def cb_clear_options(self):
        """set uvars from defaults and redisplay GUI
         EXCEPT: keep dataset fields from subject"""

        uvars = SUBJ.VarsObject()
        for atr in ['anat', 'epi', 'epi_base']:
            uvars.set_var(atr, self.uvars.val(atr))

        self.reset_vars(uvars=uvars, set_pdir=self.set_pdir)
Esempio n. 4
0
   def process_options(self):

      argv = sys.argv

      if len(argv) == 0:        # non-gui out
         print g_command_help
         return 1

      # process any optlist_ options
      self.valid_opts.check_special_opts(argv)

      # process terminal options without the option_list interface
      # (so that errors are not reported)

      # if no arguments are given, apply -help
      if len(argv) <= 1 or '-help' in argv:
         print g_command_help
         return 1

      if '-hist' in argv:
         print CLUST.g_history
         return 1

      if '-show_default_cvars' in argv:
         CLUST.g_ctrl_defs.show('')
         return 1

      if '-show_default_uvars' in argv:
         CLUST.g_user_defs.show('')
         return 1

      if '-show_valid_opts' in argv:
         self.valid_opts.show('', 1)
         return 1

      if '-ver' in argv:
         print CLUST.g_version
         return 1

      # ============================================================
      # read options specified by the user
      self.user_opts = OPT.read_options(argv, self.valid_opts)
      uopts = self.user_opts            # convenience variable
      if not uopts: return -1           # error condition

      # ------------------------------------------------------------
      # init subject options struct

      self.cvars = SUBJ.VarsObject('control vars from command line')
      self.uvars = SUBJ.VarsObject('user vars from command line')

      val, err = uopts.get_type_opt(int, '-verb')
      if val != None and not err: self.verb = val

      SUBJ.set_var_str_from_def('cvars', 'verb', ['%d'%self.verb], self.cvars,
                                 defs=CLUST.g_ctrl_defs)

      # first process all setup options
      errs = 0
      for opt in uopts.olist:
         # skip -verb (any terminal option should block getting here)
         if opt.name == '-verb':                continue

         # and skip and post-setup options (print command, save, etc.)
         elif opt.name == '-print_script':      continue
         elif opt.name == '-save_script':       continue

         # now go after "normal" options

         elif opt.name == '-on_surface':
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1
            if self.cvars.set_var_with_defs(opt.name[1:],val,CLUST.g_ctrl_defs,
                        as_type=1, oname='cvars', verb=self.verb) < 0:
               errs += 1
               continue

         # cvar requires at least 2 parameters, name and value
         elif opt.name == '-cvar':
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1
            # go after verb, in particular
            if val[0] == 'verb':
               try: self.verb = int(val[1])
               except:
                  print "** failed to set 'verb' level"
                  errs += 1
                  continue
            # and set it from the form name = [value_list]
            if SUBJ.set_var_str_from_def('cvars', val[0], val[1:], self.cvars,
                        CLUST.g_ctrl_defs, verb=self.verb) < 0:
               errs += 1
               continue

         # uvar requires at least 2 parameters, name and value
         elif opt.name == '-uvar':
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1
            # and set it from the form name = [value_list]
            if SUBJ.set_var_str_from_def('uvars', val[0], val[1:], self.uvars,
                        CLUST.g_user_defs, verb=self.verb) < 0:
               errs += 1
               continue

         else:
            print '** unknown option %s' % opt.name
            errs += 1

      if self.verb > 2:
         print '-' * 75
         self.uvars.show('post-init uvars', name=0)
         self.cvars.show('post-init cvars', name=0)
         print '-' * 75

      if errs:    return -1
      else:       return  0     # no error, and continue on return
Esempio n. 5
0
    def process_options(self):
        """return  1 on valid and exit
                 0 on valid and continue
                -1 on invalid
      """

        argv = sys.argv

        # a quick out (no help, continue and open GUI)
        if len(argv) == 0: return 0

        # process any optlist_ options
        self.valid_opts.check_special_opts(argv)

        # ------------------------------------------------------------
        # check for terminal options before processing the rest
        if '-help' in argv:
            print g_command_help
            return 1

        if '-help_gui' in argv:
            print LTT.helpstr_gui
            return 1

        if '-help_todo' in argv:
            print LTT.helpstr_todo
            return 1

        if '-hist' in argv:
            print LTT.g_history
            return 1

        if '-show_default_vars' in argv:
            LTT.g_user_defs.show('default uvars :')
            return 1

        if '-show_valid_opts' in argv:
            self.valid_opts.show('', 1)
            return 1

        if '-show_cvar_dict' in sys.argv:
            dict = LTT.g_cvar_dict
            keys = dict.keys()
            keys.sort()
            for key in keys:
                print '   %-20s : %s' % (key, dict[key])
            return 1

        if '-show_uvar_dict' in sys.argv:
            dict = LTT.g_uvar_dict
            keys = dict.keys()
            keys.sort()
            for key in keys:
                print '   %-20s : %s' % (key, dict[key])
            return 1

        if '-ver' in argv:
            print 'uber_ttest.py: version %s' % LTT.g_version
            return 1

        # ------------------------------------------------------------
        # read and process user options (no check for terminal opts)
        self.uopts = OPT.read_options(argv, self.valid_opts)
        if not self.uopts: return -1
        uopts = self.uopts  # convenience

        # init subject options struct
        self.cvars = SUBJ.VarsObject('control vars from command line')
        self.uvars = SUBJ.VarsObject('user vars from command line')
        self.guiopts = ['uber_ttest.py']

        # first set verbose level
        val, err = uopts.get_type_opt(int, '-verb')
        if val != None and not err: self.verb = val
        else: self.verb = 1

        SUBJ.set_var_str_from_def('cvars',
                                  'verb', ['%d' % self.verb],
                                  self.cvars,
                                  defs=LTT.g_ctrl_defs)

        use_gui = 1  # assume GUI unless we hear otherwise
        cvar_keys = LTT.g_cvar_dict.keys()
        uvar_keys = LTT.g_uvar_dict.keys()

        # we already processed terminal options
        term_opts = [
            '-help', '-help_gui', '-help_todo', '-hist', 'show_default_vars',
            '-ver', '-show_cvar_dict', '-show_uvar_dict'
        ]

        # skip post-setup options, to be checked later
        post_opts = ['-print_script', '-save_script']

        # first process all setup options
        errs = 0
        for opt in uopts.olist:

            # skip -verb (any terminal option should block getting here)
            if opt.name in term_opts: continue

            # and skip and post-setup options (print command, save, etc.)
            if opt.name in post_opts: continue

            vname = opt.name[1:]

            # now go after "normal" options

            if opt.name == '-no_gui':
                use_gui = 0
                continue

            # get any PyQt4 options
            elif opt.name == '-qt_opts':
                val, err = uopts.get_string_list('', opt=opt)
                if val != None and err:
                    errs += 1
                    continue
                self.guiopts.extend(val)

            # cvar requires at least 2 parameters, name and value
            elif opt.name == '-cvar':
                val, err = uopts.get_string_list('', opt=opt)
                if val != None and err:
                    errs += 1
                    continue
                if self.cvars.set_var_with_defs(val[0],
                                                val[1:],
                                                LTT.g_ctrl_defs,
                                                oname='cvars',
                                                verb=self.verb) < 0:
                    errs += 1
                    continue

            # uvar requires at least 2 parameters, name and value
            elif opt.name == '-uvar':
                val, err = uopts.get_string_list('', opt=opt)
                if val != None and err:
                    errs += 1
                    continue
                if self.uvars.set_var_with_defs(val[0],
                                                val[1:],
                                                LTT.g_user_defs,
                                                oname='uvars',
                                                verb=self.verb) < 0:
                    errs += 1
                    continue

            # maybe this is a control variable key
            elif vname in cvar_keys:
                val, err = uopts.get_string_list('', opt=opt)
                if val == None or err:
                    errs += 1
                    continue
                if self.cvars.set_var_with_defs(
                        vname, val, LTT.g_ctrl_defs, oname='cvars',
                        verb=self.verb) < 0:
                    errs += 1
                    continue

            # maybe this is a user variable key
            elif vname in uvar_keys:
                val, err = uopts.get_string_list('', opt=opt)
                if val == None or err:
                    errs += 1
                    continue
                if self.uvars.set_var_with_defs(
                        vname, val, LTT.g_user_defs, oname='uvars',
                        verb=self.verb) < 0:
                    errs += 1
                    continue

            else:
                print '** invalid option: %s' % opt.name
                errs += 1
                continue

        if not errs:  # then we can handle any processing options
            if uopts.find_opt('-print_script'):
                self.print_script()
                use_gui = 0

            #opt = uopts.find_opt('-save_script')
            #if opt != None:
            #   val, err = uopts.get_string_opt('', opt=opt)
            val, err = uopts.get_string_opt('-save_script')
            if val != None and not err:
                self.save_script(val)
                use_gui = 0

        if errs: return -1
        if use_gui: return 0  # continue and open GUI
        else: return 1  # no error, but terminate on return
Esempio n. 6
0
g_version = '0.0 (May 12, 2011)'

# ----------------------------------------------------------------------
# global definition of default processing blocks
g_tlrc_base_list = [
    'TT_N27+tlrc', 'TT_avg152T1+tlrc', 'TT_icbm452+tlrc', 'MNI_avg152T1+tlrc'
]
g_def_tlrc_base = 'TT_N27+tlrc'

# ----------------------------------------------------------------------
# global definitions of result, control and user defaults
# (as well as string versions of control and user defaults)

# ---- resulting values returned after class actions ----
g_res_defs = SUBJ.VarsObject("uber_skel result variables")
g_res_defs.file_proc = ''  # file name for process script
g_res_defs.output_proc = ''  # output from running proc script

# ---- control variables: process control, not set by user in GUI

g_ctrl_defs = SUBJ.VarsObject("uber_skel control defaults")
g_ctrl_defs.proc_dir = '.'  # process dir: holds scripts and result dir

# ---- user variables: process control, alignment inputs and options ----

g_user_defs = SUBJ.VarsObject("uber_skel user defaults")
g_user_defs.verb = 1  # verbose level
g_user_defs.copy_scripts = 'yes'  # do we make .orig copies of scripts?

# required inputs
Esempio n. 7
0
def process_options(valid_opts, argv):
    """return status and VarsObject structs of subject and control variables

        - given list of valid options, read and process the user options
        - if terminal option or -no_gui, return 0 (succesful quit)

      return  1 : on success and terminate
              0 : on success and continue with GUI
             -1 : on error condition
   """

    # a quick out
    if len(argv) == 0: return 0, None, None, None

    # process any optlist_ options
    valid_opts.check_special_opts(argv)

    # ------------------------------------------------------------
    # check for terminal options before processing the rest
    if '-help' in sys.argv:
        print g_command_help
        valid_opts.show('', 1, show_count=0)
        print g_help_trailer
        return 1, None, None, None

    if '-help_gui' in sys.argv:
        print USUBJ.helpstr_usubj_gui
        return 1, None, None, None

    if '-help_howto_program' in sys.argv:
        print USUBJ.helpstr_howto_program
        return 1, None, None, None

    if '-help_install' in sys.argv:
        print g_install_str
        return 1, None, None, None

    if '-help_install_nokia' in sys.argv:
        print g_install_nokia
        return 1, None, None, None

    if '-hist' in sys.argv:
        print USUBJ.g_history
        return 1, None, None, None

    if '-show_default_vars' in sys.argv:
        USUBJ.g_ctrl_defs.show('default cvars :')
        USUBJ.g_subj_defs.show('default svars :')
        return 1, None, None, None

    if '-show_valid_opts' in sys.argv:
        valid_opts.show('', 1)
        return 1, None, None, None

    if '-show_svar_dict' in sys.argv:
        dict = USUBJ.g_svar_dict
        keys = dict.keys()
        keys.sort()
        for key in keys:
            print '   %-20s : %s' % (key, dict[key])
        return 1, None, None, None

    if '-todo' in sys.argv:
        print USUBJ.helpstr_todo
        return 1, None, None, None

    if '-ver' in sys.argv:
        print 'uber_subject.py: version %s' % USUBJ.g_version
        return 1, None, None, None

    # ------------------------------------------------------------
    # read and process user options (no check for terminal opts)
    uopts = OPT.read_options(argv, valid_opts)
    if not uopts: return -1, None, None, None

    # init subject options struct
    svars = SUBJ.VarsObject('subject vars from command line')
    cvars = SUBJ.VarsObject('control vars from command line')
    guiopts = ['uber_subject.py']

    # first set verbose level
    val, err = uopts.get_type_opt(int, '-verb')
    if val != None and not err: verb = val
    else: verb = 1

    USUBJ.set_vstr_from_def('cvars', 'verb', ['%d' % verb], cvars)

    use_gui = 1  # assume GUI unless we hear otherwise
    svar_keys = USUBJ.g_svar_dict.keys()

    errs = 0

    # ------------------------------------------------------------
    # first process all setup options (e.g. -anal_type/domain)
    # - since they might go via -svar, we must search
    for opt in uopts.olist:
        # just check for 'rest' here
        if opt.name == '-anal_type':
            val, err = uopts.get_string_opt('', opt=opt)
            if val == None or err: return -1, None, None, None
            if val == 'rest':
                if verb > 1: print '-- init from rest defaults'
                svars.merge(USUBJ.g_rdef_strs)
        elif opt.name == '-anal_domain':
            val, err = uopts.get_string_opt('', opt=opt)
            if val == None or err: return -1, None, None, None
            if val == 'surface':
                print '** uber_subject.py: not ready for surface analysis'
                return -1, None, None, None

        elif opt.name == '-svar':
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1, None, None, None
            if val[0] == '-anal_type':
                if val[1] == 'rest':
                    if verb > 1: print '-- init from rest defaults'
                    svars.merge(USUBJ.g_rdef_strs)
            elif val[0] == '-anal_domain':
                if val[1] == 'surface':
                    print '** uber_subject.py: not ready for surface analysis'
                    return -1, None, None, None

    # done with analysis init options
    # ------------------------------------------------------------

    for opt in uopts.olist:
        # skip -verb and any terminal option (though they should not be here)
        if opt.name == '-help': continue
        elif opt.name == '-help_gui': continue
        elif opt.name == '-hist': continue
        elif opt.name == '-show_valid_opts': continue
        elif opt.name == '-todo': continue
        elif opt.name == '-ver': continue

        elif opt.name == '-verb':
            continue

            # and skip any pre-setup options ...
        elif opt.name == '-anal_type':
            continue
        elif opt.name == '-anal_domain':
            continue

            # and skip any post-setup options ...
        elif opt.name == '-print_ap_command':
            continue
        elif opt.name == '-save_ap_command':
            continue
        elif opt.name == '-exec_ap_command':
            continue
        elif opt.name == '-exec_proc_script':
            continue

        vname = opt.name[1:]

        # now go after "normal" options

        if opt.name == '-no_gui':
            use_gui = 0
            continue

        # get any PyQt4 options
        elif opt.name == '-qt_opts':
            val, err = uopts.get_string_list('', opt=opt)
            if val != None and err: return -1, None, None, None
            guiopts.extend(val)

        # cvar requires at least 2 parameters, name and value
        elif opt.name == '-cvar':
            val, err = uopts.get_string_list('', opt=opt)
            if val != None and err: return -1, None, None, None
            # and set it from the form name = [value_list]
            if USUBJ.set_vstr_from_def(
                    'cvars', val[0], val[1:], cvars, verb=verb, spec=1) < 0:
                errs += 1
                continue

        # svar requires at least 2 parameters, name and value
        elif opt.name == '-svar':
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1, None, None, None
            # and set it from the form name = [value_list]
            if USUBJ.set_vstr_from_def(
                    'svars', val[0], val[1:], svars, verb=verb, spec=1) < 0:
                errs += 1
                continue

        # go after a direct svar key
        elif vname in svar_keys:
            val, err = uopts.get_string_list('', opt=opt)
            if val == None or err: return -1, None, None, None
            if USUBJ.set_vstr_from_def(
                    'svars', vname, val, svars, verb=verb, spec=1) < 0:
                errs += 1
                continue

        else:
            print '** invalid option: %s' % opt.name
            errs += 1
            continue

    if not errs:  # then we can handle any processing options
        if uopts.find_opt('-print_ap_command'):
            print_ap_command(svars, cvars)

    if not errs:  # then we can handle any processing options
        opt = uopts.find_opt('-save_ap_command')
        if opt != None:
            val, err = uopts.get_string_opt('', opt=opt)
            if val == None or err: return -1, None, None, None
            save_ap_command(svars, cvars, val)

    if not errs:  # then we can handle any processing options
        if uopts.find_opt('-exec_ap_command'):
            subj = run_ap_command(svars, cvars)
            if subj != None and uopts.find_opt('-exec_proc_script'):
                subj.exec_proc_script()

    if verb > 2:  # show applied subject variables
        changestr = cvars.changed_attrs_str(USUBJ.g_cdef_strs,
                                            skiplist='name',
                                            showskip=0,
                                            showdel=0)
        print '++ applied control variables: %s\n' % changestr
        changestr = svars.changed_attrs_str(USUBJ.g_sdef_strs,
                                            skiplist='name',
                                            showskip=0,
                                            showdel=0)
        print '++ applied subject variables: %s\n' % changestr

    if errs: return -1, None, None, None
    if use_gui: return 0, svars, cvars, guiopts
    else: return 1, svars, cvars, guiopts
Esempio n. 8
0
   def process_options(self):
      """return  1 on valid and exit
                 0 on valid and continue
                -1 on invalid
      """

      argv = sys.argv

      # a quick out (no help, continue and open GUI)
      if len(argv) == 0: return 0

      # process any optlist_ options
      self.valid_opts.check_special_opts(argv)

      # ------------------------------------------------------------
      # check for terminal options before processing the rest
      if '-help' in argv:
         print g_command_help
         return 1

      if '-help_gui' in argv:
         print USKEL.helpstr_gui
         return 1

      if '-help_howto_program' in argv:
         print USKEL.helpstr_create_program
         return 1

      if '-help_todo' in argv:
         print USKEL.helpstr_todo
         return 1

      if '-hist' in argv:
         print USKEL.g_history
         return 1

      if '-show_default_vars' in argv:
         USKEL.g_user_defs.show('default uvars :')
         return 1

      if '-show_valid_opts' in argv:
         self.valid_opts.show('', 1)
         return 1

      if '-ver' in argv:
         print 'uber_skel.py: version %s' % USKEL.g_version
         return 1

      # ------------------------------------------------------------
      # read and process user options (no check for terminal opts)
      self.uopts = OPT.read_options(argv, self.valid_opts)
      if not self.uopts: return -1
      uopts = self.uopts # convenience

      # init subject options struct
      self.cvars = SUBJ.VarsObject('control vars from command line')
      self.uvars = SUBJ.VarsObject('user vars from command line')
      self.guiopts = ['uber_skel.py']

      # first set verbose level
      val, err = uopts.get_type_opt(int, '-verb')
      if val != None and not err: self.verb = val
      else: self.verb = 1

      SUBJ.set_var_str_from_def('uvars', 'verb', ['%d'%self.verb], self.uvars,
                                 defs=USKEL.g_user_defs)

      use_gui = 1 # assume GUI unless we hear otherwise

      # first process all setup options
      errs = 0
      for opt in uopts.olist:
         # skip -verb (any terminal option should block getting here)
         if opt.name == '-verb':                continue

         # and skip and post-setup options (print command, save, etc.)
         elif opt.name == '-print_script':      continue
         elif opt.name == '-save_script':       continue

         # now go after "normal" options

         if opt.name == '-no_gui':
            use_gui = 0
            continue

         # get any PyQt4 options
         elif opt.name == '-qt_opts':
            val, err = uopts.get_string_list('', opt=opt)
            if val != None and err: return -1
            self.guiopts.extend(val)

         # cvar requires at least 2 parameters, name and value
         elif opt.name == '-cvar':
            val, err = uopts.get_string_list('', opt=opt)
            if val != None and err: return -1
            # and set it from the form name = [value_list]
            if SUBJ.set_var_str_from_def('cvars', val[0], val[1:], self.cvars,
                        USKEL.g_ctrl_defs, verb=self.verb) < 0:
               errs += 1
               continue

         # uvar requires at least 2 parameters, name and value
         elif opt.name == '-uvar':
            val, err = uopts.get_string_list('', opt=opt)
            if val != None and err: return -1
            # and set it from the form name = [value_list]
            if SUBJ.set_var_str_from_def('uvars', val[0], val[1:], self.uvars,
                        USKEL.g_user_defs, verb=self.verb) < 0:
               errs += 1
               continue

      if not errs:         # then we can handle any processing options
         if uopts.find_opt('-print_script'): self.print_script()

      if not errs:         # then we can handle any processing options
         opt = uopts.find_opt('-save_script')
         if opt != None:
            val, err = uopts.get_string_opt('', opt=opt)
            if val != None and not err: self.save_script(val)

      if errs:    return -1
      if use_gui: return  0     # continue and open GUI
      else:       return  1     # no error, but terminate on return
Esempio n. 9
0
    1.1  18 Oct, 2012: minor updates to match library changes
"""

g_version = '1.1 (October 18, 2012)'

# ----------------------------------------------------------------------
# global definitions

g_prog_list = ['3dttest++', '3dMEMA']

# ----------------------------------------------------------------------
# global definitions of result, control and user defaults
# (as well as string versions of control and user defaults)

# ---- resulting values returned after class actions ----
g_res_defs = SUBJ.VarsObject("uber_ttest result variables")
g_res_defs.file_proc = ''  # file name for process script
g_res_defs.output_proc = ''  # output from running proc script

# ---- control variables: process control, not set by user in GUI

g_ctrl_defs = SUBJ.VarsObject("uber_ttest control defaults")
g_ctrl_defs.proc_dir = '.'  # process dir: holds scripts and result dir
g_ctrl_defs.verb = 1  # verbose level
g_ctrl_defs.copy_scripts = 'yes'  # make .orig copies of scripts?
g_ctrl_defs.results_dir = 'test.results'  # output directory for results

# control varaible dictionary, for command line options
g_cvar_dict = {
    'proc_dir': 'set processing dir to hold scripts',
    'verb': 'set verbose level',
Esempio n. 10
0
    def __init__(self, parent=None, cvars=None, uvars=None, set_pdir=0):
        super(MainWindow, self).__init__(parent)

        # ------------------------------
        # init main vars structs
        self.atest = None  # AlignTest class element
        self.gvars = SUBJ.VarsObject('uber_subject gui vars')

        # init verb and try to update from uvars
        self.verb = 1
        if uvars != None:  # try to update verb from uvars
            if uvars.valid('verb'):
                try:
                    self.verb = int(uvars.verb)
                except:
                    print '** UAT Main: bad uvars.verb = %s' % uvars.verb

        # initialize the subject variables to defaults, update at the end
        self.cvars = USKEL.g_cdef_strs.copy('GUI control vars')
        self.uvars = USKEL.g_udef_strs.copy('GUI user vars')

        self.set_pdir = set_pdir

        # ------------------------------
        # L1 - main menubar and layout
        self.add_menu_bar()
        self.add_tool_bar()
        self.add_status_bar()
        self.gvars.Wcentral = QtGui.QWidget()
        mainlayout = QtGui.QVBoxLayout(self.gvars.Wcentral)

        # ------------------------------
        # L2 - make top Group Box and Vertical Layout; add to main Layout
        self.make_l2_widgets()

        # ------------------------------
        # L3 - fill m2_vlayout with group boxes
        self.make_l3_group_boxes()

        # ------------------------------------------------------------
        # finish level 2 and then level 1
        mainlayout.addWidget(self.gvars.gbox_datasets)
        mainlayout.addWidget(self.gvars.m2_scroll)

        # ------------------------------
        # save this for last to ensure it is all visible
        self.gvars.m2_scroll.setWidget(self.gvars.m2_gbox_inputs)

        self.gvars.Wcentral.setMinimumSize(350, 400)
        self.gvars.Wcentral.setLayout(mainlayout)
        self.setCentralWidget(self.gvars.Wcentral)

        self.make_extra_widgets()

        self.gvars.style = g_styles[g_style_index_def]

        # widgets are done, so apply pass subject vars
        self.reset_vars(cvars=cvars, uvars=uvars, set_pdir=set_pdir)

        # status : 0 = must create script, 1 = have script, ready to execute
        #         -1 = script failure?
        self.status = 0

        if self.verb > 1: print '-- finished Single Subject Dialog setup'
Esempio n. 11
0
    0.10 21 Aug, 2012: added 'sigma' uvar, for SurfSmooth
    0.11 02 Jun, 2014: changed default niter from 20 to 1000
                       (20 was more of a quick test, but 1000 is appropriate)
"""

g_version = '0.11 (June 2, 2014)'

# ----------------------------------------------------------------------
# global values to apply as defaults

# ----------------------------------------------------------------------
# global definitions of result, control and user defaults
# (as well as string versions of control and user defaults)

# ---- resulting values returned after class actions ----
g_res_defs = SUBJ.VarsObject("slow_surf_clustsim result variables")
g_res_defs.file_proc     = ''   # file name for process script
g_res_defs.output_proc   = ''   # output from running proc script

# ---- control variables: process control, not set by user in GUI

g_ctrl_defs = SUBJ.VarsObject("slow_surf_clustsim control defaults")
g_ctrl_defs.verb         = 1     # verbose level
g_ctrl_defs.proc_dir     = '.'   # process dir: holds scripts and result dir
g_ctrl_defs.time_process = 'yes' # run /usr/bin/time on commands?
                                 # rcr - default to 'no'
g_ctrl_defs.on_surface   = 'no'  # default to starting from the volume
g_ctrl_defs.nsteps       = 10
g_ctrl_defs.keepblocks   = 10    # number of iteration block outputs to keep

# ---- user variables: process control, alignment inputs and options ----