brainlife / app-dipy-csamodel

This service generates a csa model using dipy from a given dwi file and freesurfer mask. It then saves the evaluated peaks of the csa model into a dipy compatible .pam5 (peaks and models 5) file type for use in other dipy applications and scripts.
0 stars 0 forks source link

Handle comma delimited bvecs/bvals #2

Open soichih opened 7 years ago

soichih commented 7 years ago

It looks like dipy's read_bvals_bvecs() doesn't handle comma delimited bvecs/bvals.

Traceback (most recent call last):
  File "/N/u/brlife/Carbonate/.sca/services/brain-life/app-dipy-csamodel/main.py", line 60, in <module>
    main()
  File "/N/u/brlife/Carbonate/.sca/services/brain-life/app-dipy-csamodel/main.py", line 43, in main
    bvals, bvecs = read_bvals_bvecs(config['data_bval'], config['data_bvec'])
  File "/N/u/brlife/Karst/git/dipy/dipy/io/gradients.py", line 41, in read_bvals_bvecs
    vals.append(np.squeeze(np.loadtxt(this_fname)))
  File "/N/soft/rhel7/python/2.7.13a/lib/python2.7/site-packages/numpy-1.13.0.dev0+9c3d247-py2.7-linux-x86_64.egg/numpy/lib/npyio.py", line 1024, in loadtxt
    items = [conv(val) for (conv, val) in zip(converters, vals)]
  File "/N/soft/rhel7/python/2.7.13a/lib/python2.7/site-packages/numpy-1.13.0.dev0+9c3d247-py2.7-linux-x86_64.egg/numpy/lib/npyio.py", line 725, in floatconv
    return float(x)
ValueError: invalid literal for float(): 0,0,0,0,0,0,0,0,0,0,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,

This should probably be fixed by dipy, but I am submitting this to be aware of this issue.

soichih commented 7 years ago

I've talked to @Garyfallidis and he said that he would look into adding support for comma delimited bvecs / bvals.

Meanwhile, I've found that it's app-datanormalize which is generating bvecs / bvals in non-FSL format. I've updated the app to keep data delimited by space. I've looked for other apps under /brain-life and didn't notice any other apps that are using dlmwrite without space delimiter.

aarya22 commented 7 years ago

@soichih The problem is not simply with the comma-delimiter. Removing the comma might get the application to run, but the results will be rather poor because it looks like the data seems to be normalized. If you can get the data to be not normalized then it will run better.

soichih commented 7 years ago

Aman, thank you the comment!

I've fixed a bug where user could select datasets that does not match the datatype_tags specified by the app. User should no longer be able to submit app-dipy-csamodel with normalized data.