Exemple #1
0
def inter_calc_dynamic():
	# print(os.getcwd())
	corrcoef_path = os.path.join(os.getcwd(),'bold_net')
	nii_path = os.path.join(path.curparent(), 'pBOLD.nii')
	outfolder = os.path.join(os.getcwd(), OUTFOLDER_INTER)
	json_path = path.fullfile("inter_attr_dynamic.json")
	# print(outfolder)
	# print(corrcoef_path)
	if not os.path.isdir(outfolder):
		os.mkdir(outfolder)
	inter_ac = InterAttrCalcDynamic(nii_path,corrcoef_path,outfolder,json_path)
	inter_ac.calc()
Exemple #2
0
def intra_calc():
    print(os.getcwd())
    atlasobj = path.curatlas()
    volumename = '3mm'

    nii_path = os.path.join(path.curparent(), 'pBOLD.nii')
    outfolder = os.path.join(os.getcwd(), 'bold_net_attr_zzl')
    json_path = path.fullfile("intra_attr.json")
    print(nii_path)
    print(outfolder)
    if not os.path.isdir(outfolder):
        os.mkdir(outfolder)
    intra_ac = IntraAttrCalc(nii_path, atlasobj, outfolder, json_path)
    intra_ac.calc()
Exemple #3
0
def intra_calc_dynamic():
	# print(os.getcwd())
	atlasobj = path.curatlas()
	volumename = '3mm'

	nii_path = os.path.join(path.curparent(), 'pBOLD.nii')
	outfolder = os.path.join(os.getcwd(), OUTFOLDER_INTRA)
	json_path = path.fullfile("intra_attr_dynamic.json")
	# print(nii_path)
	# print(outfolder)
	if not os.path.isdir(outfolder):
		os.mkdir(outfolder)
	intra_ac = IntraAttrCalcDynamic(nii_path,atlasobj,outfolder,json_path)
	intra_ac.calc()
Exemple #4
0
import os
import numpy as np
import nibabel as nib

from mmdps.proc import atlas
# from mmdps.util.loadsave import load_nii, save_csvmat
from mmdps.util import path
from mmdps.proc import job

if __name__ == '__main__':
	
	atlasobj = path.curatlas()
	volumename = '3mm'
	print(os.path.join(path.curparent(), 'pBOLD.nii'))
	print(os.getcwd())
	
	outfolder = os.path.join(os.getcwd(), 'bold_net_attr_zzl')
	print(outfolder)

Exemple #5
0
    def gen_timeseries(self):
        data = self.img.get_data()
        atdata = self.atlasimg.get_data()
        timepoints = data.shape[3]
        timeseries = np.empty((self.atlasobj.count, timepoints))
        for i, region in enumerate(self.atlasobj.regions):
            regiondots = data[atdata == region, :]
            regionts = np.mean(regiondots, axis=0)
            timeseries[i, :] = regionts
        return timeseries

    def gen_net(self):
        ts = self.gen_timeseries()
        save_csvmat(self.outpath('timeseries.csv'), ts)
        tscorr = np.corrcoef(ts)
        save_csvmat(self.outpath('corrcoef.csv'), tscorr)

    def run(self):
        self.gen_net()


if __name__ == '__main__':
    atlasobj = path.curatlas()
    volumename = '3mm'
    img = load_nii(os.path.join(path.curparent(), 'pBOLD.nii'))
    outfolder = 'bold_net'

    c = Calc(atlasobj, volumename, img, outfolder)
    c.run()