Tim,
A patch here to use array instead of space delimited string might be helpful
for error detection:
e.g.
Tasklist=(domino0 domino1 domino2 domino3)
PhaseEncodinglist=(y y- y y-)
nTasklist=${#Tasklist[@]}
nPhaseEncodinglist=${#PhaseEncodinglist[@]}
if [ $nTasklist -ne $nPhaseEncodinglist ]; then
<Error message>
fi
Gordon
> On Dec 9, 2014, at 3:33 PM, Glasser, Matthew <[email protected]> wrote:
>
> You need to expand the PhaseEncodinglist variable to have the same length as
> the Tasklist variable (i.e. same number of elements separated by spaces).
> This probably should be made clearer in the comments for these variables.
>
> Peace,
>
> Matt.
>
> From: <Book>, Gregory <[email protected]>
> Date: Tuesday, December 9, 2014 at 2:19 PM
> To: Matt Glasser <[email protected]>, "[email protected]"
> <[email protected]>
> Subject: RE: [HCP-Users] error when processing more than 2 tasks with
> GenericfMRIVolume script
>
> Thanks, the script is attached. Also the directory structure is after the
> script.
>
> #!/bin/bash
>
> get_batch_options() {
> local arguments=($@)
>
> unset command_line_specified_study_folder
> unset command_line_specified_subj_list
> unset command_line_specified_run_local
>
> local index=0
> local numArgs=${#arguments[@]}
> local argument
>
> while [ ${index} -lt ${numArgs} ]; do
> argument=${arguments[index]}
>
> case ${argument} in
> --StudyFolder=*)
> command_line_specified_study_folder=${argument/*=/""}
> index=$(( index + 1 ))
> ;;
> --Subjlist=*)
> command_line_specified_subj_list=${argument/*=/""}
> index=$(( index + 1 ))
> ;;
> --runlocal)
> command_line_specified_run_local="TRUE"
> index=$(( index + 1 ))
> ;;
> esac
> done
> }
>
> get_batch_options $@
>
> StudyFolder="/home/pipeline/onrc/data/pipeline/S3777AUX/4/HCPfMRI-dominoSkyra"
> Subjlist="analysis"
> EnvironmentScript="/opt/HCP/HCP/Examples/Scripts/SetUpHCPPipeline.sh"
>
> if [ -n "${command_line_specified_study_folder}" ]; then
> StudyFolder="${command_line_specified_study_folder}"
> fi
>
> if [ -n "${command_line_specified_subj_list}" ]; then
> Subjlist="${command_line_specified_subj_list}"
> fi
>
> # Requirements for this script
> # installed versions of: FSL (version 5.0.6), FreeSurfer (version 5.3.0-HCP)
> , gradunwarp (HCP version 1.0.1)
> # environment: FSLDIR , FREESURFER_HOME , HCPPIPEDIR , CARET7DIR , PATH (for
> gradient_unwarp.py)
>
> #Set up pipeline environment variables and software
> . ${EnvironmentScript}
>
> # Log the originating call
> echo "$@"
>
> #if [ X$SGE_ROOT != X ] ; then
> QUEUE="-q long.q"
> #fi
>
> PRINTCOM=""
> #PRINTCOM="echo"
> #QUEUE="-q veryshort.q"
>
> ########################################## INPUTS
> ##########################################
>
> #Scripts called by this script do NOT assume anything about the form of the
> input names or paths.
> #This batch script assumes the HCP raw data naming convention, e.g. for
> tfMRI_EMOTION_LR and tfMRI_EMOTION_RL:
>
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_LR/${Subject}_3T_tfMRI_EMOTION_LR.nii.gz
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_LR/${Subject}_3T_tfMRI_EMOTION_LR_SBRef.nii.gz
>
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_RL/${Subject}_3T_tfMRI_EMOTION_RL.nii.gz
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_RL/${Subject}_3T_tfMRI_EMOTION_RL_SBRef.nii.gz
>
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_LR/${Subject}_3T_SpinEchoFieldMap_LR.nii.gz
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_LR/${Subject}_3T_SpinEchoFieldMap_RL.nii.gz
>
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_RL/${Subject}_3T_SpinEchoFieldMap_LR.nii.gz
> #
> ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_RL/${Subject}_3T_SpinEchoFieldMap_RL.nii.gz
>
> #Change Scan Settings: Dwelltime, FieldMap Delta TE (if using), and
> $PhaseEncodinglist to match your images
> #These are set to match the HCP Protocol by default
>
> #If using gradient distortion correction, use the coefficents from your
> scanner
> #The HCP gradient distortion coefficents are only available through Siemens
> #Gradient distortion in standard scanners like the Trio is much less than for
> the HCP Skyra.
>
> #To get accurate EPI distortion correction with TOPUP, the flags in
> PhaseEncodinglist must match the phase encoding
> #direction of the EPI scan, and you must have used the correct images in
> SpinEchoPhaseEncodeNegative and Positive
> #variables. If the distortion is twice as bad as in the original images,
> flip either the order of the spin echo
> #images or reverse the phase encoding list flag. The pipeline expects you to
> have used the same phase encoding
> #axis in the fMRI data as in the spin echo field map data (x/-x or y/-y).
>
> ######################################### DO WORK
> ##########################################
>
> Tasklist=" domino0 domino1 domino2 domino3"
> PhaseEncodinglist="y y-"
>
> for Subject in $Subjlist ; do
> echo $Subject
>
> i=1
> for fMRIName in $Tasklist ; do
> echo " ${fMRIName}"
> UnwarpDir=`echo $PhaseEncodinglist | cut -d " " -f $i`
>
> fMRITimeSeries="${StudyFolder}/${Subject}/unprocessed/3T/${fMRIName}/${Subject}_3T_${fMRIName}.nii.gz"
> fMRISBRef="${StudyFolder}/${Subject}/unprocessed/3T/${fMRIName}/${Subject}_3T_${fMRIName}_SBRef.nii.gz"
> #A single band reference image (SBRef) is recommended if using multiband,
> set to NONE if you want to use the first volume of the timeseries for motion
> correction
> DwellTime="0.00055" #Echo Spacing or Dwelltime of fMRI image, set to NONE
> if not used. Dwelltime = 1/(BandwidthPerPixelPhaseEncode * # of phase
> encoding samples): DICOM field (0019,1028) = BandwidthPerPixelPhaseEncode,
> DICOM field (0051,100b) AcquisitionMatrixText first value (# of phase
> encoding samples). On Siemens, iPAT/GRAPPA factors have already been
> accounted for.
> DistortionCorrection="TOPUP" #FIELDMAP or TOPUP, distortion correction is
> required for accurate processing
>
> SpinEchoPhaseEncodeNegative="${StudyFolder}/${Subject}/unprocessed/3T/${fMRIName}/${Subject}_3T_SpinEchoFieldMap_LR.nii.gz"
> #For the spin echo field map volume with a negative phase encoding direction
> (LR in HCP data, AP in 7T HCP data), set to NONE if using regular FIELDMAP
>
> SpinEchoPhaseEncodePositive="${StudyFolder}/${Subject}/unprocessed/3T/${fMRIName}/${Subject}_3T_SpinEchoFieldMap_RL.nii.gz"
> #For the spin echo field map volume with a positive phase encoding direction
> (RL in HCP data, PA in 7T HCP data), set to NONE if using regular FIELDMAP
>
> MagnitudeInputName="${StudyFolder}/${Subject}/unprocessed/3T/T1w_MPR1/${Subject}_3T_FieldMap_Magnitude.nii.gz"
> #Expects 4D magitude volume with two 3D timepoints or "NONE" if not used
>
> PhaseInputName="${StudyFolder}/${Subject}/unprocessed/3T/T1w_MPR1/${Subject}_3T_FieldMap_Phase.nii.gz"
> #Expects 3D phase difference volume or "NONE" if not used
> DeltaTE="NONE" #2.46ms for 3T, 1.02ms for 7T, set to NONE if using TOPUP
> FinalFMRIResolution="3" #Target final resolution of fMRI data. 2mm is
> recommended for 3T HCP data, 1.6mm for 7T HCP data (i.e. should match
> acquired resolution). Use 2.0 or 1.0 to avoid standard FSL templates
> #GradientDistortionCoeffs="${HCPPIPEDIR_Config}/coeff_SC72C_Skyra.grad"
> #Gradient distortion correction coefficents, set to NONE to turn off
> GradientDistortionCoeffs="/opt/HCP/coeff_AS098.grad"
> TopUpConfig="${HCPPIPEDIR_Config}/b02b0.cnf" #Topup config if using
> TOPUP, set to NONE if using regular FIELDMAP
>
> if [ -n "${command_line_specified_run_local}" ] ; then
> echo "About to run
> ${HCPPIPEDIR}/fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh"
> queuing_command=""
> else
> echo "About to use fsl_sub to queue or run
> ${HCPPIPEDIR}/fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh"
> queuing_command="${FSLDIR}/bin/fsl_sub ${QUEUE}"
> fi
>
> ${queuing_command}
> ${HCPPIPEDIR}/fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh \
> --path=$StudyFolder \
> --subject=$Subject \
> --fmriname=$fMRIName \
> --fmritcs=$fMRITimeSeries \
> --fmriscout=$fMRISBRef \
> --SEPhaseNeg=$SpinEchoPhaseEncodeNegative \
> --SEPhasePos=$SpinEchoPhaseEncodePositive \
> --fmapmag=$MagnitudeInputName \
> --fmapphase=$PhaseInputName \
> --echospacing=$DwellTime \
> --echodiff=$DeltaTE \
> --unwarpdir=$UnwarpDir \
> --fmrires=$FinalFMRIResolution \
> --dcmethod=$DistortionCorrection \
> --gdcoeffs=$GradientDistortionCoeffs \
> --topupconfig=$TopUpConfig \
> --printcom=$PRINTCOM
>
> # The following lines are used for interactive debugging to set the
> positional parameters: $1 $2 $3 ...
>
> echo "set -- --path=$StudyFolder \
> --subject=$Subject \
> --fmriname=$fMRIName \
> --fmritcs=$fMRITimeSeries \
> --fmriscout=$fMRISBRef \
> --SEPhaseNeg=$SpinEchoPhaseEncodeNegative \
> --SEPhasePos=$SpinEchoPhaseEncodePositive \
> --fmapmag=$MagnitudeInputName \
> --fmapphase=$PhaseInputName \
> --echospacing=$DwellTime \
> --echodiff=$DeltaTE \
> --unwarpdir=$UnwarpDir \
> --fmrires=$FinalFMRIResolution \
> --dcmethod=$DistortionCorrection \
> --gdcoeffs=$GradientDistortionCoeffs \
> --topupconfig=$TopUpConfig \
> --printcom=$PRINTCOM"
>
> echo ". ${EnvironmentScript}"
>
> i=$(($i+1))
> done
> done
>
>
> /analysis/unprocessed/3T/T1w_MPR1/analysis_3T_FieldMap_Magnitude.nii.gz
> Nov 24, 2014 14:10:03 rwxrwxrwx 490,268
> /analysis/unprocessed/3T/T1w_MPR1/analysis_3T_FieldMap_Phase.nii.gz
> Nov 24, 2014 14:10:03 rwxrwxrwx 500,252
> /analysis/unprocessed/3T/T1w_MPR1/analysis_3T_T1w_MPR1.nii.gz Nov 24, 2014
> 14:10:03 rwxrwxrwx 13,474,708
> /analysis/unprocessed/3T/T1w_MPR2/analysis_3T_T1w_MPR2.nii.gz Nov 24, 2014
> 14:10:04 rwxrwxrwx 13,446,820
> /analysis/unprocessed/3T/T1w_MPR3/analysis_3T_T1w_MPR3.nii.gz Nov 24, 2014
> 14:10:04 rwxrwxrwx 13,432,074
> /analysis/unprocessed/3T/T1w_MPR4/analysis_3T_T1w_MPR4.nii.gz Nov 24, 2014
> 14:10:05 rwxrwxrwx 13,393,346
> /analysis/unprocessed/3T/T1w_MPR5/analysis_3T_T1w_MPR5.nii.gz Nov 24, 2014
> 14:10:05 rwxrwxrwx 13,398,238
> /analysis/unprocessed/3T/T2w_SPC1/analysis_3T_T2w_SPC1.nii.gz Nov 24,
> 2014 14:10:06 rwxrwxrwx 8,551,575
> /analysis/unprocessed/3T/domino0/analysis_3T_SpinEchoFieldMap_LR.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,119,399
> /analysis/unprocessed/3T/domino0/analysis_3T_SpinEchoFieldMap_RL.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,127,080
> /analysis/unprocessed/3T/domino0/analysis_3T_domino0.nii.gz Dec
> 9, 2014 15:51:37 rwxr-xr-x 486,903,684
> /analysis/unprocessed/3T/domino0/analysis_3T_domino0_SBRef.nii.gz
> Dec 9, 2014 15:52:10 rwxr-xr-x 446,348
> /analysis/unprocessed/3T/domino1/analysis_3T_SpinEchoFieldMap_LR.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,119,399
> /analysis/unprocessed/3T/domino1/analysis_3T_SpinEchoFieldMap_RL.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,127,080
> /analysis/unprocessed/3T/domino1/analysis_3T_domino1.nii.gz Dec
> 9, 2014 15:51:46 rwxr-xr-x 488,162,639
> /analysis/unprocessed/3T/domino1/analysis_3T_domino1_SBRef.nii.gz
> Dec 9, 2014 15:52:11 rwxr-xr-x 447,898
> /analysis/unprocessed/3T/domino2/analysis_3T_SpinEchoFieldMap_LR.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,119,399
> /analysis/unprocessed/3T/domino2/analysis_3T_SpinEchoFieldMap_RL.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,127,080
> /analysis/unprocessed/3T/domino2/analysis_3T_domino2.nii.gz Dec
> 9, 2014 15:51:58 rwxr-xr-x 486,336,577
> /analysis/unprocessed/3T/domino2/analysis_3T_domino2_SBRef.nii.gz
> Dec 9, 2014 15:52:11 rwxr-xr-x 447,153
> /analysis/unprocessed/3T/domino3/analysis_3T_SpinEchoFieldMap_LR.nii.gz Dec
> 9, 2014 15:52:11 rwxr-xr-x 1,119,399
> /analysis/unprocessed/3T/domino3/analysis_3T_SpinEchoFieldMap_RL.nii.gz Dec
> 9, 2014 15:52:12 rwxr-xr-x 1,127,080
> /analysis/unprocessed/3T/domino3/analysis_3T_domino3.nii.gz Dec
> 9, 2014 15:52:10 rwxr-xr-x 484,561,229
> /analysis/unprocessed/3T/domino3/analysis_3T_domino3_SBRef.nii.gz
> Dec 9, 2014 15:52:11 rwxr-xr-x 445,265
>
> From: Glasser, Matthew [mailto:[email protected]]
> Sent: Tuesday, December 09, 2014 2:43 PM
> To: Book, Gregory; [email protected]
> Subject: Re: [HCP-Users] error when processing more than 2 tasks with
> GenericfMRIVolume script
>
> Can you post the text of your launcher script? Only one task is run at a
> time inside the pipeline, so the issue will be there.
>
> Peace,
>
> Matt.
>
> From: <Book>, Gregory <[email protected]>
> Date: Tuesday, December 9, 2014 at 12:29 PM
> To: "[email protected]" <[email protected]>
> Subject: [HCP-Users] error when processing more than 2 tasks with
> GenericfMRIVolume script
>
> We’ve run into a weird problem when using the GenericfMRIVolume batch script
> to process more than 2 tasks at a time. When we setup any more than 2 tasks
> (we’ve tried 3 and 4 tasks), the first 2 run correctly and without error, but
> any after that crash in the TopUp section with the following error (the
> failed tasks all get to the same point):
>
> # RUN TOPUP
> # Needs FSL (version 5.0.6)
> ${FSLDIR}/bin/topup --imain=${WD}/BothPhases --datain=$txtfname
> --config=${TopupConfig} --out=${WD}/Coefficents --iout=${WD}/Magnitudes
> --fout=${WD}/TopupField --dfout=${WD}/WarpField --rbmout=${WD}/MotionMatrix
> --jacout=${WD}/Jacobian -v
> Could not open matrix file
> /home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/shop1/DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbased/FieldMap/acqparams.txt
>
> Part of FSL (build 506)
> topup
>
> Usage:
> topup --imain= --datain= --config= --coutname=my_field
>
>
> Compulsory arguments (You MUST set one or more of):
> --imain name of 4D file with images
> --datain name of text file with PE
> directions/times
>
> Optional arguments (You may optionally specify one or more of):
> --out base-name of output files (spline
> coefficients (Hz) and movement parameters)
> --fout name of image file with field (Hz)
> --iout name of 4D image file with
> unwarped images
> --logout Name of log-file
> --warpres (approximate) resolution (in mm) of warp
> basis for the different sub-sampling levels, default 10
> --subsamp sub-sampling scheme, default 1
> --fwhm FWHM (in mm) of gaussian smoothing
> kernel, default 8
> --config Name of config file specifying
> command line arguments
> --miter Max # of non-linear iterations,
> default 5
> --lambda Weight of regularisation, default
> depending on --ssqlambda and --regmod switches. See user documetation.
> --ssqlambda If set (=1), lambda is weighted by current
> ssq, default 1
> --regmod Model for regularisation of warp-field
> [membrane_energy bending_energy], default bending_energy
> --estmov Estimate movements if set, default 1
> (true)
> --minmet Minimisation method
> 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient, default 0 (LM)
> --splineorder Order of spline, 2->Qadratic spline,
> 3->Cubic spline. Default=3
> --numprec Precision for representing Hessian, double
> or float. Default double
> --interp Image interpolation model, linear or
> spline. Default spline
> --scale If set (=1), the images are
> individually scaled to a common mean, default 0 (false)
> --regrid If set (=1), the calculations are
> done in a different grid, default 1 (true)
> -h,--help display help info
> -v,--verbose Print diagonostic information while running
> -h,--help display help info
>
>
>
> TopupFileIO:: msg=TopupDatafileReader:: error reading file
> /home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/shop1/DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbased/FieldMap/acqparams.txt
> set -- --path=/home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST
> --subject=analysis --fmriname=shop1
> --fmritcs=/home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/unprocessed/3T/shop1/analysis_3T_shop1.nii.gz
>
> --fmriscout=/home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/unprocessed/3T/shop1/analysis_3T_shop1_SBRef.nii.gz
>
> --SEPhaseNeg=/home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/unprocessed/3T/shop1/analysis_3T_SpinEchoFieldMap_LR.nii.gz
>
> --SEPhasePos=/home/pipeline/onrc/data/pipeline/S8931EBN/2/HCPfMRI-SMARTTEST/analysis/unprocessed/3T/shop1/analysis_3T_SpinEchoFieldMap_RL.nii.gz
> --fmapmag=NONE --fmapphase=NONE --echospacing=0.00055
> --echodiff=NONE --unwarpdir= --fmrires=2 --dcmethod=TOPUP
> --gdcoeffs=/opt/HCP/coeff_AS098.grad
> --topupconfig=/opt/HCP/HCP/global/config/b02b0.cnf --printcom=
> . /opt/HCP/HCP/Examples/Scripts/SetUpHCPPipeline.sh
>
> _________________________________________________
> Gregory Book
> Senior Technology Manager
> Olin Neuropsychiatry Research Center, Institute of Living, Hartford Hospital
> 200 Retreat Avenue
> Hartford, CT 06106
> Tel: 860-545-7267 Fax: 860-545-7797
> [email protected]
> http://nidb.sourceforge.net
>
>
> This e-mail message, including any attachments, is for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure, or distribution is
> prohibited. If you are not the intended recipient, or an employee or agent
> responsible for delivering the message to the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message, including any attachments.
> _______________________________________________
> HCP-Users mailing list
> [email protected]
> http://lists.humanconnectome.org/mailman/listinfo/hcp-users
>
>
> The materials in this message are private and may contain Protected
> Healthcare Information or other information of a sensitive nature. If you are
> not the intended recipient, be advised that any unauthorized use, disclosure,
> copying or the taking of any action in reliance on the contents of this
> information is strictly prohibited. If you have received this email in error,
> please immediately notify the sender via telephone or return mail.
>
>
> The materials in this message are private and may contain Protected
> Healthcare Information or other information of a sensitive nature. If you are
> not the intended recipient, be advised that any unauthorized use, disclosure,
> copying or the taking of any action in reliance on the contents of this
> information is strictly prohibited. If you have received this email in error,
> please immediately notify the sender via telephone or return mail.
> _______________________________________________
> HCP-Users mailing list
> [email protected]
> http://lists.humanconnectome.org/mailman/listinfo/hcp-users
>
_______________________________________________
HCP-Users mailing list
[email protected]
http://lists.humanconnectome.org/mailman/listinfo/hcp-users