output_dict[sub][cope] = {}
 cope_dir = os.path.join(input_dir.format(sub=sub),
                         'cope{}.feat'.format(cope_labels[cope]))
 output_dict[sub][cope]['dir'] = cope_dir
 for roi in roi_list:
     output_dict[sub][cope][roi] = {}
     output_dir = os.path.join(cope_dir,
                               feat_output_dir.format(roi=roi))
     roi_file = os.path.join(roi_dir,
                             'ROI_{roi}_final.nii.gz'.format(roi=roi))
     if os.path.exists(output_dir):
         print('Output directory already there; DELETING it!')
         shutil.rmtree(output_dir)
     #Run featquery on the intensity-masked ROI
     report_file = eral.run_featquery(
         cope_dir=cope_dir,
         output_dir=feat_output_dir.format(roi=roi),
         roi_file=roi_file)
     # peak_file = os.path.join(cope_dir, feat_output_dir.format(roi=roi), 'peak_coords.txt')
     if report_file is not None:
         with open(report_file) as fid:
             contents = fid.read()
     else:
         raise RuntimeError
     output_dict[sub][cope][roi]['mean'] = contents.split()[5]
     output_dict[sub][cope][roi]['stdev'] = contents.split()[9]
     output_dict[sub][cope][roi]['max'] = contents.split()[8]
     output_dict[sub][cope][roi]['max_x'] = contents.split()[10]
     output_dict[sub][cope][roi]['max_y'] = contents.split()[11]
     output_dict[sub][cope][roi]['max_z'] = contents.split()[12]
     output_dict[sub][cope][roi]['max_xmm'] = contents.split()[13]
     output_dict[sub][cope][roi]['max_ymm'] = contents.split()[14]
Beispiel #2
0
    print('Running Sub: {}'.format(sub))

    for cope in cope_labels:
        print('Contrast: {}'.format(cope))
        output_dict[sub][cope] = {}
        cope_dir = os.path.join(input_dir.format(sub=sub,ses=ses), 'cope{}.feat'.format(cope_labels[cope]))
        output_dict[sub][cope]['dir'] = cope_dir
        for roi in roi_list:
            output_dict[sub][cope][roi] = {}
            output_dir = os.path.join(cope_dir, feat_output_dir.format(roi=roi))
            roi_file = os.path.join(roi_dir.format(sub=sub), 'sub_{sub}_ROI_{roi}_final.nii.gz'.format(sub=sub,roi=roi))
            if os.path.exists(output_dir):
              print('Output directory already there; DELETING it!')
              shutil.rmtree(output_dir)
            #Run featquery on the intensity-masked ROI
            report_file = eral.run_featquery(cope_dir=cope_dir, output_dir=feat_output_dir.format(roi=roi), roi_file=roi_file)
            peak_file = os.path.join(cope_dir, feat_output_dir.format(roi=roi), 'peak_coords.txt')
            if report_file is not None:
              with open(report_file) as fid:
                contents = fid.read()
            else:
              raise RuntimeError
            output_dict[sub][cope][roi]['mean'] = contents.split()[5]
            output_dict[sub][cope][roi]['stdev'] = contents.split()[9]
            output_dict[sub][cope][roi]['max'] = contents.split()[8]
            output_dict[sub][cope][roi]['max_x'] = contents.split()[10]
            output_dict[sub][cope][roi]['max_y'] = contents.split()[11]
            output_dict[sub][cope][roi]['max_z'] = contents.split()[12]
            output_dict[sub][cope][roi]['max_xmm'] = contents.split()[13]
            output_dict[sub][cope][roi]['max_ymm'] = contents.split()[14]
            output_dict[sub][cope][roi]['max_zmm'] = contents.split()[15]