Dwipreproc - eddy ERROR

Thanks for your help on this. My data is definitely multishell. I did inspect my bvalues which are consistent for each shell - 0, 700, 2000. Curiously if I use the data is shelled option using the command;

dwipreproc DWI_dn.mif DWI_eddy_bval.mif -rpe_none -pe_dir AP -fslgrad bvecs bvals -eddy_options "--data_is_shelled " 

I now get the following error below. Any ideas to the cause of this? Thanks again for all your help.

Traceback (most recent call last):
  File "/midas-data/software/mrtrix3_25.5.17/bin/dwipreproc", line 506, in <module>
    run.command('mrconvert dwi_post_eddy' + fsl_suffix + ' result.mif' + stride_option + ' -fslgrad ' + bvecs_path + ' bvals')
  File "/midas-data/software/mrtrix3_25.5.17/lib/mrtrix3/run.py", line 61, in command
    shebang = _shebang(line[0])
  File "/midas-data/software/mrtrix3_25.5.17/lib/mrtrix3/run.py", line 329, in _shebang
    path = find_executable(exeName(item))
  File "/usr/lib64/python2.6/distutils/spawn.py", line 191, in find_executable
    if not os.path.isfile(executable):
  File "/usr/lib64/python2.6/genericpath.py", line 29, in isfile
    st = os.stat(path)
TypeError: stat() argument 1 must be encoded string without NULL bytes, not str
[trackhd@pc8-024 060443961]$ dwipreproc DWI_dn.mif DWI_eddy_bval.mif -rpe_none -pe_dir AP -fslgrad bvecs bvals -eddy_options "--data_is_shelled "

I think you have to add one whitespace character after your double quotes, i.e.
" –data_is_shelled "

Given this output:

It seems to me more likely that the problem might be due to using python version 2.6. As stated in the docs, we require at least version 2.7, at least for the configure & build steps… Worth trying with version 2.7 or 3.X, it might be as simple as that.

Hello all,

I am having a similar issue with the ones mentioned above. When running " dwipreproc data_denoise.mif/ dwi_preprocessed.mif -rpe_none -pe_dir j- " I get the following error:

[ERROR] Command failed: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy (dwipreproc:518)
dwipreproc: Output of failed command:
eddy: msg=AcqPara::AcqPara: Unrealistic read-out time
terminate called after throwing an instance of 'EDDY::EddyException'
  what():  eddy: msg=AcqPara::AcqPara: Unrealistic read-out time
dwipreproc: Changing back to original directory (/home/suminiky/Downloads/MRTRIX)
dwipreproc: Script failed while executing the command: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy
dwipreproc: For debugging, inspect contents of temporary directory: /home/suminiky/Downloads/MRTRIX/dwipreproc-tmp-Y06916/

Afterwards, when running eddy in the temp folder I get this:

eddy: msg=AcqPara::AcqPara: Unrealistic read-out time
terminate called after throwing an instance of 'EDDY::EddyException'
  what():  eddy: msg=AcqPara::AcqPara: Unrealistic read-out time
Aborted (core dumped)

Any ideas on what the issue could be?

Best,
Sabina

Hi Sabina,

This is in fact an unrelated error, which has been reported here. This is not an error within dwipreproc, but something that is generated within eddy that dwipreproc is simply passing along. It claims that the EPI total readout time of your data is not “realistic”, and hence there must have been some kind of error made during your data preparation.

Due to the relationship between readout time, field inhomogeneity estimation, and geometric correction of EPI distortions, you should simply be able to e.g. halve the readout times in all of your images, and processing should operate as expected. The mrconvert -set_property option should be useful for this, in addition to this development-branch documentation page (not yet part of the main documentation, but will be soon).

Rob

Hi Rob,

The answer you gave me worked last time, so thank you! However, now I need to analyze a new set of data and I am yet again receiving an error, but a different one:

dwipreproc: [ERROR] Command failed: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy (dwipreproc:518)
dwipreproc: Output of failed command:
I’m thrown
terminate called after throwing an instance of ‘EDDY::KMatrixException’
what():
dwipreproc: Changing back to original directory (/home/suminiky/Documents/DATA/Menzel_preop)
dwipreproc: Script failed while executing the command: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy

What could be wrong this time?

Best,
Sabina

Hello all,

I am having a similar issue with the ones mentioned above. When running “dwipreproc dwi_denoised.mif dwi_processed.mif -pe_dir AP -rpe_all -readout_time 0.124” I get the following error:

Command: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --topup=field --out=dwi_post_eddy
dwipreproc:
dwipreproc: [ERROR] Command failed: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --topup=field --out=dwi_post_eddy (dwipreproc:518)
dwipreproc: Output of failed command:
dwipreproc: Changing back to original directory (/home/wpy/Desktop/FBA/p01)
dwipreproc: Script failed while executing the command: eddy_openmp --imain=dwi.nii --mask=mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --topup=field --out=dwi_post_eddy
dwipreproc: For debugging, inspect contents of temporary directory: /home/wpy/Desktop/FBA/p01/dwipreproc-tmp-L9W43S/

Do you have any ideas of what could be wrong?

Regards,
Pinyi Wang

I’m thrown
terminate called after throwing an instance of ‘EDDY::KMatrixException’
what():

This error is entirely internal to eddy; MRtrix3’s dwipreproc script is simply passing this error message from the underlying command to the user. So I can really only suggest going into the temporary directory that was preserved by the script, and attempting to invoke eddy directly. You can also manually inspect all of the files that are being provided as input to eddy, and ensure that they are sensible according to the usage of that command. If that seems to be the case, then your question should instead be posed on the FSL mailing list, as it is independent of MRtrix3.

Note: If you say to FSL that you’ve encountered this issue when trying to run an MRtrix3 script, they won’t help you. You must validate yourself that the issue is indeed with eddy, and not with MRtrix3’s wrapping thereof, and then report it as such. Alternatively, if your investigation shows that dwipreproc is providing inappropriate data to eddy, then this is precisely the information that needs to be provided here in order for the issue to be fixed within MRtrix3.

dwipreproc: Output of failed command:
dwipreproc: Changing back to original directory (/home/wpy/Desktop/FBA/p01)

In your case @PinyiWang, eddy appears to not be providing any error message to the terminal whatsoever. Nevertheless, even in this case, the same instructions as given above to @Sabina_R apply to your case also.

1 Like

Thanks for your response!
I will try it!

Best,
Pinyi

Hello all,

I am back with yet another error (in the meantime I have changed computers and am now working on a MacOS High Sierra). What I get now is a little bit different:

dwipreproc: [ERROR] Command failed: eddy --imain=eddy_in.nii --mask=eddy_mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy (dwipreproc:853)
dwipreproc: Output of failed command:
dwipreproc: 
dwipreproc: Changing back to original directory (/Data/p01)
dwipreproc: Script failed while executing the command: eddy --imain=eddy_in.nii --mask=eddy_mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy
dwipreproc: For debugging, inspect contents of temporary directory: /Data/p01/dwipreproc-tmp-XX4IFY/

And when running eddy directly from the temporary folder, the result is:

eddy --imain=eddy_in.nii --mask=eddy_mask.nii --acqp=eddy_config.txt --index=eddy_indices.txt --bvecs=bvecs --bvals=bvals --out=dwi_post_eddy -v
Reading images
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Segmentation fault: 11

I know this might just be totally due to eddy, however I have yet to receive a clear answer from the FSL mailing list regarding my data.

Would it maybe be possible to send you a sample of my images for you to check out and maybe get to the bottom of this?
I manually inspected the files that go into eddy and they seem to be sensible, but I am still a novice and would not say that that is 100% the case. What exactly should I be looking for?

Thank you again and sorry for being so persistent :blush:

Best,
Sabina

Hi Sabina,

Given you are able to trigger the fault by executing eddy directly yourself, unless you can find something egregiously wrong with the data that dwipreproc is generating as the input to eddy, the segmentation fault is fundamentally occurring inside of eddy and is hence out of our control.

It would be worth trying to go from your raw image data to the eddy step without invoking any MRtrix3 commands or scripts at all; i.e. running topup manually, generating a processing mask & all other associated files for eddy. Only then can you genuinely prove that you’re encountering an issue with eddy and not that MRtrix3 is somehow providing it with bad data. I would suggest that if you so much as mention in passing that you’ve used any MRtrix3 commands at all in generating the input to eddy when posting to their mailing list, the FMRIB team will be hesitant to commit time to diagnosing your issue; just as I myself am hesitant to put my own time into sorting out people’s eddy issues unless it’s provably a fault of dwipreproc.

Rob

Hi Rob,

Thank you for taking the time to answer. I eventually analyzed the data once again and got an identical error as the one here http://community.mrtrix.org/t/siemens-vs-philips-dwipreproc-eddy-error/1301/3 and it turned out that I also had poorly distributed directions, which is probably why eddy did not want to take it…I have since started using newer data with different acquisition parameters and I could run dwipreproc on it with no problems so far, luckily.

Best,
Sabina

Hi, check if dwi.nii has negative, NaN or extreme values (huge values that don’t make sense). Do fslstats dwi.nii -R. If that is the case, threshold and remove NaN values. It produces errors when fsl does internal operations because it tries to divide by an infinite number or convert negative numbers when not allowed: fslmaths dwi.nii -nan -thr 0 -uthr 99999 dwi.nii
Those weird values are created sometimes during pre processing steps like denoise or things like that.

Hi Sabina,

I met the same error “AcqPara::AcqPara: Unrealistic read-out time” when I used eddy package, and the total read-out time is almost 2s. Although I know what the issue is, I have no idea how to solve the issue by halving the read-out time.

Could you kindly give me some suggestions to scale the read-out time, or how you solve the issue? Thank you in advance.

Best,
Charlene

Hi Charlene,

Was this using eddy directly, or via the dwifslpreproc script? If the former, the 4th column of the acqp.txt file that you provide to topup and eddy states the total readout time. You can modify that manually. However, it might be worth then double-checking where you got that 2s value from in the first place.

If the latter however, it would depend on how you invoked the dwifslpreproc script. Can you post the full command here so we can double-check what’s going on?

Hi jdtournier,

Many thanks for your reply! I used eddy directly, and I am new to the DTI analysis. I got the total readout time from MRIcron, so I am not sure whether I can change the total readout time manually. Or if I modify the readout time, what else parameters do I also need to change?

Here is the eddy command that I used:
eddy --imain=sub-01_acq-multiband_dwi --mask=sub-01_hifi_nodif_brain --index=index.txt --acqp=acqparams_L1_adults.txt --bvecs=sub-01_acq-multiband_dwi.bvec --bvals=sub-01_acq-multiband_dwi.bval --fwhm=0 --topup=sub-01_topup_AP_PA_b0 --flm=quadratic --out=sub-01_eddy_unwarped_images --data_is_shelled --repol=sub-01_report_QC --cnr_maps=sub-01_maps_QC

Here is the error that fsl reported:
EDDY::: AcqPara::AcqPara: Unrealistic read-out time
EDDY::: EddyHelperClasses.cpp::: EDDY::AcqPara::AcqPara(const ColumnVector&, double): Exception thrown
EDDY::: Eddy failed with message EDDY::: ECScanClasses.cpp::: EDDY::ECScanManager::ECScanManager(const string&, const string&, const string&, const string&, const string&, const string&, const string&, const string&, EDDY::ECModel, EDDY::ECModel, const std::vector&, const EDDY::PolationPara&, EDDY::MultiBandGroups, bool): Exception thrown

Thank you again!

Best,
Charlene

The acqparams_L1_adults.txt file is where this information is provided to eddy. I recommend you look through the relevant FSL wiki page for details – I’m not sure there’s a lot more we can do from our side given this is an FSL issue!

Hi jdtournier,

Thanks for your kind suggestion! I will look through the wiki page.

Best,
Charlene