コード例 #1
0
ファイル: neuro_deconvolve.py プロジェクト: pmolfese/afni
    def process_opts(self):
        """apply each option"""

        # ----------------------------------------
        # set verb first
        self.verb,err = self.user_opts.get_type_opt(int, '-verb')
        if err: return 1
        if self.verb == None: self.verb = gDEF_VERB

        # ----------------------------------------
        # required args

        self.infiles, err = self.user_opts.get_string_list('-infiles')
        if self.infiles == None or err: return 1

        # ----------------------------------------
        # optional arguments

        val, err = self.user_opts.get_string_opt('-kernel')
        if err: return 1
        if val != None: self.kernel = val

        val, err = self.user_opts.get_string_opt('-kernel_file')
        if err: return 1
        if val != None: self.kfile = val

        val, err = self.user_opts.get_string_opt('-mask_dset')
        if err: return 1
        if val != None: self.maskset = val

        # allow use of old method
        if self.user_opts.find_opt('-old'): self.stype = 'old'

        val, err = self.user_opts.get_string_opt('-outdir')
        if err: return 1
        if val != None: self.outdir = val

        val, err = self.user_opts.get_string_opt('-prefix')
        if err: return 1
        if val != None: self.prefix = val

        self.script, err = self.user_opts.get_string_opt('-script')
        if self.script == None or err: return 1

        val,err = self.user_opts.get_type_opt(float, '-tr')
        if err: return 1
        if val != None: self.tr = val

        val,err = self.user_opts.get_type_opt(int, '-tr_nup')
        if err: return 1
        if val != None: self.tr_nup = val

        # ----------------------------------------
        # check over the inputs

        if len(self.infiles) < 1:
           print '** missing option -infiles'
           return 1

        # check over -input as an AFNI dataset
        self.aname = BASE.afni_name(self.infiles[0])
        if self.aname == None: return 1
        if self.verb > 2: self.aname.show()

        if self.aname.type == '1D':
            if self.tr == None:
                print '** -tr is required if the input is in 1D format'
            self.reps = UTIL.max_dim_1D(self.infiles[0])
        else:
            if self.aname.type != 'BRIK':
                print "** unknown 'type' for -input '%s'" % self.infiles[0]
            err,self.reps,self.tr =     \
                UTIL.get_dset_reps_tr(self.aname.pv(),self.verb)
            if err: return 1

        if self.verb > 1:
            print '-- using kernel %s, kfile %s, tr = %s, reps = %s' %  \
                  (self.kernel, self.kfile, self.tr, self.reps)

        return None
コード例 #2
0
ファイル: neuro_deconvolve.py プロジェクト: farkau/afni
    def process_opts(self):
        """apply each option"""

        # ----------------------------------------
        # set verb first
        self.verb,err = self.user_opts.get_type_opt(int, '-verb')
        if err: return 1
        if self.verb == None: self.verb = gDEF_VERB

        # ----------------------------------------
        # required args

        self.input, err = self.user_opts.get_string_opt('-input')
        if self.input == None or err: return 1

        self.prefix, err = self.user_opts.get_string_opt('-prefix')
        if self.prefix == None or err: return 1

        self.script, err = self.user_opts.get_string_opt('-script')
        if self.script == None or err: return 1

        if self.verb > 1:
            print "-- have input '%s', script '%s', prefix '%s'" %      \
                  (self.input, self.script, self.prefix)

        # ----------------------------------------
        # optional arguments

        val, err = self.user_opts.get_string_opt('-kernel')
        if err: return 1
        if val != None: self.kernel = val

        val, err = self.user_opts.get_string_opt('-kernel_file')
        if err: return 1
        if val != None: self.kfile = val

        val, err = self.user_opts.get_string_opt('-mask_dset')
        if err: return 1
        if val != None: self.maskset = val

        val,err = self.user_opts.get_type_opt(float, '-tr')
        if err: return 1
        if val != None: self.tr = val

        # ----------------------------------------
        # check over the inputs

        # check over -input as an AFNI dataset
        self.aname = BASE.afni_name(self.input)
        if self.aname == None: return 1
        if self.verb > 2: self.aname.show()

        if self.aname.type == '1D':
            if self.tr == None:
                print '** -tr is required if the input is in 1D format'
            self.reps = UTIL.max_dim_1D(self.input)
        else:
            if self.aname.type != 'BRIK':
                print "** unknown 'type' for -input '%s'" % self.input
            err,self.reps,self.tr =     \
                UTIL.get_dset_reps_tr(self.aname.pv(),self.verb)
            if err: return 1

        if self.verb > 1:
            print '-- using kernel %s, kfile %s, tr = %s, reps = %s' %  \
                  (self.kernel, self.kfile, self.tr, self.reps)

        return None
コード例 #3
0
    def process_opts(self):
        """apply each option"""

        # ----------------------------------------
        # set verb first
        self.verb, err = self.user_opts.get_type_opt(int, '-verb')
        if err: return 1
        if self.verb == None: self.verb = gDEF_VERB

        # ----------------------------------------
        # required args

        self.infiles, err = self.user_opts.get_string_list('-infiles')
        if self.infiles == None or err: return 1

        # ----------------------------------------
        # optional arguments

        val, err = self.user_opts.get_string_opt('-kernel')
        if err: return 1
        if val != None: self.kernel = val

        val, err = self.user_opts.get_string_opt('-kernel_file')
        if err: return 1
        if val != None: self.kfile = val

        val, err = self.user_opts.get_string_opt('-mask_dset')
        if err: return 1
        if val != None: self.maskset = val

        # allow use of old method
        if self.user_opts.find_opt('-old'): self.stype = 'old'

        val, err = self.user_opts.get_string_opt('-outdir')
        if err: return 1
        if val != None: self.outdir = val

        val, err = self.user_opts.get_string_opt('-prefix')
        if err: return 1
        if val != None: self.prefix = val

        self.script, err = self.user_opts.get_string_opt('-script')
        if self.script == None or err: return 1

        val, err = self.user_opts.get_type_opt(float, '-tr')
        if err: return 1
        if val != None: self.tr = val

        val, err = self.user_opts.get_type_opt(int, '-tr_nup')
        if err: return 1
        if val != None: self.tr_nup = val

        # ----------------------------------------
        # check over the inputs

        if len(self.infiles) < 1:
            print '** missing option -infiles'
            return 1

        # check over -input as an AFNI dataset
        self.aname = BASE.afni_name(self.infiles[0])
        if self.aname == None: return 1
        if self.verb > 2: self.aname.show()

        if self.aname.type == '1D':
            if self.tr == None:
                print '** -tr is required if the input is in 1D format'
            self.reps = UTIL.max_dim_1D(self.infiles[0])
        else:
            if self.aname.type != 'BRIK':
                print "** unknown 'type' for -input '%s'" % self.infiles[0]
            err,self.reps,self.tr =     \
                UTIL.get_dset_reps_tr(self.aname.pv(),self.verb)
            if err: return 1

        if self.verb > 1:
            print '-- using kernel %s, kfile %s, tr = %s, reps = %s' %  \
                  (self.kernel, self.kfile, self.tr, self.reps)

        return None