Dwi2response error/iter0_fixel/peaks.mif

Hi,

Recently I have updated mrtrix and now dwi2response is not working properly. With the same data, it was working in the previous version. I found similar threads on the forum. But I could not understand how to fix the issue. I appreciate if someone can explain a solution simply.
Thank you.

This is the error I get.

dwi2response tournier dwi.mif response.txt
dwi2response: 
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response: 
dwi2response: Generated scratch directory: /home/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-U0GB42/
dwi2response: Importing DWI data (/home/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi.mif) and selecting b-values...
dwi2response: Changing to scratch directory (/home/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-U0GB42/)
dwi2response: Computing brain mask (dwi2mask)...
dwi2response: [.   ] Optimising... 
dwi2response: [ERROR] fixel2voxel iter0_fixel/peaks.mif none iter0_amps.mif -number 2 (tournier.py:91)
dwi2response: [ERROR] Information from failed command:
dwi2response:
              fixel2voxel: [ERROR] failed to open key/value file "iter0_fixel/peaks.mif": No such file or directory
              fixel2voxel: [ERROR] error opening image "iter0_fixel/peaks.mif"
dwi2response:

Any suggestions.

cheers
Ram

Hi Ram,

Do you happen to be running on a Windows machine? The first thing that jumps out at me looking at the relevant code is that it’s slightly clumsy with respect to filesystem directory navigation, which can sometimes lead to code that works on Unix but not Windows. Having said that I did just run tests where this command worked for version 3.0.1 on all three OS’s…

The only other thing would be that if you are installing from source, make sure that you have not only downloaded updates to the code, but also re-compiled the MRtrix3 binaries. dwi2response may be a Python script, but it invokes many MRtrix3 binary commands, and there was a specific change involving the fod2fixel command interface (which is invoked by dwi2response tournier just prior to fixel2voxel) that could potentially lead to unexpected behaviour if there’s a mismatch between the Python code and the compiled binaries.

Otherwise, I would need you to re-run the command with the -info flag, and also show the contents of the script’s scratch directory.

Cheers
Rob

Hi,

Thank you for the response.

I am running Mrtrix on Linux (virtual toolbox). I have checked the dwi2response with different data set which have been acquired on a Hitachi scanner. It is working properly. This problem happens only with Philips data. I am wondering whether it is related to image header. Because I am sure It was working properly with the same data too in the previous version. I just had to update suddenly because fixelcfestats had higher memory consumption in the early version. Anyway now I have reinstalled Mrtrix3 again… considering that update went wrong.

This is what I got with -info flag;

senobold@senobold-VirtualBox:~/connectome/TBI/connectomes/FBA/study/subjects/001_control$ dwi2response tournier dwi.mif response.txt -info
dwi2response: 
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response: 
dwi2response: Loading header for image file '/home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi.mif'
dwi2response: Generated scratch directory: /home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-7C4TK5/
dwi2response: Importing DWI data (/home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi.mif) and selecting b-values...
Command:  mrconvert /home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi.mif - -strides 0,0,0,1 | dwiextract - /home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-7C4TK5/dwi.mif -singleshell -no_bzero
          mrconvert: [  0%] copying from "/home/seno...ubjects/001_control/dwi.m          mrconvert: [100%] copying from "/home/seno...ubjects/001_control/dwi.mif" to "/home/seno...C4TK5/mrtrix-tmp-z7NUQc.mif"
          dwiextract: [100%] extracting volumes
          dwi2response: Changing to scratch directory (/home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-7C4TK5/)
dwi2response: Computing brain mask (dwi2mask)...
Command:  dwi2mask dwi.mif mask.mif
          dwi2mask: [done] computing dwi brain mask
          dwi2mask: [done] applying mask cleaning filter
dwi2response: Command: '/home/senobold/git/mrtrix3/bin/mrstats mask.mif -output mean -output median -output std -output std_rv -output min -output max -output count -mask mask.mif' (piping data to local storage)
dwi2response: Result: ImageStatistics(mean=1.0, median=1.0, std=0.0, std_rv=0.0, min=1.0, max=1.0, count=159691)
dwi2response: [.   ] Optimising... 
Command:  dwi2fod csd dwi.mif init_RF.txt iter0_FOD.mif -mask mask.mif
Command:  fod2fixel iter0_FOD.mif iter0_fixel -peak peaks.mif -mask mask.mif -fmls_no_thresholds
Command:  fixel2voxel iter0_fixel/peaks.mif none iter0_amps.mif -number 2

dwi2response: [ERROR] fixel2voxel iter0_fixel/peaks.mif none iter0_amps.mif -number 2 (tournier.py:91)
dwi2response: [ERROR] Information from failed command:
dwi2response:
              fixel2voxel: [ERROR] failed to open key/value file "iter0_fixel/peaks.mif": No such file or directory
              fixel2voxel: [ERROR] error opening image "iter0_fixel/peaks.mif"
dwi2response:
dwi2response: [ERROR] For debugging, inspect contents of scratch directory: /home/senobold/connectome/TBI/connectomes/FBA/study/subjects/001_control/dwi2response-tmp-7C4TK5/
senobold@senobold-VirtualBox:~/connectome/TBI/connectomes/FBA/study/subjects/001_control$ mes/FBA/study/subjects/001_control/dwi2response-tmp-7C4TK5/

Thank you for checking this out.
Hope you can suggest things to fix the issue.

Cheers
Ram

Hi Ram,

I’m not sure what’s going on here, but it seems clear there’s something unusual about the data you’re providing. One possibility might be that your input DWI data includes one of those synthetic isotropic-weighted images that Philips tend to include as the last image in the series (not sure what it’s for). One way to check is to run:

mrinfo -dwgrad dwi.mif

and post the output here. If that’s the issue, I’m expecting to see an entry of the form “0 0 0 1000” (where that last b-value is the actual b-value you used) somewhere in the gradient table (i.e. non-zero b-value with a zero direction vector). In which case you could try removing that volume from your DWI image, using a command like e.g.:

mrconvert dwi.mif -coord 3 0:58 dwi_clean.mif`

where that last number 59 is the index of the last volume you want included (indexed from zero). In the example above, that would remove the last volume assuming you have 60 volumes in the original dwi.mif.

1 Like

Hi Dr.Tournier,

Thank you very much for the response. Could you please see the output of mrinfo.

senobold@senobold-VirtualBox:~/connectome/TBI/connectomes/FBA/study/subjects/001_control$ mrinfo -dwgrad dwi.mif
                  0                   0                   0                   0
                  1                   0                   0                 800
                  0                   1                   0                 800
                  0                   0                   1                 800
-0.0424002704396654  -0.114600737099096  -0.992506366792167                 800
  0.174909307398087  -0.200510671597807  -0.963951349789458                 800
  0.232290354908381  -0.162593245705867  -0.958960180334601                 800
  0.367519554894252  0.0261013886595918   -0.92964944698546                 800
   0.19019152560378   0.374383306507441  -0.907559542618038                 800
 -0.116799193696968   0.833394238278363  -0.540196253185975                 800
 -0.200489056495323   0.252686212694105  -0.946548369677918                 800
 -0.495782179315697   0.134495165604258  -0.857969160927164                 800
-0.0141000539293986  -0.628102368573208  -0.778002958266814                 800
 -0.744490044336692  -0.147698025407279  -0.651091289432089                 800
 -0.760877387925311   0.320390469410658  -0.564283215818771                 800
 -0.180892128994776   0.924659825673299  -0.335085428590324                 800
 -0.679627873398281  -0.422417321898931  -0.599724569998483                 800
  0.777100110134885    0.47070004632113  -0.417800054118756                 800
  0.924162156874187  -0.103595760897106   -0.36768495498973                 800
  0.468485027318637  -0.767375520230528  -0.437786009517416                 800
  0.881688430862295  -0.189297521191905  -0.432194353681517                 800
  0.690404070082018   0.706204162381606  -0.156900927495913                 800
   0.23909602859462   0.757087428982963  -0.607989896286318                 800
 -0.057799750778337   0.983695758471697     0.1702992764951                 800
 -0.536773269698481   0.836058306197634  -0.113494341599679                 800
 -0.991787592746816  -0.120698490505697 -0.0422994711919967                 800
  -0.99676338951281  0.0708973962309112 -0.0378986086104871                 800
 -0.872424716111012   0.478113554706035   -0.10140287730128                 800
  -0.24871373059735   0.933551556690053    0.25811425999725                 800
  0.118295328002701   0.991860867522643 -0.0470981406210752                 800
  0.337598100797471   0.841495268493697   0.421797623796841                 800
   0.52858506018766    0.84087627338037   0.116296719697285                 800
   0.99685264071227   0.054997385630677 -0.0570972878407028                 800

Thank you very much.

Ram

Hi Ram,

I don’t see evidence there that support’s @jdtournier’s hypothesis of what may have been causing the problem.; so a closer inspection is likely required. Would you be able to provide us with access to an example dataset?

Thanks
Rob

Hi Ram,

Thanks for sending me some data. It seems that in your copy & pasting of the output of mrinfo -dwgrad, you accidentally left out the most important part. The last five lines of the output actually read:

  0.118295328002701   0.991860867522643 -0.0470981406210752                 800
  0.337598100797471   0.841495268493697   0.421797623796841                 800
   0.52858506018766    0.84087627338037   0.116296719697285                 800
   0.99685264071227   0.054997385630677 -0.0570972878407028                 800
                  0                   0                   0                 800

That final line, with a null vector direction and non-zero b-value, is precisely the trace-weighted image that @jdtournier was referring to. By scraping that final volume from the data using mrconvert -coord 3 0:32 prior to running dwi2response, the script completes without issue.

I have added an issue to GitHub to modify the software, as ideally such data would not lead to such an obscure error but would do something a bit more sensible.

Cheers
Rob

:v:t2: :muscle:

I’m pretty sure the issue is now dealt with at DICOM import. I’m assuming these data were converted using a previous version of MRtrix, or a different package altogether? If not, then we definitely need to find a clean solution for this…

Hi Dr.Smith and Dr.Tournier,

I am so sorry that I did not notice that I have missed the last line. :roll_eyes: It was very strange even to me.

Thank you for taking a prompt action. dwi2response works well after removing the final volume.

Appreciate your kind supports.

Many thanks,
Ram

dwi2response dhollander sub_unbiased.mif wm.txt gm.txt csf.txt -mask mask_on_b0.nii.gz -voxels voxels.mif -force
dwi2response:
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response:

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

pc@pc-1-0:~test_subject$ mrinfo -dwgrad dwi.nii
mrinfo: [ERROR] no valid diffusion gradient table found
mrinfo: [ERROR] error importing diffusion gradient table for image “dwi.nii”

But I ran the same code earlier, and it worked. Now it’s showing 'NO gradient table.