# Version 3.0 dwi2response gives nan

**URL:** https://community.mrtrix.org/t/version-3-0-dwi2response-gives-nan/1232
**Category:** Uncategorized
**Tags:** dwi2response
**Created:** [October 11, 2017, 1:42pm UTC](https://community.mrtrix.org/t/version-3-0-dwi2response-gives-nan/1232 "2017-10-11T13:42:31Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [October 12, 2017, 1:27am UTC](https://community.mrtrix.org/t/version-3-0-dwi2response-gives-nan/1232/2 "2017-10-12T01:27:07Z")

</div>

Hi @EricMoulton_ICM,

The problem is in your usage of the `-lmax` option. `dwi2response dhollander` naturally extracts an anisotropic response for WM, and an isotropic one for GM and CSF. The `-lmax` option, when provided, allows to override the automatic lmax settings for the anisotropic WM response, with a provided value per b-value in your dataset. The automatic lmax setting for the anisotropic WM response is lmax=0 for the b=0 data, and lmax=10 for all other b-values present. This makes sense, since the b=0 data is not expected to show any anisotropy (and if it appears to do so, it’s due to noise or other issues). For the other b-values, you don’t have to worry about lmax=10 appearing to be too high with respect to the number of gradient directions in your data: the response function is estimated by a couple of tens to hundreds of voxels _at once_, using all of their data. So even though you “only” have 30 directions at b=1000, if the response function ends up being estimated from 100 or so voxels, the fitting algorithm will have 30000 data points at its disposal. Note that for lmax=10, the response function (which is represented only in zonal harmonics, not full spherical harmonics) only needs 6 parameters. 30000 datapoints to fit 6 parameters is pretty safe. 😉

I’m actually surprised (then again, not _that_ much) that you’d get values for b=0 up to lmax=4 before. While your b=1000 response part looks as expected:

![Screenshot from 2017-10-12 12-22-42](https://community.mrtrix.org/uploads/default/original/1X/805c40c8598b774ab95082c00abcaf21d00d85aa.png)

…the b=0 response part you got before looks rather funky (which isn’t good):

 ![Screenshot from 2017-10-12 12-23-32](https://community.mrtrix.org/uploads/default/original/1X/cd977068dfaf1f2409d2de50f362b79275869e5a.png)

So well, the solution is simple: just do away with that `-lmax 4,4` : it isn’t needed and the first `4` in there is actually wrong (should’ve been a `0` at best). Given how robust response function estimation has become with our recent strategies, the `-lmax` option should really only be considered in very special scenarios (or for some kinds of technical or theoretical experiments). For any other scenario, simply don’t specify the `-lmax` option; things work out better with the defaults automatically. 🙂

Also, see some more information in this post: [-lmax for dwi2response and dwi2fod](https://community.mrtrix.org/t/lmax-for-dwi2response-and-dwi2fod/1099) , where a user ran into other confusion regarding the `-lmax` option. The solution was also to simply not specify the option to begin with.

Cheers,  
Thijs

---

_[View the full topic](https://community.mrtrix.org/t/version-3-0-dwi2response-gives-nan/1232)._
