Skip to content

Commit

Permalink
Merge pull request #5 from Washington-University/general-electric-fie…
Browse files Browse the repository at this point in the history
…ld-map-support

Integrated code to support General Electric Gradient Echo field map
  • Loading branch information
tbbrown committed Nov 18, 2014
2 parents 7b021b3 + c07bc57 commit c08c02c
Show file tree
Hide file tree
Showing 8 changed files with 871 additions and 387 deletions.
71 changes: 50 additions & 21 deletions Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,50 @@ PRINTCOM=""

########################################## 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:

# 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.
#
# For example, if phase encoding directions are LR and RL, 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).
#
# If phase encoding directions are PA and AP:
#
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_PA/${Subject}_3T_tfMRI_EMOTION_PA.nii.gz
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_PA/${Subject}_3T_tfMRI_EMOTION_PA_SBRef.nii.gz
#
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_AP/${Subject}_3T_tfMRI_EMOTION_AP.nii.gz
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_AP/${Subject}_3T_tfMRI_EMOTION_AP_SBRef.nii.gz
#
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_PA/${Subject}_3T_SpinEchoFieldMap_PA.nii.gz
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_PA/${Subject}_3T_SpinEchoFieldMap_AP.nii.gz
#
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_AP/${Subject}_3T_SpinEchoFieldMap_PA.nii.gz
# ${StudyFolder}/${Subject}/unprocessed/3T/tfMRI_EMOTION_AP/${Subject}_3T_SpinEchoFieldMap_AP.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 ##########################################

Expand All @@ -108,15 +125,25 @@ for Subject in $Subjlist ; do
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.00058" #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
DistortionCorrection="TOPUP" # FIELDMAP, SiemensFieldMap, GeneralElectricFieldMap, 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="NONE" #Expects 4D Magnitude volume with two 3D timepoints, set to NONE if using TOPUP
PhaseInputName="NONE" #Expects a 3D Phase volume, set to NONE if using TOPUP

# Path to General Electric style B0 fieldmap with two volumes
# 1. field map in degrees
# 2. magnitude
# Set to "NONE" if not using "GeneralElectricFieldMap" as the value for the DistortionCorrection variable
#
# Example Value:
# GEB0InputName="${StudyFolder}/${Subject}/unprocessed/3T/${fMRIName}/${Subject}_3T_GradientEchoFieldMap.nii.gz"
GEB0InputName="NONE"

DeltaTE="NONE" #2.46ms for 3T, 1.02ms for 7T, set to NONE if using TOPUP
FinalFMRIResolution="2" #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="NONE" # SEt to NONE to skip gradient distortion correction
GradientDistortionCoeffs="NONE" # Set to NONE to skip gradient distortion correction
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
Expand All @@ -137,6 +164,7 @@ for Subject in $Subjlist ; do
--SEPhasePos=$SpinEchoPhaseEncodePositive \
--fmapmag=$MagnitudeInputName \
--fmapphase=$PhaseInputName \
--fmapgeneralelectric=$GEB0InputName \
--echospacing=$DwellTime \
--echodiff=$DeltaTE \
--unwarpdir=$UnwarpDir \
Expand All @@ -157,6 +185,7 @@ for Subject in $Subjlist ; do
--SEPhasePos=$SpinEchoPhaseEncodePositive \
--fmapmag=$MagnitudeInputName \
--fmapphase=$PhaseInputName \
--fmapgeneralelectric=$GEB0InputName \
--echospacing=$DwellTime \
--echodiff=$DeltaTE \
--unwarpdir=$UnwarpDir \
Expand Down
Loading

0 comments on commit c08c02c

Please sign in to comment.