示例#1
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).
        
        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Check for FS env variable
        self._log('Checking on FREESURFER_HOME', debug=9, lw=self._lw)
        if not os.environ.get('FREESURFER_HOME'):
            error.fatal(self, 'noFreeSurferEnv')
        self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)
        
        for str_subj in self._l_subject:
            self._log('Checking on subjectDir <%s>' % str_subj,
                        debug=9, lw=self._lw)
            if os.path.isdir(str_subj):
                self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)
            else:
                self._log('[ not found ]\n', debug=9, rw=self._rw,
                            syslog=False)
                error.fatal(self, 'subjectDirnotExist')
示例#2
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).
        
        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)
示例#3
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).

        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Set absolute dir specs for topDir and outDir
        log = self.log()
        log('Setting dir specs...\n')
        os.chdir(self.topDir())
        self.topDir(os.path.abspath(self.topDir()))
        if os.path.isdir(self.outDir()):
            log('Existing output directory found. Deleting and recreating...\n')
            shutil.rmtree(self.outDir())
        misc.mkdir(self.outDir())
        os.chdir(self.outDir())
        self.outDir(os.getcwd())
        os.chdir(self.topDir())

        # check dirs for each subsample dir
        # print(os.getcwd())
        # print(self._l_subsample)
        for directory in self._l_subsample:
            if os.path.isdir(os.path.join(self.topDir(), directory)):
                os.chdir(directory)
                self._l_subsampleDir.append(os.path.abspath(os.getcwd()))
                os.chdir(self.topDir())
            else:
                error.fatal(self, 'subsampleDirNotFound')
        self._d_subsampleDir = dict(zip(self._l_subsample, self._l_subsampleDir))
        # print(self._d_subsampleDir)

        self.dtree_build()
        self._dtree.tree_metaData_print(False)
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).

        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        for index in self._l_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)
            stage.exitCode(False)

        # Set absolute dir specs for topDir and outDir
        log = self.log()
        log('Setting dir specs...\n')
        os.chdir(self.topDir())
        self.topDir(os.path.abspath(self.topDir()))
示例#5
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).
        
        '''

        # First, this script should only be run on cluster nodes.
        lst_clusterNodes = [
            'rc-drno', 'rc-russia', 'rc-thunderball', 'rc-goldfinger',
            'rc-twice'
        ]
        str_hostname = socket.gethostname()

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Check for FS env variable
        self._log('Checking on FREESURFER_HOME', debug=9, lw=self._lw)
        if not os.environ.get('FREESURFER_HOME'):
            error.fatal(self, 'noFreeSurferEnv')
        self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)

        for str_subj in self._l_subject:
            self._log('Checking on subjectDir <%s>' % str_subj,
                      debug=9,
                      lw=self._lw)
            if os.path.isdir(str_subj):
                self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)
            else:
                self._log('[ not found ]\n',
                          debug=9,
                          rw=self._rw,
                          syslog=False)
                error.fatal(self, 'subjectDirnotExist')
示例#6
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).
        
        '''

        # First, this script should only be run on cluster nodes.
        lst_clusterNodes = ['rc-drno', 'rc-russia', 'rc-thunderball',
                            'rc-goldfinger', 'rc-twice']
        str_hostname    = socket.gethostname()
        #if str_hostname not in lst_clusterNodes:
            #error.fatal(self, 'notClusterNode', 'Current hostname = %s' % str_hostname)

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Check for FS env variable
        self._log('Checking on FREESURFER_HOME', debug=9, lw=self._lw)
        if not os.environ.get('FREESURFER_HOME'):
            error.fatal(self, 'noFreeSurferEnv')
        self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)
            
        for str_operand in self._l_operands:
            self._log('Checking on operand <%s>' % str_operand,
                        debug=9, lw=self._lw)
            if os.path.isfile(str_operand):
                self._log('[ ok ]\n', debug=9, rw=self._rw, syslog=False)
            else:
                self._log('[ not found ]\n', debug=9, rw=self._rw,
                            syslog=False)
                error.fatal(self, 'operandFilenotExist')
示例#7
0
    def initialize(self):
        '''
        This method provides some "post-constructor" initialization. It is
        typically called after the constructor and after other class flags
        have been set (or reset).

        '''

        # Set the stages
        self._pipeline.stages_canRun(False)
        lst_stages = list(self._stageslist)
        for index in lst_stages:
            stage = self._pipeline.stage_get(int(index))
            stage.canRun(True)

        # Set absolute dir specs for topDir and outDir
        os.chdir(self.topDir())
        self.topDir(os.path.abspath(self.topDir()))
        if os.path.isdir(self.outDir()):
            os.chdir(self.outDir())
            self.outDir(os.path.abspath(self.outDir()))
        else:
            error.warn(self, 'outDirNotFound')
            misc.mkdir(self.outDir())