public:data_natneuro_2013_kahn:matlab_scripts:2d_prepdata_adaptplusid_outputid_glm
- 2d_prepData_adaptPlusID_outputID_glm.m
%
% _______________________________________________
% by Marcelo G Mattar (10/21/2013)
% mattar@sas.upenn.edu
%
baseDir = '/jet/aguirre/FaceSpace/';
dataDir = '~/Data/FaceSpace/';
datasets = {'MDS_RGI','MDS_Multi'};
FSpath = '/Applications/freesurfer';
SUBJECTS_DIR = '/jet/aguirre/freesurfer/subjects';
FWHM = 10;
subjectList_RGI = {...
% [list of subject ID strings redacted]
};
subjectList_Multi = {...
% [list of subject ID strings redacted]
};
for d = 1:2
% Determine which dataset we'll work on
dataset = datasets{d};
switch dataset
case 'MDS_RGI'
subjectList = subjectList_RGI;
dataset_lowercase = '-mds_rgi';
case 'MDS_Multi'
subjectList = subjectList_Multi;
dataset_lowercase = '-mds_multi';
end
numSubjects = length(subjectList);
fsgdFile = [dataDir 'group_glms/' dataset '/Drift.fsgd'];
%% Resample multiple subjects' BOLD beta maps to create the subject's freesurfer based right and left hemispheric surface betas
for k = 1
outputDir = [dataDir 'group_glms/' dataset '/DriftAdapt/'];
mkdir(outputDir);
for s = 1:numSubjects
refVolName = [baseDir dataset '/subjects/' subjectList{s} '/Anatomy/FS-register.dat'];
% Convert the statmap to a .img file
system(['/usr/local/VoxBo/bin/vbstatmap ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/Drift_000_100 -c ''foo rb vec 1 0 0'' -o ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/DriftPrototype.cub']);
system(['/usr/local/VoxBo/bin/vbconv -f ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/DriftPrototype.cub ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/DriftPrototype.img']);
this_command_resample_data_lh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_vol2surf' ...
' --src ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/DriftPrototype.img' ...
' --srcreg ' refVolName ...
' --hemi lh ' ...
' --projfrac 0.5' ...
' --noreshape' ...
' --o ' SUBJECTS_DIR '/' subjectList{s} dataset_lowercase '/surf/lh.DriftPrototype.mgh' ...
];
system(this_command_resample_data_lh);
this_command_resample_data_rh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_vol2surf' ...
' --src ' baseDir dataset '/subjects/' subjectList{s} '/Models/Drift/DriftPrototype.img' ...
' --srcreg ' refVolName ...
' --hemi rh ' ...
' --projfrac 0.5' ...
' --noreshape' ...
' --o ' SUBJECTS_DIR '/' subjectList{s} dataset_lowercase '/surf/rh.DriftPrototype.mgh' ...
];
system(this_command_resample_data_rh);
end
%% The first step is to create a pre-processed group file for the FreeSurfer GLM.
this_command_assemble_data_lh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mris_preproc' ...
' --fsgd ' fsgdFile ...
' --target fsaverage' ...
' --hemi lh' ...
' --meas DriftPrototype.mgh' ...
' --out ' outputDir 'lh.DriftPrototype.00.mgh' ...
];
system(this_command_assemble_data_lh);
this_command_assemble_data_rh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mris_preproc' ...
' --fsgd ' fsgdFile ...
' --target fsaverage' ...
' --hemi rh' ...
' --meas DriftPrototype.mgh' ...
' --out ' outputDir 'rh.DriftPrototype.00.mgh' ...
];
system(this_command_assemble_data_rh);
%% Next we smooth the maps created above
this_command_smooth_lh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_surf2surf' ...
' --hemi lh' ...
' --s fsaverage' ...
' --sval ' outputDir 'lh.DriftPrototype.00.mgh' ...
' --fwhm 10' ...
' --cortex' ...
' --tval ' outputDir 'lh.DriftPrototype.fwhm10.mgh' ...
];
system(this_command_smooth_lh);
this_command_smooth_rh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_surf2surf' ...
' --hemi rh' ...
' --s fsaverage' ...
' --sval ' outputDir 'rh.DriftPrototype.00.mgh' ...
' --fwhm 10' ...
' --cortex' ...
' --tval ' outputDir 'rh.DriftPrototype.fwhm10.mgh' ...
];
system(this_command_smooth_rh);
%% Next we run the group GLM
this_command_runGLM_lh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_glmfit' ...
' --y ' outputDir 'lh.DriftPrototype.fwhm10.mgh' ...
' --fsgd ' fsgdFile ...
' --osgm' ...
' --surf fsaverage lh' ...
' --cortex' ...
' --glmdir ' outputDir 'lh.DriftPrototype.glmdir' ...
];
system(this_command_runGLM_lh);
this_command_runGLM_rh = ['export FREESURFER_HOME=' FSpath ';export SUBJECTS_DIR=' SUBJECTS_DIR ';export PATH=' FSpath '/bin:$PATH;' ...
'/Applications/freesurfer/bin/mri_glmfit' ...
' --y ' outputDir 'rh.DriftPrototype.fwhm10.mgh' ...
' --fsgd ' fsgdFile ...
' --osgm' ...
' --surf fsaverage rh' ...
' --cortex' ...
' --glmdir ' outputDir 'rh.DriftPrototype.glmdir' ...
];
system(this_command_runGLM_rh);
end
end
public/data_natneuro_2013_kahn/matlab_scripts/2d_prepdata_adaptplusid_outputid_glm.txt · Last modified: 2013/10/31 13:56 by kahn