# Dwi2response error/iter0\_fixel/peaks.mif

**URL:** https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010
**Category:** Uncategorized
**Created:** [August 20, 2020, 4:59pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010 "2020-08-20T16:59:17Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Pradeepa\_Ruwan](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pradeepa_ruwan/32/2174_2.png) [@Pradeepa\_Ruwan](https://community.mrtrix.org/u/Pradeepa_Ruwan)
#### Post date: [August 20, 2020, 4:59pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/1 "2020-08-20T16:59:17Z")

</div>

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.

```nohighlight
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

---

<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, 2020, 2:35pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/2 "2020-08-23T14:35:26Z")

</div>

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](https://github.com/MRtrix3/mrtrix3/actions/runs/218531488) 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

---

<div class="post-metadata">

### Author: ![Pradeepa\_Ruwan](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pradeepa_ruwan/32/2174_2.png) [@Pradeepa\_Ruwan](https://community.mrtrix.org/u/Pradeepa_Ruwan)
#### Post date: [August 24, 2020, 7:28pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/3 "2020-08-24T19:28:04Z")

</div>

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;

```nohighlight
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

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [September 1, 2020, 3:49pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/4 "2020-09-01T15:49:35Z")

</div>

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:

```auto
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.:

```auto
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`.

---

<div class="post-metadata">

### Author: ![Pradeepa\_Ruwan](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pradeepa_ruwan/32/2174_2.png) [@Pradeepa\_Ruwan](https://community.mrtrix.org/u/Pradeepa_Ruwan)
#### Post date: [September 13, 2020, 7:35pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/5 "2020-09-13T19:35:06Z")

</div>

Hi Dr.Tournier,

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

```nohighlight
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

---

<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: [September 15, 2020, 2:48am UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/6 "2020-09-15T02:48:45Z")

</div>

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

---

<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: [September 15, 2020, 12:50pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/7 "2020-09-15T12:50:01Z")

</div>

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:

```auto
  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](https://github.com/MRtrix3/mrtrix3/issues/2172) 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

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [September 15, 2020, 1:29pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/8 "2020-09-15T13:29:38Z")

</div>

✌🏻 💪

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…

---

<div class="post-metadata">

### Author: ![Pradeepa\_Ruwan](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pradeepa_ruwan/32/2174_2.png) [@Pradeepa\_Ruwan](https://community.mrtrix.org/u/Pradeepa_Ruwan)
#### Post date: [September 15, 2020, 1:30pm UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/9 "2020-09-15T13:30:34Z")

</div>

Hi Dr.Smith and Dr.Tournier,

I am so sorry that I did not notice that I have missed the last line. 🙄 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

---

<div class="post-metadata">

### Author: ![math\_priyanka](https://community.mrtrix.org/user_avatar/community.mrtrix.org/math_priyanka/32/4998_2.png) [@math\_priyanka](https://community.mrtrix.org/u/math_priyanka)
#### Post date: [August 31, 2024, 5:03am UTC](https://community.mrtrix.org/t/dwi2response-error-iter0-fixel-peaks-mif/4010/10 "2024-08-31T05:03:02Z")

</div>

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.
