Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions MATLAB/RetinotopyAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions RetinotopyAnalysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ usage() {
echo " : id of subject for the data being processed"
echo ""
echo " --movie-files=<file-list>"
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=<file-list>"
echo " : @ symbol separated list of minimally preprocessed functional \(fMRI\) image files"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down