Beispiel #1
0


print subjClass.targetDir
#try:
    ##motion_extraction.main(subjClass.targetDir, True, False, False)
#except:
    #pass

#backUp.server_connect('147.47.228.192', os.path.dirname(subjClass.targetDir))

#freesurfer.main(True, False, False, subjClass.targetDir,
        #os.path.join(subjClass.targetDir, 'FREESURFER'))


freesurfer_summary.main('/Volumes/promise/nas_BackUp/CCNC_MRI_3T/CHR/CHR45_JYS/followUp/2yfu', None, "ctx_lh_G_cuneus", True, True, True, True)


#os.popen('sudo rm -rf /Volumes/promise/nas_BackUp/CCNC_MRI_3T/CHR/CHR95_KSU')

#savedList = 
#if 'ha' in os.listdir(os.getcwd()):
    #with open('ha','r') as f:
        #[newDirectoryList, logDf] = pickle.load(f)

## copied directory check test

#else:
    #logDf = copiedDirectoryCheck('pracDir/from', 'pracDir/from/log.xlsx')

Beispiel #2
0
def backUp(inputDirs, backUpFrom, USBlogFile, backUpTo, DataBaseAddress, spreadsheet, freesurferOn, motionOn, copyExecuteOn, nasBackupOn):
    # External HDD log
    if USBlogFile:
        logFileInUSB = USBlogFile
    elif inputDirs:
        logFileInUSB = os.path.join(os.getcwd(),"log.xlsx")
    else:
        logFileInUSB = os.path.join(backUpFrom,"log.xlsx")

    logDf = copiedDirectoryCheck(backUpFrom,logFileInUSB)
    newDirectoryList,logDf = newDirectoryGrep(inputDirs, backUpFrom,logDf)
    logDf.to_excel(logFileInUSB,'Sheet1')

    if newDirectoryList==[]:
        sys.exit('Everything have been backed up !')

    subjectClassList = []
    for newDirectory in newDirectoryList:
        subjClass = subj.subject(newDirectory, backUpTo)
        checkFileNumbers(subjClass)
        subjectClassList.append(subjClass)

        if copyExecuteOn:
            executeCopy(subjClass)

            subjDf = saveLog(subjClass)

            dbDf = processDB(DataBaseAddress)

            newDf = pd.concat([dbDf, subjDf]).reset_index()
            newDf = newDf[[ u'koreanName',    u'subjectName', u'subjectInitial',
                            u'group',            u'sex',            u'age',
                            u'DOB',       u'scanDate',       u'timeline',
                            u'studyname',  u'patientNumber',       u'T1Number',
                            u'DTINumber',      u'DKINumber',     u'RESTNumber',
                            u'REST2Number',     u'folderName',       u'backUpBy',
                            u'note']]

            newDf['koreanName'] = newDf['koreanName'].str.decode('utf-8')
            newDf['note'] = newDf['note'].str.decode('utf-8')
            newDf.to_excel(DataBaseAddress, 'Sheet1')
            #os.chmod(DataBaseAddress, 0o2770)

            updateSpreadSheet.main(False, DataBaseAddress, spreadsheet)


    if motionOn:
        print 'Now, running motion_extraction'
        for subjectClass in subjectClassList:
            motion_extraction.main(subjectClass.targetDir, True, True, False)

    if nasBackupOn:
        server = '147.47.228.192'
        for subjectClass in subjectClassList:
            copiedDir=os.path.dirname(subjectClass.targetDir)
            server_connect(server, copiedDir)

    if freesurferOn:
        for subjectClass in subjectClassList:
            freesurfer.main(subjectClass.targetDir, 
                            os.path.join(subjectClass.targetDir, 'FREESURFER'))
            freesurfer_summary.main(copiedDir, None, "ctx_lh_G_cuneus", True, True, True, True)

    print 'Completed\n'
Beispiel #3
0
newDf.to_excel(DataBaseAddress, 'Sheet1')
os.chmod(DataBaseAddress, 0o2770)

print subjClass.targetDir
#try:
##motion_extraction.main(subjClass.targetDir, True, False, False)
#except:
#pass

#backUp.server_connect('147.47.228.192', os.path.dirname(subjClass.targetDir))

#freesurfer.main(True, False, False, subjClass.targetDir,
#os.path.join(subjClass.targetDir, 'FREESURFER'))

freesurfer_summary.main(
    '/Volumes/promise/nas_BackUp/CCNC_MRI_3T/CHR/CHR45_JYS/followUp/2yfu',
    None, "ctx_lh_G_cuneus", True, True, True, True)

#os.popen('sudo rm -rf /Volumes/promise/nas_BackUp/CCNC_MRI_3T/CHR/CHR95_KSU')

#savedList =
#if 'ha' in os.listdir(os.getcwd()):
#with open('ha','r') as f:
#[newDirectoryList, logDf] = pickle.load(f)

## copied directory check test

#else:
#logDf = copiedDirectoryCheck('pracDir/from', 'pracDir/from/log.xlsx')

## newDirectoryGrep