コード例 #1
0
def RunStatsOnVols(subject,Regressor):
    mainDir,subID=os.path.split(subject)

        
    for meth in Methods:
          
        WrkFile=subject
          
        if os.path.exists(WrkFile):
              
            trash='.exe'
            FileBase=subID
            while trash:
                FileBase,trash=os.path.splitext(FileBase)
            subID=FileBase
          
            if meth=='Uncorrected':
                target=subject
            else:
                
                target=os.path.join(mainDir,'{}_{}.nii.gz'.format(subID,meth))
                print target
                if not os.path.exists(target):
                    if meth=='FS':
                        Runfs.main(WrkFile,1./tr,itl)
                    elif meth=='FSL':
                        Runfsl.main(WrkFile,1./tr,itl)
                    elif meth=='SPM':
                        Runspm.main(WrkFile,1./tr,itl)
                    
                    time.sleep(20)                        
                else:
                    print 'found {} for {}'.format(meth,subID)
                
            CheckOutput=os.path.join(mainDir,'tPython',meth,con,'Beta.nii.gz')
            print CheckOutput
            if not os.path.exists(CheckOutput):
                
                pr=sp.Popen('fslmaths {} -s 5 {}/Smooth{}_{}'.format(target,mainDir,subID,meth),shell=True)
                print 'Blurring:\nfslmaths {} -s 5 Smooth{}_{}'.format(target,subID,meth)
                pr.wait()
                target=os.path.join(mainDir,'Smooth{}_{}.nii.gz'.format(subID,meth))  
                Runglm.main(target,con,Regressor,meth)
            else:
          
                print 'Ran for {} {}, skipping'.format(subject,meth)
                  
        else:
            print ('No Nii File For {}'.format(subID))
コード例 #2
0
def main(InputNii,meth,Regressor,con,tr,itl):
        base,subID=os.path.split(InputNii)
    
        #print Regressor
        
        CheckOutput=os.path.join(base,'tPython',meth,con,'Beta.nii.gz')
        #print CheckOutput
        
        if not os.path.exists(CheckOutput):
            
            if meth=='Filt':
                Regressor,trash=os.path.split(Regressor)
                Regressor=os.path.join(Regressor,'Regressors_20Hz.txt')
                RunglmSR.main(InputNii,con,Regressor,meth,tr,itl,20)
                
            else:
                Runglm.main(InputNii,con,Regressor,meth)
        else:
        
            print 'Ran GLM for {} {}, skipping'.format(InputNii,meth)    
コード例 #3
0
                else:
                    print "found SPM for {}".format(subID)

                target = os.path.join(subject, "{}_FSL.nii.gz".format(subID))
                if not os.path.exists(target):
                    Runfsl.main(WrkFile, 1.0 / tr, itl)
                else:
                    print "found FSL for {}".format(subID)

                InputNii = os.path.join(subject, "{}_{}.nii.gz".format(subID, meth))
                InputNii = WrkFile
                Regressor = os.path.join(subject, "SuperiorFrontalL.txt")

                CheckOutput = os.path.join(subject, "tPython", meth, con, "Beta.nii.gz")
                if not os.path.exists(CheckOutput):
                    Runglm.main(InputNii, con, Regressor, meth)
                else:

                    print "Ran for {} {}, skipping".format(subject, meth)

            else:
                print ("No Nii File For {}".format(subID))
    else:
        print ("skipping {}".format(subID))


#
# if __name__ == '__main__':
#     Subjects=glob.glob(sys.argv[1])
#     print sys.argv[1]
#     print len(Subjects)