scoreMatrix = dict() # 3 scores X 4 sessions scoreMatrix['daihuachen'] = np.array([[14, 24, 24, 37], [3, 10, 11, 13], [9, 26, 25, 34]]) scoreMatrix['guojiye'] = np.array([[18, 37, 42, 59], [17, 44, 47, 54], [32, 52, 60, 70]]) scoreMatrix['tanenci'] = np.array([[4, 13, 19, 29], [0, 2, 3, 13], [16, 19, 19, 21]]) scoreMatrix['wangjingying'] = np.array([[4, 9, 9, 15], [0, 1, 1, 1], [16, 17, 17, 17]]) for atlasName in atlasList: atlasobj = atlas.get(atlasName) ChanggungPatientNets = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'CS_subjects.txt')) ChanggungHealthyNets = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'normal_subjects.txt')) # testNets = io_utils.loadAllTemporalNets(mmdps_locale.ChanggungAllFullPath, 4, atlasobj, subjectList = os.path.join(mmdps_locale.ChanggungRootPath, 'SCI_incomplete_subjects.txt')) testNets = io_utils.loadAllTemporalNets( mmdps_locale.ChanggungAllFullPath, 4, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'CS_subjects.txt'), specificTime={
The healthy dynamic networks were used to balance positive and negative ratio """ import os, json import numpy as np import mmdps_locale from mmdps.proc import atlas, netattr from mmdps_util import stats_utils, io_utils, result_utils from sklearn import svm, model_selection atlasobj = atlas.get('brodmann_lr') # load specific nets as a list ChanggungPatientNets = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'CS_subjects.txt')) ChanggungHealthyNets = io_utils.loadRandomDynamicNets( mmdps_locale.ChanggungAllFullPath, atlasobj, totalNum=len(ChanggungPatientNets), scanList=os.path.join(mmdps_locale.ChanggungRootPath, 'normal_scans.txt')) testNets = io_utils.loadSpecificNets(mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join( mmdps_locale.ChanggungRootPath, 'CS_subjects.txt'), timeCase=2)
ret[2] = precision ret[3] = recall ret[4] = specificity return ret if __name__ == '__main__': outfile = open('result.txt', 'w', buffering=1) for atlasName in atlasList: atlasobj = atlas.get(atlasName) outfile.write('processing atlas: %s\n' % atlasobj.name) # load specific nets as a list ChanggungPatientNets = io_utils.loadSpecificNets( ChanggungAllFullPath, atlasobj, subjectList=os.path.join(ChanggungRootPath, 'SCI_incomplete_subjects.txt')) totalIteration = 1000 numCPU = 6 with multiprocessing.Pool(processes=numCPU) as pool: manager = multiprocessing.Manager() managerQueue = manager.Queue() fwrap = parabase.FWrap(func, managerQueue) result = pool.map_async( fwrap.run, [(atlasobj, ChanggungPatientNets)] * totalIteration) ntotal = totalIteration print('Begin proc, {} cpus, {} left, start at {}'.format( numCPU, ntotal, datetime.datetime.now())) nfinished = 0
scoreMatrix['xiangyan'] = np.array([[23, 27], [150, 158], [44, 47]]) scoreMatrix['mahuibo'] = np.array([[26, 31], [200, 200], [34, 43]]) scoreMatrix['caochangsheng'] = np.array([[40, 43], [190, 190], [64, 76]]) scoreMatrix['renjie'] = np.array([[45, 46], [72, 72], [60, 64]]) scoreMatrix['hanjunling'] = np.array([[33, 37], [184, 184], [68, 72]]) scoreMatrix['hushufang'] = np.array([[30, 39], [168, 168], [49, 50]]) scoreMatrix['liujinghui'] = np.array([[36, 40], [180, 180], [62, 67]]) scoreMatrix['hongqingfeng'] = np.array([[32, 35], [65, 110], [19, 23]]) scoreMatrix['panqingbin'] = np.array([[37, 38], [200, 204], [33, 33]]) atlasobj = atlas.get('bnatlas') ChanggungPatientNets = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'SCI_pan_selected_all.txt')) ChanggungHealthyNets = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'normal_subjects.txt')) # Union of the first and second session ChanggungPatientNets2 = io_utils.loadSpecificNets( mmdps_locale.ChanggungAllFullPath, atlasobj, subjectList=os.path.join(mmdps_locale.ChanggungRootPath, 'SCI_pan_selected_all.txt'),