Using "slice_order" instead of "json" for eddy

Summary of what happened:

Hello!
In my eddy_config.json I included “slice_order”. But I got this error: EddyInputError: --mb, --slspec and --json mutually exclusive . I did not include “json”, so does QSIPrep automatically add this parameter when running eddy? And is there a way to disable this?

Previously, I have not had to do this and had no problems with Eddy. But for this batch of subject’s that I’m processing their DWI JSONs do not have a ‘SliceTiming’ field and as a result I am running into errors with slice2vol correction. I do however have a slspec.txt file for each subject, which is why I wanted to pass that in to eddy instead.

Thank you for your time.

Best,

Sofie

Command used (and if a helper script was used, a link to the helper script or the command generated):

apptainer run --nv --cleanenv --containall -B {root_dir} --env TEMPLATEFLOW_HOME={path} /opt/containers/qsiprep-1.1.1.sif {input_dir} {output_dir} participant --unringing-method mrdegibbs --participant-label 015138 --output-resolution 2 --fs-license-file /opt/freesurfer/license.txt --omp-nthreads 1 --eddy-config {root_dir}/eddy_config.json --bids-filter-file {root_dir}/bids_filter.json --separate-all-dwis --skip-bids-validation -w {work_dir}

Version:

1.1.1

Environment (Docker, Singularity / Apptainer, custom installation):

Apptainer

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

EddyInputError:  --mb, --slspec and --json mutually exclusive 

Screenshots / relevant information:

eddy_cuda10.2 --cnr_maps --field={work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/topup/fieldmap_HZ --field_mat=/{work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/topup_to_eddy_reg/topup_reg_image_flirt.mat --flm=quadratic --ff=10.0 --acqp={work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/gather_inputs/eddy_acqp.txt --bvals={input_dir}/sub-015138/ses-1/dwi/sub-015138_ses-1_acq-AP_run-001_dwi.bval --bvecs={input_dir}/sub-015138/ses-1/dwi/sub-015138_ses-1_acq-AP_run-001_dwi.bvec --imain=/{work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/pre_hmc_wf/merge_and_denoise_wf/dwi_denoise_ses_1_acq_AP_run_001_dwi_wf/degibbser/sub-015138_ses-1_acq-AP_run-001_dwi_denoised_mrdegibbs.nii.gz --index={work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/gather_inputs/eddy_index.txt --mask={work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/transform_mask_to_eddy/topup_imain_corrected_avg_trans_mask_trans_flirt.nii.gz --interp=spline --data_is_shelled --json={work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/pre_hmc_wf/merge_and_denoise_wf/merge_dwis/merged_metadata.json --resamp=jac --mporder=18 --niter=5 --nthr=1 --nvoxhp=1000 --out=/{work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/eddy/eddy_corrected --repol --residuals --s2v_interp=trilinear --s2v_lambda=1 --s2v_niter=5 --slspec={input_dir}/sub-015138/ses-1/dwi/FSL_eddy_015138_slspec.txt --slm=none

Here is my eddy_config.json as well:



{
“flm”: “quadratic”,
“slm”: “none”,
“fep”: false,
“interp”: “spline”,
“nvoxhp”: 1000,
“fudge_factor”: 10,
“dont_sep_offs_move”: false,
“dont_peas”: false,
“niter”: 5,
“method”: “jac”,
“repol”: true,
“num_threads”: 1,
“is_shelled”: true,
“use_cuda”: true,
“cnr_maps”: true,
“residuals”: true,
“mporder”: 18,
“slice2vol_interp”: “trilinear”,
“slice2vol_niter”: 5,
“slice2vol_lambda”: 1,
“slice_order”: “{input_dir}/sub-015138/ses-1/dwi/slspec.txt”,
“output_type”: “NIFTI_GZ”,
“args”: “”
}

slspec.txt

  1  38
  3  40
  5  42
  7  44
  9  46
 11  48
 13  50
 15  52
 17  54
 19  56
 21  58
 23  60
 25  62
 27  64
 29  66
 31  68
 33  70
 35  72
  0  37
  2  39
  4  41
  6  43
  8  45
 10  47
 12  49
 14  51
 16  53
 18  55
 20  57
 22  59
 24  61
 26  63
 28  65
 30  67
 32  69
 34  71
 36  73

Hi @scchung,

In the future please use the Software Support post template for these kind of questions. You can see I added the information in for you this time and you can edit your post to add the requested information. When adding your code I would also add in your eddy spec input.

Best,

Steven

@Steven My bad! I just updated it.

Hi @scchung,

I believe QSIPrep does add in the json key automatically, and I do not think there’s a way to overwrite that behavior. You might be better off adding the slice order metadata to the raw DWI jsons.

Best,

Steven

Sorry for the confusion here, if you have the slice timings correct in your bids sidecar they will be used automatically via the -json flag to eddy. You don’t have to manually provide an slspec

@Steven @mattcieslak So these specific subjects I’m processing actually did not have ‘SliceTiming’ in their BIDs JSON. I do however have their slspec.txt file:

1 38
3 40
5 42
7 44
9 46
11 48
13 50
15 52
17 54
19 56
21 58
23 60
25 62
27 64
29 66
31 68
33 70
35 72
0 37
2 39
4 41
6 43
8 45
10 47
12 49
14 51
16 53
18 55
20 57
22 59
24 61
26 63
28 65
30 67
32 69
34 71
36 73

I know the TR is 5.7 so as a result I think ‘SliceTiming’ should be this:

“SliceTiming”: [ 2.772973, 0.0, 2.927027, 0.154054, 3.081081, 0.308108, 3.235135, 0.462162, 3.389189, 0.616216, 3.543243, 0.77027, 3.697297, 0.924324, 3.851351, 1.078378, 4.005405, 1.232432, 4.159459, 1.386486, 4.313514, 1.540541, 4.467568, 1.694595, 4.621622, 1.848649, 4.775676, 2.002703, 4.92973, 2.156757, 5.083784, 2.310811, 5.237838, 2.464865, 5.391892, 2.618919, 5.545946, 2.772973, 0.0, 2.927027, 0.154054, 3.081081, 0.308108, 3.235135, 0.462162, 3.389189, 0.616216, 3.543243, 0.77027, 3.697297, 0.924324, 3.851351, 1.078378, 4.005405, 1.232432, 4.159459, 1.386486, 4.313514, 1.540541, 4.467568, 1.694595, 4.621622, 1.848649, 4.775676, 2.002703, 4.92973, 2.156757, 5.083784, 2.310811, 5.237838, 2.464865, 5.391892, 2.618919, 5.545946 ]

which is what I copied into the subject’s BIDS JSON file. But after running QSIPrep I got an error that eddy failed. This is from the crash report:

Warning: In a future release the first argument will have to be "diffusion" when using eddy on diffusion data, i.e.
eddy diffusion --imain='my_ima' --acqp='my_acqp' ...

Warning: Writing of individual text files will be discontinued in favour of a single .json file in future versions

EDDY::: Eddy failed

Stderr:

Traceback:
Traceback (most recent call last):
File “/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py”, line 457, in aggregate_outputs
setattr(outputs, key, val)
File “/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py”, line 325, in validate
value = super().validate(objekt, name, value, return_pathlike=True)
File “/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py”, line 135, in validate
self.error(objekt, name, str(value))
File “/opt/conda/envs/qsiprep/lib/python3.10/site-packages/traits/base_trait_handler.py”, line 74, in error
raise TraitError(
traits.trait_errors.TraitError: The ‘out_corrected’ trait of an ExtendedEddyOutputSpec instance must be a pathlike object or string representing an existing file, but a value of ‘{work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/eddy/eddy_corrected.nii.gz’ <class ‘str’> was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 404, in run
    outputs = self.aggregate_outputs(runtime)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 464, in aggregate_outputs
    raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory '{work_dir}/qsiprep_1_1_wf/sub_015138_ses_1_wf/dwi_preproc_ses_1_acq_AP_run_001_wf/hmc_sdc_wf/eddy/eddy_corrected.nii.gz' for output 'out_corrected' of a ExtendedEddy interface

This error is not very descriptive so I don’t understand what’s wrong. Did I calculate my ‘SliceTiming’ incorrectly? Or is the error due to something else?

Hi @scchung,

Was this run with a fresh working directory? And if you submitted your job with SLURM, can you confirm (e.g., with seff {JOBID}) that the job did not run out of memory?

Best,
Steven

@Steven I specified the same working directory but I see that merged_metadata.json was updated with the new ‘SliceTiming’ so I didn’t think it would be an issue. I also did not submit this on SLURM, I’m using my own computer’s GPU - which I haven’t had a problem processing other subjects with.

Can you test with a fresh working directory to be sure? And also, provide contents of

.../hmc_sdc_wf/eddy/command.txt
.../hmc_sdc_wf/eddy/stdout.nipype
.../hmc_sdc_wf/eddy/stderr.nipype
.../merge_dwis/merged_metadata.json

if they exist?