brainlife / app-snr_in_cc

Brainlife.io app that computes the signal-to-noise ratio in the corpus callosum
1 stars 3 forks source link

Error: The vectors in bvecs should be unit #7

Open soichih opened 5 years ago

soichih commented 5 years ago

We are seeing this error message.

Traceback (most recent call last):
 File "/export/prod/5d891bd313501c269dd88cd4/5d8a1b2e13501cacc3d8b824/snr_in_cc.py", line 60, in <module>
   gtab = gradient_table(bvals, bvecs)
 File "/usr/local/lib/python2.7/dist-packages/dipy/core/gradients.py", line 448, in gradient_table
   atol=atol)
 File "/usr/local/lib/python2.7/dist-packages/dipy/core/gradients.py", line 178, in gradient_table_from_bvals_bvecs
   raise ValueError("The vectors in bvecs should be unit (The tolerance "
ValueError: The vectors in bvecs should be unit (The tolerance can be modified as an input parameter)

We are passing dwi with the following bvecs/bvals.

(bvecs)

-0.23229 -0.367538 -0.190232 0.11673 0.200474 0.495788 0.014151 0.744504 0.760882 0.180817 0.679648 -0.777112 -0.924171 -0.468448 -0.8817 -0.690425 -0.239161 0.0577173 0.536734 0.991783 0.996766 0.872431 0.248644 -0.118378 -0.33766 -0.528629 -0.996851 0.0 0.0 -1.0 -8.53386e-05 3.43466e-06 0.0424087 -0.174903
-0.162614 0.0260943 0.374377 0.833395 0.252664 0.134457 -0.628136 -0.147746 0.320357 0.924667 -0.42245 0.470702 -0.103568 -0.767407 -0.189276 0.706184 0.757075 0.983706 0.83608 -0.120738 0.0708551 0.478098 0.933577 0.99185 0.841495 0.840853 0.0550367 0.0 0.0 4.157e-05 1.0 2.58921e-05 -0.114632 -0.200536
-0.958957 -0.929642 -0.907554 -0.540209 -0.946558 -0.857972 -0.777975 -0.651065 -0.564295 -0.335105 -0.599678 -0.417775 -0.367671 -0.437771 -0.432181 -0.1569 -0.607979 0.170269 -0.11352 -0.0422974 -0.0379026 -0.101419 0.258088 -0.0471202 0.421749 0.116266 -0.0570922 0.0 0.0 3.49707e-06 -2.58073e-05 1.0 -0.992502 -0.963947
800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 0 800 800 800 800 800
ganxing520 commented 4 years ago

did you find the method to solve the problem?

faraix commented 2 years ago

Please provide solutions to the above-mentioned problem. I have input similar to the attached

davhunt commented 2 years ago

@faraix The problem with this data seems to be the 28th bval, it should be 0.0 not 800.0, since the 28th bvec is [0, 0, 0]. All bvecs should be unit length, and the ones that aren't need to have a bvec of 0 (or < 50 at least), or it'll run into this error https://github.com/dipy/dipy/blob/master/dipy/core/gradients.py#L309. Hope this helps!