<div dir="ltr">OK, so it's not <i>lmax</i> that's the problem; though I've modified dwi2response to make sure that at least <i>lmax</i>=4 is used.<div><br></div><div>Looking at the output, you don't seem to have the most up-to-date code. Could you please download the most up-to-date version and re-compile, and see what happens? If that's not enough, could you try restarting your processing from the very beginning (i.e. DICOM import) with the newest code, and see if you get the same result?</div><div>I'm suspecting it may have something to do with those b=0 volumes, which currently have a direction of [0 0 0]. There's a chance that the particular code version you have is attempting to re-scale those vectors to unit length and correct the b-value accordingly, which is resulting in an infinite b-value, and therefore dwi2response is selecting those b=0 volumes as the largest b-value shell to use in response function estimation. We've made some changes to both the DICOM import code and b-value scaling in the presence of non-unit-length direction vectors, so a simple code update may well fix it; and if it doesn't, there's a couple of extra debugging console outputs in the code that may provide us with more clues.</div><div><br></div><div>Rob</div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><br>--<br><br><span style="color:rgb(255,102,0)"><b>Robert Smith, Ph.D</b><br>Research Officer, Imaging Division</span><br><br>The Florey Institute of Neuroscience and Mental Health<br>Melbourne Brain Centre - Austin Campus<br>245 Burgundy Street<br>Heidelberg Vic 3084<br>Ph: +61 3 9035 7128<br>Fax: +61 3 9035 7301<br><a href="http://www.florey.edu.au/" target="_blank">www.florey.edu.au</a><br></div></div></div>
<br><div class="gmail_quote">On Tue, Nov 25, 2014 at 9:05 PM, Rafa X <span dir="ltr"><<a href="mailto:rromero3000@gmail.com" target="_blank">rromero3000@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">Hi Robert,
<div>Thanks for your quick response.</div>
<div>Yes, I set Imax=2 but just to try if it finished early. </div>
<div>I also ran the standard command:</div>
<div><br>
</div>
<div>dwi2response dwi_ec.nii.gz responseText.txt -mask $path_BRAIN -info -debug -grad $path_bvec <br>
</div>
<div><br>
</div>
<div>dwi_ec.nii.gz is the same nifti file that has been already used to track using camino and FSL</div>
<div><br>
</div>
<div>My file $path_bvec contains bvec and bvals (including B=0):</div>
<div><br>
</div>
<div>
<div>0 0 0 0</div>
<div>-0.30179 -0.49892 -0.8124 991.4</div>
<div>0.10011 -0.38886 -0.91584 990.33</div>
<div>0.19261 -0.95699 0.21697 1001.3</div>
<div>0.96169 0.1229 -0.24506 991.74</div>
<div>0.81411 -0.41851 0.40257 993.57</div>
<div>-0.0014986 0.43766 -0.89914 990.66</div>
<div>0.082206 0.46978 0.87895 991.88</div>
<div>0.53567 -0.3644 -0.76175 990.15</div>
<div>0.24235 0.95847 0.15032 1001.1</div>
<div>-0.6289 -0.59437 -0.50121 994.41</div>
<div>0.030908 0.97349 -0.22662 1000.7</div>
<div>0.75847 -0.048936 0.64987 988.95</div>
<div>-0.75647 0.10047 0.64627 989.69</div>
<div>0 0 0 0</div>
<div>-0.8253 0.54219 -0.15784 997.19</div>
<div>0.31397 0.040865 -0.94855 986.34</div>
<div>0.012679 -0.41192 0.91113 991.6</div>
<div>-0.40493 0.89486 -0.18775 1000.5</div>
<div>0.30856 0.7896 -0.5304 995.3</div>
<div>0.52242 0.44816 0.72542 992.35</div>
<div>0.61055 0.72178 0.32599 997.16</div>
<div>-0.56095 0.64767 -0.51562 994.84</div>
<div>0.2649 -0.93084 -0.25172 999.8</div>
<div>-0.56309 -0.81605 -0.13037 1000.4</div>
<div>-0.8855 -0.45957 -0.068378 996.81</div>
<div>0.39443 0.038652 0.91811 987.12</div>
<div>0 0 0 0</div>
<div>0.61303 -0.7892 0.036731 1000.4</div>
<div>-0.28526 -0.9044 0.31732 999.4</div>
<div>-0.23313 0.73144 0.64082 995.66</div>
<div>-0.18955 0.95018 0.24743 1000.5</div>
<div>-0.68422 -0.67696 0.27122 998.05</div>
<div>-0.21528 -0.8244 -0.52347 996.61</div>
<div>-0.43117 0.35928 -0.82765 989.07</div>
<div>0.44837 -0.41746 0.79037 991.41</div>
<div>0.61614 -0.67367 -0.4081 995.81</div>
<div>-0.7349 -0.36356 0.57249 991.98</div>
<div>0.21674 0.78146 0.5851 996.89</div>
<div>-0.86797 -0.20532 -0.45219 991.11</div>
<div>-0.90577 0.34166 0.2507 994.46</div>
<div>0 0 0 0</div>
<div>-0.43297 -0.19225 0.88067 988.45</div>
<div>0.84657 0.31401 0.42979 992.85</div>
<div>0.98331 -0.043749 0.17661 992.18</div>
<div>0.20102 -0.71986 -0.66438 994.31</div>
<div>-0.13258 0.77961 -0.61207 994.49</div>
<div>-0.95696 -0.15066 0.24804 992.64</div>
<div>-0.58805 -0.10555 -0.80191 988.32</div>
<div>0.85492 -0.27751 -0.43829 991.46</div>
<div>0.56033 0.81795 -0.13034 999.37</div>
<div>0.062488 -0.7816 0.62064 996.28</div>
<div>-0.032125 0.01453 0.99938 987.96</div>
<div>-0.1674 0.0029333 -0.98589 986.29</div>
<div>0 0 0 0</div>
<div>0.72326 0.098618 -0.6835 988.64</div>
<div>-0.80104 0.26152 -0.53846 990.25</div>
<div>-0.6094 0.769 0.19305 999.45</div>
<div>0.48647 -0.73744 0.46854 996.41</div>
<div>0.87567 0.48285 0.0079515 997.79</div>
<div>0.43991 0.45803 -0.77245 990.63</div>
<div>0.74572 0.50959 -0.42921 993.29</div>
<div>-0.3702 -0.62767 0.68482 993.32</div>
<div>-0.375 0.30795 0.87438 990.07</div>
<div>-0.98695 0.099977 -0.12619 993.52</div>
<div>0.89561 -0.44332 -0.036746 996.72</div>
<div>-0.6239 0.53885 0.56603 994.18</div>
<div>-0.1654 -0.98069 -0.10436 1002.3</div>
<div>0 0 0 0</div>
</div>
<div><br>
</div>
<div>And the output of the dwi2response command is:</div>
<div><br>
</div>
<div><span class="">
<div>dwi2response [INFO]: opening image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"...</div>
<div>dwi2response [DEBUG]: sanitising image information...</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [INFO]: opening image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"...</div>
<div>dwi2response [DEBUG]: sanitising image information...</div>
<div>dwi2response [DEBUG]: loading image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"...</div>
<div>dwi2response: uncompressing image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"... 100%</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" loaded</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" unloaded</div>
<div>dwi2response [DEBUG]: searching for suitable gradient encoding...</div>
<div>dwi2response [INFO]: found 69x4 diffusion-weighted encoding</div>
<div>dwi2response [INFO]: Diffusion gradient encoding data clustered into 2 shells</div>
<div>dwi2response [DEBUG]: loading image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"...</div>
<div>dwi2response: uncompressing image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"... 100%</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" loaded</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 645120 ]</div>
<div>dwi2response: initialising response function... 100%</div>
</span><div>dwi2response [INFO]: Initial response function is <a href="tel:%5B331.3299255" value="+13313299255" target="_blank">[331.3299255</a> -81.32884216 0 0 0]</div><span class="">
<div>dwi2response: optimising response function.. . dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 645120 ]</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [DEBUG]: initialising threads...</div>
<div>dwi2response [DEBUG]: launching 1 thread "run thread"...</div>
</span><div>dwi2response [DEBUG]: launched thread "run thread" [ID 140450999523072]</div>
<div>dwi2response [DEBUG]: waiting for completion of thread "run thread" [ID 140450999523072]...</div><span class="">
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
</span></div>
<div>and then I repeat this line many times</div>
<div><br>
</div>
<div>Thankss the support!</div>
</div><div><div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">2014-11-24 22:18 GMT+00:00 Robert Smith <span dir="ltr">
<<a href="mailto:robert.smith@florey.edu.au" target="_blank">robert.smith@florey.edu.au</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,
<div><br>
</div>
<div>The "failed to find SH peak!" error is not entirely uncommon, especially if the input mask contains some non-brain voxels.<br>
<div><br>
</div>
<div>It's a little hidden, but the problem lies here:</div>
<span>
<div><font face="courier new, monospace"><span style="font-size:13px">dwi2response [INFO]: Initial response function is </span><a href="tel:%5B331.3299255" value="+13313299255" target="_blank">[331.3299255</a><span style="font-size:13px"> -81.32884216]</span></font><br>
</div>
</span>
<div><span style="font-family:arial,sans-serif;font-size:13px">This indicates that the algorithm is using lmax = 2: this makes it impossible to identify voxels with crossing fibres and remove them from the single-fibre mask, so the algorithm will take much
longer (normally dwi2response runs CSD only on the single-fibre voxels from the previous iteration, so each subsequent iteration takes less time).</span></div>
</div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">I would take a close look at your gradient table (presumably already stored as a bvecs/bvals pair or external MRtrix format text file, given you are using compressed niftis). It's possible that
the table is either corrupt, or is being erroneously split into two b-value shells when in reality only one is present:</span></div>
<span>
<div><span style="font-size:13px"><font face="courier new, monospace">dwi2response [INFO]: Diffusion gradient encoding data clustered into 2 shells</font></span><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
</span>
<div><span style="font-family:arial,sans-serif;font-size:13px">It also appears to not include any b=0 volumes (not that that should matter, the command won't use the b=0's, it's just slightly unusual to not have any).</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">If the problem's not immediately obvious, feel free to copy & paste the file contents here. I'll also add some extra debugging outputs / sanity checks to the code to hopefully give more interpretable
feedback in such circumstances.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Cheers</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Rob</span></div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr"><br>
--<br>
<br>
<span style="color:rgb(255,102,0)"><b>Robert Smith, Ph.D</b><br>
Research Officer, Imaging Division</span><br>
<br>
The Florey Institute of Neuroscience and Mental Health<br>
Melbourne Brain Centre - Austin Campus<br>
245 Burgundy Street<br>
Heidelberg Vic 3084<br>
Ph: <a href="tel:%2B61%203%209035%207128" value="+61390357128" target="_blank">+61 3 9035 7128</a><br>
Fax: <a href="tel:%2B61%203%209035%207301" value="+61390357301" target="_blank">+61 3 9035 7301</a><br>
<a href="http://www.florey.edu.au/" target="_blank">www.florey.edu.au</a><br>
</div>
</div>
</div>
<div>
<div><br>
<div class="gmail_quote">On Tue, Nov 25, 2014 at 2:11 AM, Rafa X <span dir="ltr">
<<a href="mailto:rromero3000@gmail.com" target="_blank">rromero3000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div>Hi Mrtrix expert,</div>
<div>I'm new on mrtrix and I'm trying to run dwi2response (using -grad) but it has been days in a loop that said "failed to find SH peak!". Below you can see the output provided by "-info -debug".</div>
<div><br>
</div>
<div><br>
</div>
<div>dwi2response [INFO]: opening image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"...</div>
<div>dwi2response [DEBUG]: sanitising image information...</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [INFO]: opening image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"...</div>
<div>dwi2response [DEBUG]: sanitising image information...</div>
<div>dwi2response [DEBUG]: loading image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"...</div>
<div>dwi2response: uncompressing image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz"... 100%</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" loaded</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec_brain_mask.nii.gz" unloaded</div>
<div>dwi2response [DEBUG]: searching for suitable gradient encoding...</div>
<div>dwi2response [INFO]: found 69x4 diffusion-weighted encoding</div>
<div>dwi2response [INFO]: Diffusion gradient encoding data clustered into 2 shells</div>
<div>dwi2response [DEBUG]: loading image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"...</div>
<div>dwi2response: uncompressing image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz"... 100%</div>
<div>dwi2response [DEBUG]: image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" loaded</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 645120 ]</div>
<div>dwi2response: initialising response function... 100%</div>
<div>dwi2response [INFO]: Initial response function is <a href="tel:%5B331.3299255" value="+13313299255" target="_blank">
[331.3299255</a> -81.32884216]</div>
<div>dwi2response: optimising response function.. . dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 645120 ]</div>
<div>dwi2response [DEBUG]: voxel accessor for image "/home/rr480/Code/KirstieDTI/SUB_DATA/22566/DTI/MRI0/dti_ec.nii.gz" initialised with start = 95, strides = [ -1 96 9216 ]</div>
<div>dwi2response [DEBUG]: initialising threads...</div>
<div>dwi2response [DEBUG]: launching 1 thread "run thread"...</div>
<div>dwi2response [DEBUG]: launched thread "run thread" [ID 140638269503232]</div>
<div>dwi2response [DEBUG]: waiting for completion of thread "run thread" [ID 140638269503232]...</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
<div>dwi2response [DEBUG]: failed to find SH peak!</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div>
</blockquote></div><br></div></div>