Ejemplo n.º 1
0
#studies=['ds001','ds002']
# load the atlas
atlasfile='/work/01329/poldrack/software_lonestar/atlases/sc_HO_atlas.nii.gz'
atlasimg=nib.load(atlasfile)
atlasdata=atlasimg.get_data()
try:
    activation_data.has_key('foo')
except:
  activation_data={}

  taskctr=0
  tasklabels=[]
  for s in studies:
    activation_data[s]={}
    print s
    condkey=ofu.load_condkey(basedir+s+'/models/model001/condition_key.txt')
    for task in condkey.keys():
        taskctr+=1
        tasklabels.append(s+'_%d'%task)
        activation_data[s][task]={}
        groupbase=os.path.join(basedir,s,'group/model001/task%03d'%task)
        groupbase_list=os.listdir(groupbase)
        gfeat_list=[x for x in groupbase_list if x.find('.gfeat')>0]
        for gfeat in gfeat_list:
            gfeatdir=os.path.join(groupbase,gfeat)
            featnum=int(gfeat[4:7])
#            print gfeatdir
            thresh_zstat_file=os.path.join(gfeatdir,'cope1.feat/thresh_zstat1.nii.gz')
            zstatimg=nib.load(thresh_zstat_file)
            zstatdata=zstatimg.get_data()
            activation_data[s][task][featnum]=get_atlas_activation(zstatdata,atlasdata)
Ejemplo n.º 2
0
    assert os.path.exists(infile)
    assert os.path.exists(os.path.dirname(outfile))
    behav=numpy.loadtxt(infile,skiprows=1)
    varnames=[i for i in open(infile).readline().strip().split()]
    print varnames

newdirnames=['functional','anatomy','behav','model']
# fieldnamp and diffusion do not exist for ds007 so don't generate them

basedir='/Users/poldrack/Dropbox/code/openfmri/nidm/ds007'
newdir=basedir+'_new'
if not os.path.exists(newdir):
    os.mkdir(newdir)
    logmsg('mkdir %s'%newdir)
    
condkey=load_condkey(os.path.join(basedir,'models/model001/condition_key.txt'))

subdirs=glob.glob(os.path.join(basedir,'sub*'))

for subdir in subdirs:
    try:
        assert os.path.exists(os.path.join(subdir,'BOLD'))
        assert os.path.exists(os.path.join(subdir,'anatomy'))
    except:
        print subdir,'does not appear to be a good subject dir'
        continue
    subcode=subdir.split('/')[-1]

    newsubdir=os.path.join(newdir,subcode)
    if not os.path.exists(newsubdir):
        os.mkdir(newsubdir)
Ejemplo n.º 3
0
    assert os.path.exists(os.path.dirname(outfile))
    behav = numpy.loadtxt(infile, skiprows=1)
    varnames = [i for i in open(infile).readline().strip().split()]
    print varnames


newdirnames = ['functional', 'anatomy', 'behav', 'model']
# fieldnamp and diffusion do not exist for ds007 so don't generate them

basedir = '/Users/poldrack/Dropbox/code/openfmri/nidm/ds007'
newdir = basedir + '_new'
if not os.path.exists(newdir):
    os.mkdir(newdir)
    logmsg('mkdir %s' % newdir)

condkey = load_condkey(
    os.path.join(basedir, 'models/model001/condition_key.txt'))

subdirs = glob.glob(os.path.join(basedir, 'sub*'))

for subdir in subdirs:
    try:
        assert os.path.exists(os.path.join(subdir, 'BOLD'))
        assert os.path.exists(os.path.join(subdir, 'anatomy'))
    except:
        print subdir, 'does not appear to be a good subject dir'
        continue
    subcode = subdir.split('/')[-1]

    newsubdir = os.path.join(newdir, subcode)
    if not os.path.exists(newsubdir):
        os.mkdir(newsubdir)