Problem using command read_bvec_file

Dear community:

I am trying to use read_bvec_file and I am getting this error:

bvecs_file = ‘grad.bvecs’
bvals_file = ‘grad.bvals’
bvecs = in_file_fmricorr + ‘/’ + bvecs_file

import os
from dipy.io.dpy import Dpy
bvec_data = dipy.io.read_bvec_file(bvecs)

===========================================
NameError: name ‘dipy’ is not defined

Assuming that that’s all valid, you need to import dipy before trying to call dipy.io.read_bvec_file. Possibly you’ll need to import dipy.io.

I found the solution is

from dipy.io.bvectxt import read_bvec_file
bvec, bval = read_bvec_file(bvec)

Thanks a lot,

Aldo

1 Like