dwi_legacy_gpu#

qx_utilities.bash.dwi_legacy_gpu(sessions, echospacing, pedir, unwarpdir, usefieldmap, usesefieldmap, diffdatasuffix, te, sessionsfolder='.', overwrite='no', nogpu='no', extra_eddy_args='--fwhm=10,0,0,0,0 --ff=10 --nvoxhp=2000 --flm=quadratic --data_is_shelled --repol --cnr_maps')#

dwi_legacy_gpu

Run DWI preprocessing using the FUGUE method for legacy data that are not TOPUP compatible.

Warning

The command assumes the Human Connectome Project folder structure for preprocessing.

DWI data needs to be in the following folder:

<study_folder>/<session>/hcp/<session>/unprocessed/Diffusion

T1w data needs to be in the following folder:

<study_folder>/<session>/hcp/<session>/T1w

If PreFreeSurfer component of the HCP Pipelines was run the function will make use of the T1w data [Results will be better due to superior brain stripping].

If PreFreeSurfer component of the HCP Pipelines was NOT run the function will start from raw T1w data [Results may be less optimal].

Parameters

--sessionsfolder (str, default '.'):

Path to study data folder.

--sessions (str):

Comma separated list of sessions to run.

--echospacing (str):

EPI Echo Spacing for data [in ms]; e.g. 0.69.

--pedir (int):

Use 1 for Left-Right Phase Encoding, 2 for Anterior-Posterior.

--unwarpdir (str):

Direction for EPI image unwarping; e.g. 'x' or 'x-' for LR/RL, 'y' or 'y-' for AP/PA; may been to try out both -/+ combinations.

--usefieldmap (str):

Whether to use the standard field map ('yes' | 'no'). The field map images are expected in:

<study_folder>/<session>/hcp/<session>/unprocessed/FieldMap1

If set to <yes> then the parameter --te becomes mandatory. Mutually exclusive with --usesefieldmap.

--usesefieldmap (str):

Whether to use a Spin Echo (SE) field map pair for distortion correction ('yes' | 'no'). The SE field map images are expected in:

<study_folder>/<session>/hcp/<session>/unprocessed/SpinEchoFieldMap1

as <session>*AP_SB_SE.nii.gz and <session>*PA_SB_SE.nii.gz. Mutually exclusive with --usefieldmap.

--diffdatasuffix (str):

Name of the DWI image; e.g. if the data is called <session>_DWI_dir91_LR.nii.gz - you would enter DWI_dir91_LR. If you provide multiple suffixes, QuNex will merge the images along with their bvals and bvecs and run processing on the merged image.

--overwrite (str, default 'no'):

Whether to overwrite existing data (yes) or not (no). Note that previous data is deleted before the run, so in the case of a failed command run, previous results are lost.

--te (float):

This is the echo time difference of the fieldmap sequence - find this out form the operator - defaults are usually 2.46ms on SIEMENS.

--nogpu (flag, default 'no'):

If set, this command will be processed useing a CPU instead of a GPU.

--extra_eddy_args (str, default '--fwhm=10,0,0,0,0 --ff=10 --nvoxhp=2000 --flm=quadratic --data_is_shelled --repol --cnr_maps'):

Extra arguments to pass to eddy command. By default, some recommended parameters are set, but you can override them by providing your own string of parameters. The string is appended to the eddy call as is.

Output files

  • difffolder=${sessionsfolder}/${session}/hcp/${session}/Diffusion

  • t1wdifffolder=${sessionsfolder}/${session}/hcp/${session}/T1w/Diffusion

$difffolder/rawdata
$difffolder/eddy
$difffolder/data
$difffolder/reg
$t1wdifffolder

Notes

Apptainer (Singularity) and GPU support:

If nogpu is not provided, this command will facilitate GPUs to speed up processing. Since the command uses CUDA binaries, an NVIDIA GPU is required. To give access to CUDA drivers to the system inside the Apptainer (Singularity) container, you need to use the --nv flag of the qunex_container script.

Examples

NOTE: CUDA libraries need to be loaded for this command to work, to do this you usually need to load the appropriate module on HPC systems. When scheduling for example, add the bash parameter to the command call, e.g.:

--bash="module load CUDA/11.3.1"

qunex dwi_legacy_gpu \\
    --sessionsfolder='<folder_with_sessions>' \\
    --sessions='<comma_separarated_list_of_cases>' \\
    --pedir='1' \\
    --echospacing='0.69' \\
    --te='2.46' \\
    --unwarpdir='x-' \\
    --diffdatasuffix='DWI_dir91_LR' \\
    --usefieldmap='yes' \\
    --overwrite='yes'

Example with flagged parameters for submission to the scheduler using Siemens FieldMap (needs GPU-enabled queue):

qunex dwi_legacy_gpu \\
    --sessionsfolder='<folder_with_sessions>' \\
    --sessions='<comma_separarated_list_of_cases>' \\
    --pedir='1' \\
    --echospacing='0.69' \\
    --te='2.46' \\
    --unwarpdir='x-' \\
    --diffdatasuffix='DWI_dir91_LR' \\
    --usefieldmap='yes' \\
    --overwrite='yes' \\
    --bash="module load CUDA//11.3.1" \\
    --scheduler='<name_of_scheduler_and_options>'

Example with disabled GPU processing:

qunex dwi_legacy_gpu \\
    --sessionsfolder='<folder_with_sessions>' \\
    --sessions='<comma_separarated_list_of_cases>' \\
    --diffdatasuffix='DWI_dir91_LR' \\
    --usefieldmap='no' \\
    --pedir='1' \\
    --echospacing='0.69' \\
    --unwarpdir='x-' \\
    --overwrite='yes' \\
    --nogpu='yes'

Example with Spin Echo FieldMap distortion correction:

qunex dwi_legacy_gpu \\
    --sessionsfolder='<folder_with_sessions>' \\
    --sessions='<comma_separarated_list_of_cases>' \\
    --pedir='2' \\
    --echospacing='0.69' \\
    --unwarpdir='y-' \\
    --diffdatasuffix='DWI_dir91_LR' \\
    --usesefieldmap='yes' \\
    --overwrite='yes'