diff --git a/MATLAB/RetinotopyAnalysis.m b/MATLAB/RetinotopyAnalysis.m index 1441cb2..ff13b9d 100644 --- a/MATLAB/RetinotopyAnalysis.m +++ b/MATLAB/RetinotopyAnalysis.m @@ -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 diff --git a/RetinotopyAnalysis.sh b/RetinotopyAnalysis.sh index 3583ac9..8dcb464 100755 --- a/RetinotopyAnalysis.sh +++ b/RetinotopyAnalysis.sh @@ -79,9 +79,15 @@ usage() { echo " --subject=" echo " : id of subject for the data being processed" echo "" + echo " --outpath=" + echo " : Path to parent folder within which results folder would be created" + echo "" + echo " --dummy_file=" + echo " : Path to dummy file" + echo "" echo " --movie-files=" - 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=" echo " : @ symbol separated list of minimally preprocessed functional \(fMRI\) image files" @@ -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 @@ -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 @@ -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 )) @@ -200,6 +218,19 @@ get_options() { exit 1 fi + if [ -z ${outpath} ]; then + usage + echo "ERROR: not specified" + exit 1 + fi + + if [ -z ${dummy_file} ]; then + usage + echo "ERROR: not specified" + exit 1 + fi + + if [ -z ${movie_files} ]; then usage echo "ERROR: not specified" @@ -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}" @@ -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 @@ -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 @@ -334,15 +369,17 @@ main() { cat < ${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 } # diff --git a/mcc/matlabsge.sh b/mcc/matlabsge.sh index e68c0e3..7e59906 100755 --- a/mcc/matlabsge.sh +++ b/mcc/matlabsge.sh @@ -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