Error using dwifslpreproc - no valid diffusion gradient table found

When running the following line of code I receive an error message.

Dwifslpreproc XXX_dn_unr.mif XXX_dn_unr_pp.mif -pe_dir LR -rpe_pair -se_epi b0_pair_XXX.mif -eddy_options " --slm=linear"

The error message is below.

dwi2mask: [ERROR] no valid diffusion gradient table found
dwi2mask: [ERROR] error importing diffusion gradient table for image “dwi_pad2_pe_0_applytopup.mif”
maskfilter: [INFO] opening image “-”…
maskfilter: [ERROR] no filename supplied to standard input (broken pipe?)
maskfilter: [ERROR] error opening image “-”
mrconvert: [INFO] opening image “-”…
mrconvert: [ERROR] no filename supplied to standard input (broken pipe?)
mrconvert: [ERROR] error opening image “-”
Dwifslpreproc:
Dwifslpreproc: [ERROR] For debugging, inspect contents of scratch directory: /Users/jasonreich/Desktop/MS_Data/XXX/Dwifslpreproc-tmp-DG17GW/

Does anyone know what is causing this and how I might fix it?

Hi,

You are missing the bvecs and bvals file after the -fslgrad flag.

Best regards,

Manuel

Hi Manuel,

My apologies, the -fslgrad flag should not be there - I am getting the error without it. It seems the issue comes from b0_pair_XXX.mif not having a dw_scheme. This b0 image was created with dwiextract.

I have edited the question to fix this.

Regards,
Jason

Hi Jason,

Could your issue have anything to do with the problem discussed in this thread? Do you have an odd number of slices…?

All the best,
Donald

Hi Donald,

That appears to be my issue. I have made the changes discussed in that thread and am now receiving a new error message:

Dwifslpreproc: [ERROR] Unhandled Python exception:

Dwifslpreproc: [ERROR] UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u201c’ in position 3419: ordinal not in range(128)

Dwifslpreproc: [ERROR] Traceback:

Dwifslpreproc: [ERROR] /usr/local/bin/Dwifslpreproc:941 (in execute())

Dwifslpreproc: [ERROR] eddy_output_file.write(str(exception_openmp).encode(‘utf-8’, errors=‘replace’))

Regards,
Jason

Update: I have switched to using python3 and am now getting the error:

Dwifslpreproc: [ERROR] eddy --imain=eddy_in.nii --mask=eddy_mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --topup=field “-–slm=linear” --out=dwi_post_eddy --verbose* (app.py:196)

OK, I guess that’s kind of a result… It looks like there’s an issue running eddy, as the first error occurs when trying to format the error message produced by failing to run the OpenMP version of eddy (which is the fallback if the CUDA version fails). For some reason, trying to run the non-CUDA version produces an error message with non-ASCII characters, which that version of Python can’t convert to UTF-8. Seems OK with Python 3, though I don’t see any error message in your post – just the command invocation that failed. Any chance you could provide the full output of that failed command? And possibly any relevant information in the log files that you’ll find in the temporary folder the command would have created?

Hi Donald,

Thank you very much for your help! It seems that there was an issue with my XQuartz installation. Upon reinstalling it, everything seems to be running smoothly with the DW encoding information stripped as suggested in the other thread.

Regards,
Jason

1 Like

Hello,
I am getting same kind of error.>

dwi2response: [ERROR] Script requires diffusion gradient table: either in image header, or using -grad / -fslgrad option
All gradient files are there.