diff --git a/MATLAB/RetinotopyAnalysis.m b/MATLAB/RetinotopyAnalysis.m index be7c0e2..38da0be 100644 --- a/MATLAB/RetinotopyAnalysis.m +++ b/MATLAB/RetinotopyAnalysis.m @@ -42,8 +42,8 @@ function RetinotopyAnalysis(inputfile) %%%%% SETUP % internal constants - viewingdistance = 39; % inches - widthofstim = 15; % inches + viewingdistance = 101.5; % cm + widthofstim = 28.5; % cm wbcmd = 'wb_command'; % workbench command tr = 1; % seconds stimres = 200; % number of pixels along each dimension of the stimulus @@ -80,15 +80,23 @@ function RetinotopyAnalysis(inputfile) % load stimuli stimulus = {}; % each element is 200 x 200 x 300, single format for p=1:length(movie_files) - a1 = load(movie_files{p}); - stimulus{p} = a1.stim; + [~,~,ext]=fileparts(movie_files{p}); + switch lower(ext) + case '.mat' + a1 = load(movie_files{p}); + stimulus{p} = a1.stim; + clear a1; + case '.hdf5' + stimulus{p} = hdf5read(movie_files{p},'/stim'); + case '.mov' + mobj = VideoReader(movie_files{p}); + stim0 = read(mobj); + stimulus{p} = permute(single(stim0(:,:,1,:)),[1 2 4 3]); + clear mobj stim0; + otherwise + error('Unknown movie file type: %s\n',movie_files{p}); + end end - clear a1; - % ALTERNATIVE: - % mobj = VideoReader(movie_files{p}); - % stim0 = read(mobj); - % stimulus{p} = permute(single(stim0(:,:,1,:)),[1 2 4 3]); - % clear stim0; % sanity check assert(length(stimulus)==5); @@ -105,7 +113,7 @@ function RetinotopyAnalysis(inputfile) behaviors{p} = []; else a1 = xml2struct(behavior_files{p}); % relevant fields: expttype (1-5), ttlStamps - behaviors{p} = a1.ret_summary; + behaviors{p} = a1.behav_summary; end end clear a1; diff --git a/RetinotopyAnalysis.sh b/RetinotopyAnalysis.sh index 8fcfa44..8b93439 100755 --- a/RetinotopyAnalysis.sh +++ b/RetinotopyAnalysis.sh @@ -80,7 +80,8 @@ usage() { echo " : id of subject for the data being processed" echo "" echo " --movie-files=" - echo " : @ symbol separated list of movie files (QuickTime files) used as stimuli for the retinotopy task" + echo " : @ symbol separated list of movie files used as stimuli for the retinotopy task" + echo " Expects Quicktime .mov files, Matlab .mat files, or .hdf5 echo "" echo " --image-files=" echo " : @ symbol separated list of minimally preprocessed functional \(fMRI\) image files" @@ -124,7 +125,7 @@ usage() { # Global output variables # ${userid} - input - user login id # ${subject} - input - subject id -# ${movie_files} - input - @ symbol separated list of movie files (QuickTime files) used as stimuli for the +# ${movie_files} - input - @ symbol separated list of movie files (mov,mat,or hdf5) used as stimuli for the # retinotopy task # ${image_files} - input - @ symbol separated list of minimally preprocessed functional (fMRI) image files # ${behavior_files} - input - @ symbol separated list of behavior files from which time offsets can be obtained @@ -238,7 +239,7 @@ main() { # Global Variables Set # ${userid} - input - user login id # ${subject} - input - subject id - # ${movie_files} - input - @ symbol separated list of movie files (QuickTime files) used as stimuli for the + # ${movie_files} - input - @ symbol separated list of movie files (mov,mat,or hdf5) used as stimuli for the # retinotopy task # ${image_files} - input - @ symbol separated list of minimally preprocessed functional (fMRI) image files # ${behavior_files} - input - @ symbol separated list of behavior files from which time offsets can be obtained