# Error with dwifslpreproc

**URL:** <https://community.mrtrix.org/t/error-with-dwifslpreproc/5085>\
**Category:** Uncategorized\
**Created:** [July 29, 2021, 11:10am UTC](https://community.mrtrix.org/t/error-with-dwifslpreproc/5085 "2021-07-29T11:10:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edrazich](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/e/13edae/32.png) [@edrazich](https://community.mrtrix.org/u/edrazich)\
**Post date:** [July 29, 2021, 11:10am UTC](https://community.mrtrix.org/t/error-with-dwifslpreproc/5085/1 "2021-07-29T11:10:52Z")

</div>

I’m in the process of trying to run FBA on GRE dwi sequences. Sought advice about this a while ago here ([Extracting PA and AP from dicom - #5 by edrazich](https://community.mrtrix.org/t/extracting-pa-and-ap-from-dicom/4617/5)) and was advised to try --field in eddy.

So far, I’ve successfully run and QCed the following:

```auto
mrcat -force ${path_DTI}/dwi*.nii.gz ${path_DTI}/merged_dwi.nii.gz
paste -d" " ${path_DTI}/bvec*.bvec >> ${path_DTI}/merged_bvec.bvec
paste -d" " ${path_DTI}/bval*.bval >> ${path_DTI}/merged_bval.bval
dwidenoise -force ${path_DTI}/merged_dwi.nii.gz ${path_mrtrix_preprocessed}/dwi_denoised.nii.gz -noise ${path_mrtrix_preprocessed}/noise.nii.gz
mrdegibbs -force ${path_mrtrix_preprocessed}/dwi_denoised.nii.gz ${path_mrtrix_preprocessed}/dwi_denoised_unringed.nii.gz -axes 0,1
Prepare fieldmaps for manual eddy input:
bet ${path_DTI}/fieldmap_e1_mag.nii.gz ${path_DTI}/fieldmap_e1_mag_bet.nii.gz
fsl_prepare_fieldmap SIEMENS ${path_DTI}/fieldmap_ph ${path_DTI}/fieldmap_e1_mag_bet ${path_DTI}/fieldmap.nii.gz 2.5
flirt -in ${path_DTI}/fieldmap.nii.gz -ref ${path_mrtrix_preprocessed}/dwi_denoised_unringed.nii.gz -dof 12 -omat ${path_DTI}/field2dwi_12dof_mat -out ${path_DTI}/field2dwi_12dof.nii.gz
flirt -in ${path_DTI}/fieldmap.nii.gz -ref ${path_mrtrix_preprocessed}/dwi_denoised_unringed.nii.gz -applyxfm -init ${path_DTI}/field2dwi_12dof_mat -o ${path_DTI}/field2dwi_12dof_applyxfm.nii.gz

```

However, when running:

```auto
dwifslpreproc -force -fslgrad ${path_DTI}/merged_bvec.bvec ${path_DTI}/merged_bval.bval ${path_mrtrix_preprocessed}/dwi_denoised_unringed.nii.gz ${path_mrtrix_preprocessed}/dwi_denoised_unringed_preproc.nii.gz -rpe_none -pe_dir AP -eddy_options " --field=${path_DTI}/field2dwi_12dof_applyxfm"

```

I do get some issues.

`eddy cuda` fails with the following error:

```auto
eddy_cuda9.1: error while loading shared libraries: libcublas.so.9.1: cannot open shared object file: No such file or directory

```

with `eddyopenmp`  
My first patient ran to completion, but the image was hugely distorted. None of my subsequent patients ran successfully, and this was the error:

```auto
Reading images
Performing volume-to-volume registration
Running Register
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Iter: 0, Total mss = 4177.44
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Iter: 1, Total mss = 4190.25
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Iter: 2, Total mss = 4189.59
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Iter: 3, Total mss = 4189.96
Loading prediction maker
Evaluating prediction maker model
Calculating parameter updates
Iter: 4, Total mss = 4196.02
Running sm.ApplyB0LocationReference
Running sm.PolateB0MovPar
Running Register
Loading prediction maker
Evaluating prediction maker model
EDDY::: NewSphericalKMatrix::GetHyperParGuess: Unable to find valid hyperparameters
EDDY::: KMatrix.cpp::: virtual std::vector<double> EDDY::NewSphericalKMatrix::GetHyperParGuess(const std::vector<armawrap::AWColVector<double> >&) const: Exception thrown
EDDY::: HyParEstimator.cpp::: virtual void EDDY::FullMontyHyParEstimator::Estimate(std::shared_ptr<const EDDY::KMatrix>, bool): Exception thrown
EDDY::: DiffusionGP.cpp::: virtual void EDDY::DiffusionGP::EvaluateModel(const NEWIMAGE::volume<float>&, float, bool): Exception thrown
EDDY::: eddy.cpp::: std::shared_ptr<EDDY::DWIPredictionMaker> EDDY::LoadPredictionMaker(const EDDY::EddyCommandLineOptions&, EDDY::ScanType, const EDDY::ECScanManager&, unsigned int, float, NEWIMAGE::volume<float>&, bool): Exception thrown
EDDY::: eddy.cpp::: EDDY::ReplacementManager* EDDY::Register(const EDDY::EddyCommandLineOptions&, EDDY::ScanType, unsigned int, const std::vector<float, std::allocator<float> >&, EDDY::SecondLevelECModel, bool, EDDY::ECScanManager&, EDDY::ReplacementManager*, NEWMAT::Matrix&, NEWMAT::Matrix&): Exception thrown
EDDY::: Eddy failed with message EDDY::: eddy.cpp::: EDDY::ReplacementManager* EDDY::DoVolumeToVolumeRegistration(const EDDY::EddyCommandLineOptions&, EDDY::ECScanManager&): Exception thrown

```

from this thread, looks like it might be because I haven’t supplied a mask:  
[https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?A2=FSL;574528e6.2006](https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?A2=FSL;574528e6.2006)

Would it be acceptable to transform my T1 mask into dwi space and use this as a mask? Or should I be making a mask directly from the dwi?

Any other ideas what might be going on and how to fix it? Thanks so much!

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [August 23, 2021, 7:58am UTC](https://community.mrtrix.org/t/error-with-dwifslpreproc/5085/2 "2021-08-23T07:58:18Z")

</div>

Hi @edrazich,

`dwifslpreproc` will already be internally calculating a mask for `eddy`. You can check the scratch directory to see if it’s any good, and try running `eddy` with a different mask if not.

Otherwise I have almost zero experience with gradient echo-based field maps. I don’t think I ever got around to starting implementing support of such in `dwifslpreproc` simply because I never have to deal with such data myself and so it never gets prioritised.

Given that you’re preceding with multiple FSL commands, I would suggest that `dwifslpreproc` is probably serving the converse of its intended convenience / simplification purpose; calling `eddy` directly would probably clarify the diagnosis process, particularly given that _MRtrix3_ is not responsible for either of the errors reported.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![edrazich](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/e/13edae/32.png) [@edrazich](https://community.mrtrix.org/u/edrazich)\
**Post date:** [August 25, 2021, 3:48pm UTC](https://community.mrtrix.org/t/error-with-dwifslpreproc/5085/3 "2021-08-25T15:48:44Z")

</div>

Thanks, Rob!

Turns out my lab’s preprocessing already included eddy, so I used their preprocessing pipeline, which does distortion, susceptibility, motion correction, and eddy. I then applied denoising and unringing as part of the MRTrix pipeline.

My masks had holes in the middle, so I employed FSL bet to create the masks (as discussed in a few threads on here). Everything looked as it should according to the most recent BATMAN tutorial.

However, my FODs look very strange and non-anatomical after running dwi2fod:  
 ![image](https://community.mrtrix.org/uploads/default/original/2X/3/336cb45c8687a2fe65e8c09c25f0fc4542fcc190.png)

I’ve followed the documentation and QCed at every stage up to here, so I’m not sure what I’m missing.  
I’m wondering what might have gone wrong and how to fix it.

Any advice would be most welcome!

Thanks!  
Best wishes,  
Erin

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 20, 2021, 7:35am UTC](https://community.mrtrix.org/t/error-with-dwifslpreproc/5085/4 "2021-10-20T07:35:37Z")

</div>

> Turns out my lab’s preprocessing already included eddy, so I used their preprocessing pipeline, which does distortion, susceptibility, motion correction, and eddy. I then applied denoising and unringing as part of the MRTrix pipeline.

🙅‍♂️

Both the denoising and Gibbs ringing removal operations are invalid subsequent to an image interpolation operation, so these can’t be run _after_ `eddy`.

> However, my FODs look very strange and non-anatomical after running dwi2fod:

Unfortunately the image is too low-resolution for me to assess.

Regards  
Rob
