Error with dwifslpreproc

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) and was advised to try --field in eddy.

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

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:

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:

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:

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

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!

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

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

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