# Error from dwi2response

**URL:** <https://community.mrtrix.org/t/error-from-dwi2response/2818>\
**Category:** Uncategorized\
**Created:** [September 15, 2019, 8:02am UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818 "2019-09-15T08:02:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaobird](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@xiaobird](https://community.mrtrix.org/u/xiaobird)\
**Post date:** [September 15, 2019, 8:02am UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/1 "2019-09-15T08:02:58Z")

</div>

Hi,

I have got a multi-shell data (b=10,1000,2000) to process with MRtrix, and I am using the dhollander method to obtain the response functions. However, for some subjects, the processing are perfect, but for some I got an error while the correct shells were detected by the software. I am wondering if anyone has encountered this before?

The error follows:  
command: dwiextract dwi.mif -shell 10 - | mrmath - mean mean\_b10.mif -axis 3  
dwi2response: [ERROR] Cammand failed: dwiextract dwi.mif -shell 10 - | mrmath - mean mean\_b10.mif -axis 3 (dhollander.py:78)  
dwi2response: Output of failed command:  
dwiextract: [ERROR] User selected b=0 shell, but no such data was found

---

<div class="post-metadata">

**Author:** ![ThijsDhollander](https://community.mrtrix.org/user_avatar/community.mrtrix.org/thijsdhollander/32/1617_2.png) [@ThijsDhollander](https://community.mrtrix.org/u/ThijsDhollander)\
**Post date:** [September 17, 2019, 8:53am UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/2 "2019-09-17T08:53:10Z")

</div>

Hi @xiaobird,

I haven’t encountered this exactly with `dwi2response` yet, but it does remind me of another similar recent experience in a somewhat related scenario. For the purpose of allowing you to quickly continue your analysis, I’d suggest averaging the response functions (for each tissue type) of the subjects where you didn’t run into this error. That should generally be completely fine.

In the mean time, trying to get some insight into the problem to make sure I get the right idea:

What do you get when you set the [`BZeroThreshold` configuration option in a configuration file](https://mrtrix.readthedocs.io/en/dev/reference/config_file_options.html#cmdoption-arg-bzerothreshold) to a value of `15`? You can store it in a system wide location or create a user specific one, [as detailed here](https://mrtrix.readthedocs.io/en/dev/getting_started/config.html#location).  
What do you get if you set the `BZeroThreshold` configuration option to a value of `2`?

If all the above still fails, please send me a private message; we might arrange a data transfer that’ll allow me to diagnose the situation in more detail. It might take a while though, as I’m pretty occupied with a few other things at the moment; so do go through the above steps first to see if they resolve issues.

Cheers,  
Thijs

EDIT: removed a suggestion that wasn’t necessary to diagnose the problem

---

<div class="post-metadata">

**Author:** ![xiaobird](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@xiaobird](https://community.mrtrix.org/u/xiaobird)\
**Post date:** [September 18, 2019, 3:56pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/3 "2019-09-18T15:56:20Z")

</div>

Thank you so much for the reply.  
From the online document, it seems like the BZeroThreshold is set to 10, which is the lowest b value we have.

This is for the 7T data, and there are some operation that requires some image transformation and bvec reorientation for dealing with 7T distortion issues. I think this is why for some cases they are fine and some have trouble passing the threshold.

However, for my installation on both my mac and ubuntu, I have a hard time locating the file mrtrix.conf as specified in the online document (even with Spotlight search on the mac). Would you have any idea where they are installed?

---

<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 18, 2019, 6:37pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/4 "2019-09-18T18:37:04Z")

</div>

> [@xiaobird](#):
>
> From the online document, it seems like the BZeroThreshold is set to 10, which is the lowest b value we have.

That makes sense. And editing your `BZeroThreshold` config file variable is probably the simplest solution here. Alternative would be to modify your bvals manually to ensure those _b_=0 volumes are genuinely recorded as _b_=0…

> [@xiaobird](#):
>
> However, for my installation on both my mac and ubuntu, I have a hard time locating the file mrtrix.conf as specified in the online document (even with Spotlight search on the mac). Would you have any idea where they are installed?

This file doesn’t exist by default. You’ll need to create it yourself and edit it as required. I think on macOS the command `open -e ~/.mrtrix.conf` should do it.

---

<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 18, 2019, 6:44pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/5 "2019-09-18T18:44:13Z")

</div>

> [@ThijsDhollander](#):
>
> Do you get the same problem when using the new 2019 algorithm implementation in MRtrix3Tissue? You can install the latter via the instructions at [https://3Tissue.github.io](https://3Tissue.github.io) .

I’m not sure I agree that it’s a good idea to instruct users to install an independent fork of _MRtrix3_’s development branch, to diagnose a problem on our main release branch. Besides, the code you’re referring to is already available on our repository and accessible with a simple `git checkout dev`.

Users should note that the 3Tissue repo essentially provides the entire contents of our development (`dev`) branch – which we ourselves haven’t released yet – with the addition of the `ss3t_csd_beta` script to perform single-shell 3-tissue CSD. We don’t consider that version of the _MRtrix3_ code as suitable for deployment yet. Furthermore, issues with the 3Tissue repo should really be addressed to the [appropriate forum](https://github.com/3Tissue/MRtrix3Tissue/issues/new/choose), according to the [3Tissue documentation](https://3tissue.github.io/feedback-support.html) itself – not the main _MRtrix3_ forum. It is an independent project, not officially affiliated to the _MRtrix3_ project, or endorsed by its development team.

---

<div class="post-metadata">

**Author:** ![ThijsDhollander](https://community.mrtrix.org/user_avatar/community.mrtrix.org/thijsdhollander/32/1617_2.png) [@ThijsDhollander](https://community.mrtrix.org/u/ThijsDhollander)\
**Post date:** [September 18, 2019, 11:27pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/6 "2019-09-18T23:27:10Z")

</div>

With the best intentions, I think there’s a misunderstanding about the issue I’m trying to address actually.

In any case, @xiaobird , I’ve looked a bit further into the details of what’s exactly going on; I can get by now with these tests:

> [@ThijsDhollander](#):
>
> - Using the latter, and assuming you still had the problem (confirm first though), what do you get when you set the [`BZeroThreshold` configuration option in a configuration file](https://mrtrix.readthedocs.io/en/dev/reference/config_file_options.html#cmdoption-arg-bzerothreshold) to a value of `15` ? You can store it in a system wide location or create a user specific one, [as detailed here](https://mrtrix.readthedocs.io/en/dev/getting_started/config.html#location).
> - Final test, still using the latter (of step 2.), what do you get if you set the `BZeroThreshold` configuration option to a value of `2` ?

…also now when run with your version. So that’s fine, if it avoids unnecessary frictions.

To clarify the tests: so with the original threshold default (10), you reported some issues happening with some, but not all datasets. What I’d like to see tested is, whether setting the threshold (via the config file, as above) to either 2, or 15; _and then test all datasets for each of both values_. I’d be curious to see which of those values (2 or 15) makes it work _across the board for all datasets_; if any of those even does of course.

> [@xiaobird](#):
>
> This is for the 7T data, and there are some operation that requires some image transformation and bvec reorientation for dealing with 7T distortion issues. I think this is why for some cases they are fine and some have trouble passing the threshold.

That explains why you get different behaviour for different datasets at the moment, with the threshold set at 10 “exactly”. The actual issue though is the error: it should work regardless of threshold. Getting your result from testing with 2 and 15 as config file values will help to diagnose.

@xiaobird, thanks again for reporting; it’s very useful. 👍

---

<div class="post-metadata">

**Author:** ![xiaobird](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@xiaobird](https://community.mrtrix.org/u/xiaobird)\
**Post date:** [September 20, 2019, 6:02pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/7 "2019-09-20T18:02:34Z")

</div>

Hi,

I tried B0 threshold with 15. It works.  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ThijsDhollander](https://community.mrtrix.org/user_avatar/community.mrtrix.org/thijsdhollander/32/1617_2.png) [@ThijsDhollander](https://community.mrtrix.org/u/ThijsDhollander)\
**Post date:** [September 20, 2019, 10:10pm UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/8 "2019-09-20T22:10:47Z")

</div>

In the meantime, I’ve figured out the issue, but it’s less likely to happen than in the other scenario I mentioned earlier, and in this case it can be fixed _most of the time_ with modification of the threshold. So the urgency is relatively low luckily. I’ll take note and fix on my end at some point in the future. Thanks again; useful info. 👍

---

<div class="post-metadata">

**Author:** ![rlaboune](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rlaboune/32/3656_2.png) [@rlaboune](https://community.mrtrix.org/u/rlaboune)\
**Post date:** [December 14, 2021, 9:46am UTC](https://community.mrtrix.org/t/error-from-dwi2response/2818/9 "2021-12-14T09:46:55Z")

</div>

I confirm the same issue. Set threshold value to 20 in ~/.mrtrix.conf has helped. In my experience, lots of DWI settings generates b 5, 10 or 15 for b0 scans. Default threshold 10 does not appear as a safe deafult value.
