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
26 changes: 13 additions & 13 deletions MATLAB/RetinotopyAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ function RetinotopyAnalysis(inputfile)
for p=1:length(movie_files)
[~,~,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} = h5read(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});
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

Expand Down
47 changes: 42 additions & 5 deletions RetinotopyAnalysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ usage() {
echo " --subject=<subject-id>"
echo " : id of subject for the data being processed"
echo ""
echo " --outpath=<outpath>"
echo " : Path to parent folder within which results folder would be created"
echo ""
echo " --dummy_file=<dummy_file>"
echo " : Path to dummy file"
echo ""
echo " --movie-files=<file-list>"
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 " : @ 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 @@ -125,6 +131,8 @@ usage() {
# Global output variables
# ${userid} - input - user login id
# ${subject} - input - subject id
# ${outpath} - input - path for the results folders
# ${dummy_file} - input - path to dummy file
# ${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
Expand All @@ -138,6 +146,8 @@ get_options() {
unset userid
userid=`whoami`
unset subject
unset outpath
unset dummy_file
unset movie_files
unset image_files
unset behavior_files
Expand Down Expand Up @@ -167,6 +177,14 @@ get_options() {
subject=${argument/*=/""}
index=$(( index + 1 ))
;;
--outpath=*)
outpath=${argument/*=/""}
index=$(( index + 1 ))
;;
--dummy_file=*)
dummy_file=${argument/*=/""}
index=$(( index + 1 ))
;;
--movie-files=*)
movie_files=${argument/*=/""}
index=$(( index + 1 ))
Expand Down Expand Up @@ -200,6 +218,19 @@ get_options() {
exit 1
fi

if [ -z ${outpath} ]; then
usage
echo "ERROR: <outpath> not specified"
exit 1
fi

if [ -z ${dummy_file} ]; then
usage
echo "ERROR: <dummy_file> not specified"
exit 1
fi


if [ -z ${movie_files} ]; then
usage
echo "ERROR: <movie files> not specified"
Expand All @@ -222,6 +253,8 @@ get_options() {
echo "-- ${scriptName}: Specified Command-line Options - Start --"
echo " userid: ${userid}"
echo " subject: ${subject}"
echo " outpath: ${outpath}"
echo " dummy_file: ${dummy_file}"
echo " movie_files: ${movie_files}"
echo " image_files: ${image_files}"
echo " behavior_files: ${behavior_files}"
Expand All @@ -239,6 +272,8 @@ main() {
# Global Variables Set
# ${userid} - input - user login id
# ${subject} - input - subject id
# ${outpath} - input - path for results folder
# ${dummy_file} - input - path to dummy file
# ${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
Expand Down Expand Up @@ -301,7 +336,7 @@ main() {
done
matlab_movies_spec="${matlab_movies_spec}}"

echo ""
echo ""
echo "${scriptName}: matlab_movies_spec: ${matlab_movies_spec}"

# Build the Matlab image and behavior files specifications. For logging and debugging purposes, show each
Expand Down Expand Up @@ -334,15 +369,17 @@ main() {
cat <<EOF > ${subject}_matlab_variables.txt
userid = '${userid}';
subject = ${subject};
outpath = '${outpath}';
dummy_file='${dummy_file}';
${matlab_movies_spec};
${matlab_image_files_spec};
${matlab_behavior_files_spec};
EOF

# Run a compiled Matlab script, passing it the variables file we just created
export MCR_CACHE_ROOT=/tmp
export MCR_CACHE_ROOT=/tmp/MCC_CACHE_${USER}
export MATLAB_HOME="/export/matlab/R2012b"
~/mcc/run_RetinotopyAnalysis.sh ${MATLAB_HOME}/MCR ${subject}_matlab_variables.txt
$HCPRETINODIR/mcc/run_RetinotopyAnalysis.sh ${MATLAB_HOME}/MCR ${subject}_matlab_variables.txt
}

#
Expand Down
4 changes: 2 additions & 2 deletions mcc/matlabsge.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

MCR_CACHE_ROOT=/tmp
MCR_CACHE_ROOT=/tmp/MCC_CACHE_${USER}
export MCR_CACHE_ROOT

echo Now issuing MATLAB command.
~/mcc/$MYSCRIPT /export/matlab/R2012b/MCR $MYARG1 $MYARG2 $PBS_ARRAYID
$HCPRETINODIR/mcc/$MYSCRIPT /export/matlab/R2012b/MCR $MYARG1 $MYARG2 $PBS_ARRAYID