op = OpenFMRIData(data_dir, raw_dir,study_name) subject_names = op.get_subject_names() # All subjects # create open fMRI data structure and conver .dcms to .nii for name in subject_names: x=2 # subject_dir = op.create_subject_dir(name, overwrite=True) #TODO: agree on a standard to include open behvadata.txt files in raw directory structure # copy over the behavdata.txt files to correct place in open-fmri data struc created above: # you need to do this with a mat script of by hand for each run for eahc subject # ~/sub001/behav/tak00X_run00X/behavdata.txt for name in subject_names: subject = op.load_subject_dir(subname=name) subject_dir_name = subject._path op.create_subject_evs(subject_dir_name= subject_dir_name , mode = 'basic') op.create_subject_evs(subject_dir_name= subject_dir_name , mode = 'trial_base') # run preprocessing and first levle naalysis for name in subject_names: subject = op.load_subject_dir(subname=name) # if we want to create new data for analysis # subject_dir = op.create_subject_dir(name) # if we want to load new data for analysis # structural: subject_dir = subject._path preproc = PreProcessing(op,[subject]) brain_image = preproc.extract_brain(subject,automatic_approval = True)
condition_name = "cond{:0>3d}.txt".format(condition_number + 1) print ">>> condition mapping: {}->{}".format( key, condition_number) for onset_dir in onset_dirs: value.to_csv(os.path.join(subjectdir.model_dir(), onset_dir, task_sequence, condition_name), sep='\t', index=False, header=False) op = OpenFMRIData(data_dir, raw_dir, study_name) #subject_names = ['MoCa'] # Specific subject names subject_names = op.get_subject_names() # All subjects for name in subject_names: subject_dir = op.load_subject_dir(subname=name, create_behav_dict={ 'func': create_evs, 'behav': os.path.join(behavioural_dir, study_name, name) }) # if we want to create new data for analysis # subject_dir = op.create_subject_dir(name) analyzer = OpenFMRIAnalyzer(op, [subject_dir]) analyzer.analyze(mc_merge=True)