diff --git a/spm8Batch/auxiliary/help/help_case_TGLOBAL b/spm8Batch/auxiliary/help/help_case_TGLOBAL new file mode 100644 index 00000000..91312619 --- /dev/null +++ b/spm8Batch/auxiliary/help/help_case_TGLOBAL @@ -0,0 +1,3 @@ + echo " -G TGLOBAL change the TGLOBAL parameters for fsl/slicetimer, " + echo " default is 0.50" + echo diff --git a/spm8Batch/auxiliary/help/help_case_flirt_options b/spm8Batch/auxiliary/help/help_case_flirt_options index 7ac37e43..171ea94f 100644 --- a/spm8Batch/auxiliary/help/help_case_flirt_options +++ b/spm8Batch/auxiliary/help/help_case_flirt_options @@ -1,5 +1,7 @@ - echo " -m \"flirt options\" enable super debug flag." + echo " -m \"fsl options\" Give options to mcflirt or slicetimer." echo " Be sure to specify inside of quotes." echo " do \"mcflirt --help\" for help." - echo " default is \"-cost normcorr -stats -plots\"" + echo " do \"slicetimer --help\" for help." + echo " default for mcflirt is \"-cost normcorr -stats -plots\"" + echo " default for slicetimer is \"\"" echo diff --git a/spm8Batch/auxiliary/help/help_case_no_background_job b/spm8Batch/auxiliary/help/help_case_no_background_job new file mode 100644 index 00000000..5efb2dc6 --- /dev/null +++ b/spm8Batch/auxiliary/help/help_case_no_background_job @@ -0,0 +1,2 @@ + echo " -B run in the foreground, need for daisy chaining jobs." + echo diff --git a/spm8Batch/auxiliary/help/help_case_warpmethod b/spm8Batch/auxiliary/help/help_case_warpmethod index 29c1a021..903ef0e7 100644 --- a/spm8Batch/auxiliary/help/help_case_warpmethod +++ b/spm8Batch/auxiliary/help/help_case_warpmethod @@ -1,3 +1,5 @@ echo " -W Enable VBM8 warping for fMRI, you need to run vbm8HiRes first." echo " Default is to use standard SPM8 normalization." + echo " This will set the output name to 'vbm8_', so use '-w' after" + echo " you specificy '-W' if you wish to use 'w' as the prepend name." echo diff --git a/spm8Batch/auxiliary/help/help_options_end b/spm8Batch/auxiliary/help/help_options_end index e3863a9a..802442f9 100644 --- a/spm8Batch/auxiliary/help/help_options_end +++ b/spm8Batch/auxiliary/help/help_options_end @@ -2,6 +2,8 @@ echo "${helpComment} functional images path : $fmriPATH" echo "${helpComment} Subject directory : ${SUBJDIR}" echo + echo "${helpComment} Back(1)/fore(0)ground : ${BACKGROUNDJOBFLAG}" + echo echo "${helpComment} spm8 is located in : $SPM8B1" echo "${helpComment} spm8Batch is located in : $SPM8B2" echo "${helpComment} spm8 patch is located in : $SPM8B3" diff --git a/spm8Batch/auxiliary/help/help_options_start b/spm8Batch/auxiliary/help/help_options_start index 0134987b..bcf82dd2 100644 --- a/spm8Batch/auxiliary/help/help_options_start +++ b/spm8Batch/auxiliary/help/help_options_start @@ -54,6 +54,9 @@ "a") . ${thisDir}/auxiliary/help/help_case_anatomy_path ;; + "B") + . ${thisDir}/auxiliary/help/help_case_no_background_job + ;; "b") . ${thisDir}/auxiliary/help/help_case_bet_best_flag ;; @@ -69,6 +72,9 @@ "f") . ${thisDir}/auxiliary/help/help_case_functional_path ;; + "G") + . ${thisDir}/auxiliary/help/help_case_TGLOBAL + ;; "g") . ${thisDir}/auxiliary/help/help_case_BET_gradient ;; diff --git a/spm8Batch/auxiliary/help/help_sliceTime_Options b/spm8Batch/auxiliary/help/help_sliceTime_Options index 47392a0b..db9e92ff 100644 --- a/spm8Batch/auxiliary/help/help_sliceTime_Options +++ b/spm8Batch/auxiliary/help/help_sliceTime_Options @@ -1,6 +1,7 @@ echo "${helpComment} Sub-directory : ${subPATH}" echo "${helpComment} Volume Wildcard : ${volumeWILD}" echo "${helpComment} fMRI TR : ${TR}" + echo "${helpComment} TGLOBAL : ${TGLOBAL}" echo "${helpComment} FSLOUTPUTTYPE : ${FSLOUTPUTTYPE}" echo "${helpComment} Number of runs to realign : ${nRUN}" diff --git a/spm8Batch/auxiliary/initialization_all b/spm8Batch/auxiliary/initialization_all index 810a7126..7fb55a57 100644 --- a/spm8Batch/auxiliary/initialization_all +++ b/spm8Batch/auxiliary/initialization_all @@ -92,6 +92,10 @@ SLICETIMEROPT= BATCHCOMMAND=1 +# Is this command to run in the background + +BACKGROUNDJOBFLAG=1 + # # Now the process specific initialization # diff --git a/spm8Batch/auxiliary/initialization_sliceTime b/spm8Batch/auxiliary/initialization_sliceTime index f4c790f5..5c2ae150 100644 --- a/spm8Batch/auxiliary/initialization_sliceTime +++ b/spm8Batch/auxiliary/initialization_sliceTime @@ -9,6 +9,8 @@ FSL_COMMENT_B="Slice time correcting subject" outputName=a +mcOPT="" + # # all done # diff --git a/spm8Batch/auxiliary/parse_arguments b/spm8Batch/auxiliary/parse_arguments index 401be941..e8e1b000 100644 --- a/spm8Batch/auxiliary/parse_arguments +++ b/spm8Batch/auxiliary/parse_arguments @@ -67,6 +67,15 @@ do . ${thisDir}/auxiliary/setAnatomyPath ;; + # case_no_background_job + # + # don't launch the job into the background, but run in the foreground, + # this will facilitate daisy-chaining jobs. + # + "B") + . ${thisDir}/auxiliary/setNoBackgroundJob + ;; + # case_bet_best_flag # # look at the BET best flag @@ -107,6 +116,13 @@ do . ${thisDir}/auxiliary/setFunctionalPath ;; + # case_set_TGLOBAL + # + # Set the TGLOBAL value for slice time + # + "G") + . ${thisDir}/auxiliary/setTGlobalValue + ;; # case_set_BET_gradient # # Set the gradient scale for bestBET diff --git a/spm8Batch/auxiliary/setNoBackgroundJob b/spm8Batch/auxiliary/setNoBackgroundJob new file mode 100644 index 00000000..c81eec23 --- /dev/null +++ b/spm8Batch/auxiliary/setNoBackgroundJob @@ -0,0 +1,7 @@ + +# The user wants to run the job in the foreground, only recommended for daisy-chaining. +# We also set the mail account to be null that way jobs in foreground do not by default send +# out email. However, this can be overridden with the -U flag. + + BACKGROUNDJOBFLAG=0 + USEREMAIL="NOMAIL" diff --git a/spm8Batch/auxiliary/setTGlobalValue b/spm8Batch/auxiliary/setTGlobalValue new file mode 100644 index 00000000..bf4a2adc --- /dev/null +++ b/spm8Batch/auxiliary/setTGlobalValue @@ -0,0 +1,20 @@ +# +# Set the value of TGLOBAL +# + shift + let argn++ + if (( $argn >= $args )) + then + echo "Missing parameter for setting TGLOBAL" + . ${thisDir}/auxiliary/exit_w_removal + else + isnumber $1 + retVal=$? + if [ "$retVal" != "0" ] + then + echo "TGLOBAL needs to be numeric, you entered : $1" + . ${thisDir}/auxiliary/exit_w_removal + fi + TGLOBAL=`echo $1 | awk '{printf "%2.2f",$1}'` + isnumber $TGLOBAL + fi diff --git a/spm8Batch/auxiliary/shellScriptLaunch b/spm8Batch/auxiliary/shellScriptLaunch index 97dd2640..f9182ff2 100755 --- a/spm8Batch/auxiliary/shellScriptLaunch +++ b/spm8Batch/auxiliary/shellScriptLaunch @@ -11,10 +11,22 @@ echo "${FULLSCRIPTNAME}.sh" > ${thisDir}/Usage/${SANDBOXHOST}/${theYearMonth}/${ if [ ! "$debugFLAG" == "1" ] then - echo - echo " Lauching script into background." - echo - nohup ${FULLSCRIPTNAME}.sh &> ${FULLSCRIPTNAME}.log & + if [ "${BACKGROUNDJOBFLAG}" == "1" ] + then + echo + echo " Lauching script into background." + echo + nohup ${FULLSCRIPTNAME}.sh &> ${FULLSCRIPTNAME}.log & + else + echo + echo " Launching script into foreground." + echo + ${FULLSCRIPTNAME}.sh &> ${FULLSCRIPTNAME}.log + echo + echo " Script ${FULLSCRIPTNAME}.sh is finished" + echo " Script LOGFILE is : ${FULLSCRIPTNAME}.log" + echo + fi else echo echo " Script can now be launched by hand." diff --git a/spm8Batch/bestBET b/spm8Batch/bestBET index 40d6492d..e8714236 100755 --- a/spm8Batch/bestBET +++ b/spm8Batch/bestBET @@ -35,7 +35,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` #allowedOptions="aDdfhMnOoRrtUw" -allowedOptions="aDdghMtU" +allowedOptions="aBDdghMtU" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/coregHiRes b/spm8Batch/coregHiRes index c066abb5..ff9d2ab7 100755 --- a/spm8Batch/coregHiRes +++ b/spm8Batch/coregHiRes @@ -40,7 +40,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` #allowedOptions="aDdfhMnOoRrtUw" - reslice only is NOT working with other images. -allowedOptions="aDdfhMnOorrtUw" +allowedOptions="aBDdfhMnOorrtUw" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/coregOverlay b/spm8Batch/coregOverlay index 42d3879c..8b3046b6 100755 --- a/spm8Batch/coregOverlay +++ b/spm8Batch/coregOverlay @@ -43,7 +43,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` #allowedOptions="aDdfMnOoRrstUvw" -allowedOptions="aDdfMnOorstUvw" +allowedOptions="aBDdfMnOorstUvw" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/isnumber.sh b/spm8Batch/isnumber.sh index 534b6a30..8ca4919e 100755 --- a/spm8Batch/isnumber.sh +++ b/spm8Batch/isnumber.sh @@ -27,22 +27,15 @@ isdigit() fi } +# New code for determining is an input is a number - 2012-07-27 - RCWelsh + isnumber () # Test if the parameter is a number (integer or float) { retVal=1; - nPeriod=`echo $1 | awk -F . '{print NF}'` - if [ "$nPeriod" -ne "1" -a "$nPeriod" -ne "2" ] - then - return $FAILURE - fi - theNumber=`echo $1 | sed 's/\.//g' ` - isdigit $theNumber + # do it by trying to printf the number fo get error if bad + printf "%2.2f" $1 2> /dev/null > /dev/null retVal=$? - if [ "$retVal" == "0" ] - then - return $SUCCESS - else - return $FAILURE - fi + return $retVal } + diff --git a/spm8Batch/matlabScripts/UMBatchWarpVBM8.m b/spm8Batch/matlabScripts/UMBatchWarpVBM8.m index 1a319a86..1fe1a6ff 100644 --- a/spm8Batch/matlabScripts/UMBatchWarpVBM8.m +++ b/spm8Batch/matlabScripts/UMBatchWarpVBM8.m @@ -219,6 +219,10 @@ [Images2WriteUnique Images2WriteCount] = uniqueNII(Images2Write); + % If the prefix is "w" then we just need to report the images that + % vbm8 has already generated. - RCWelsh 2012-07-27 + tmpNewImages2WriteUnique = []; + for iNII = 1:size(Images2WriteUnique,1) [d1 d2 d3 d4] = spm_fileparts(strtrim(Images2WriteUnique(iNII,:))); newFile = fullfile(d1,['w' d2 d3]); @@ -229,6 +233,9 @@ fprintf('\n\n* * * * * * * * * * * * \n\n'); return end + % If the prefix is "w" then we just need to report the images that + % vbm8 has already generated. - RCWelsh 2012-07-27 + tmpNewImages2WriteUnique = strvcat(tmpNewImages2WriteUnique, newFile); end % Everything up to this point is okay @@ -253,6 +260,10 @@ end newImages2WriteUnique = strvcat(newImages2WriteUnique, newFile); end + else + % If the prefix is "w" then we just need to report the images that + % vbm8 has already generated. - RCWelsh 2012-07-27 + newImages2WriteUnique = tmpNewImages2WriteUnique; end ImageDirectory = fileparts(Images2Write(1,:)); diff --git a/spm8Batch/physioCorr b/spm8Batch/physioCorr index 9ae762ee..0f32f034 100755 --- a/spm8Batch/physioCorr +++ b/spm8Batch/physioCorr @@ -38,7 +38,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="ADdfFiMnpPtUv#" +allowedOptions="ABDdfFiMnpPtUv#" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/realignfMRI b/spm8Batch/realignfMRI index f4b9cd7a..20ad7f15 100755 --- a/spm8Batch/realignfMRI +++ b/spm8Batch/realignfMRI @@ -32,7 +32,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="ADdfiMmnStUv#" +allowedOptions="BADdfiMmnStUv#" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/segHiRes b/spm8Batch/segHiRes index 3ad78d60..85a8ad3e 100755 --- a/spm8Batch/segHiRes +++ b/spm8Batch/segHiRes @@ -38,7 +38,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` #allowedOptions="DdfhMnTtUw" -allowedOptions="DdfhMTtUw" +allowedOptions="BDdfhMTtUw" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/sliceTime b/spm8Batch/sliceTime index 410fd3cd..d5a8d418 100755 --- a/spm8Batch/sliceTime +++ b/spm8Batch/sliceTime @@ -35,7 +35,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="ADdfiMntUv#" +allowedOptions="ABDdFfGiMmntUv#" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart @@ -141,15 +141,15 @@ echo " CURRUN4D=\`ls ${volumeWILD}*.nii 2> /dev/null\` " echo " if [ -e \"\${CURRUN4D}\" ] " >> ${FULLSCRIPTNAME}.sh echo " then" >> ${FULLSCRIPTNAME}.sh echo " FSLOUTPUTTYPE=NIFTI" >> ${FULLSCRIPTNAME}.sh -echo " echo \"slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} -r ${TR} --tglobal=${TGLOBAL}\"">> ${FULLSCRIPTNAME}.sh -echo " slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} -r ${TR} --tglobal=${TGLOBAL}" >> ${FULLSCRIPTNAME}.sh +echo " echo \"slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} ${mcOPT} -r ${TR} --tglobal=${TGLOBAL}\"">> ${FULLSCRIPTNAME}.sh +echo " slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} ${mcOPT} -r ${TR} --tglobal=${TGLOBAL}" >> ${FULLSCRIPTNAME}.sh echo " logTheUMProcess sliceTime ${FULLSCRIPTNAME} \${CURRUN4D} ${outputName}\${CURRUN4D}" >> ${FULLSCRIPTNAME}.sh echo " else" >> ${FULLSCRIPTNAME}.sh echo " echo \"Can't find a 4D ${volumeWILD}*.nii for this run \${CURRUN}\" " >> ${FULLSCRIPTNAME}.sh echo " fi" >> ${FULLSCRIPTNAME}.sh echo " else" >> ${FULLSCRIPTNAME}.sh echo " echo \"Test mode.\" " >> ${FULLSCRIPTNAME}.sh -echo " echo \"slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} -r ${TR} --tglobal=${TGLOBAL}\" " >> ${FULLSCRIPTNAME}.sh +echo " echo \"slicetimer -i \${CURRUN4D} -o ${outputName}\${CURRUN4D} ${mcOPT} -r ${TR} --tglobal=${TGLOBAL}\" " >> ${FULLSCRIPTNAME}.sh echo " fi" >> ${FULLSCRIPTNAME}.sh echo " cd ../" >> ${FULLSCRIPTNAME}.sh echo " done" >> ${FULLSCRIPTNAME}.sh diff --git a/spm8Batch/smoothfMRI b/spm8Batch/smoothfMRI index 48423ae9..fd0189ed 100755 --- a/spm8Batch/smoothfMRI +++ b/spm8Batch/smoothfMRI @@ -32,7 +32,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="DdfMntUv" +allowedOptions="BDdfMntUv" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/spm8Batch_Global b/spm8Batch/spm8Batch_Global index 3b09415d..34e2cd50 100755 --- a/spm8Batch/spm8Batch_Global +++ b/spm8Batch/spm8Batch_Global @@ -41,11 +41,10 @@ then curdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" topDIR="$( cd $curdir/.. && pwd )" - + # You must point to SPM8 !!! SPM8B1=${topDIR}/SPM/SPM8/spm8_with_R4667 - # This is Robert Welsh's UNIX batch interface to spm8 diff --git a/spm8Batch/testIsNumber.sh b/spm8Batch/testIsNumber.sh new file mode 100755 index 00000000..bfa9628e --- /dev/null +++ b/spm8Batch/testIsNumber.sh @@ -0,0 +1,27 @@ + +. isnumber.sh + +for THING in a 1 a1 1.1 1.1.1 0.1 +do + isnumber $THING + retVal=$? + if [ "$retVal" == "0" ] + then + echo $retVal NUMBER $THING + else + echo $retVal NOTNUMBER $THING + fi +done + +for THING in a b c 1 2 3 4 . +do + isdigit $THING + retVal=$? + if [ "$retVal" == "0" ] + then + echo $retVal DIGIT $THING + else + echo $retVal NOTDIGIT $THING + fi +done + \ No newline at end of file diff --git a/spm8Batch/vbm8HiRes b/spm8Batch/vbm8HiRes index c70f43c8..465898fd 100755 --- a/spm8Batch/vbm8HiRes +++ b/spm8Batch/vbm8HiRes @@ -37,7 +37,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="aDdhIMnOtUwz" +allowedOptions="aBDdhIMnOtUwz" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/warpHiRes b/spm8Batch/warpHiRes index 8c690c22..640b897f 100755 --- a/spm8Batch/warpHiRes +++ b/spm8Batch/warpHiRes @@ -37,7 +37,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="DdfhMnOTtUwz" +allowedOptions="BDdfhMnOTtUwz" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart diff --git a/spm8Batch/warpfMRI b/spm8Batch/warpfMRI index 044947d5..b2e2b57a 100755 --- a/spm8Batch/warpfMRI +++ b/spm8Batch/warpfMRI @@ -37,7 +37,7 @@ thisDir=`dirname $theCommand` thisCommand=`echo $theCommand | awk -F/ '{print $NF}'` -allowedOptions="DdfhIMntUvWwz" +allowedOptions="BDdfhIMntUvWwz" # This piece of code all of the spm8Batch scripts will use . ${thisDir}/auxiliary/commonCode_AllScriptsStart