if min(bvecs.shape) != 3:
raise IOError("bvec file should have three rows")
if bvecs.ndim != 2:
raise IOError("bvec file should be saved as a two dimensional array")
if bvecs.shape[1] > bvecs.shape[0]:
bvecs = bvecs.T
// If bvals is None, you don"t need to check that they have the same shape:
if bvals is None:
return bvals, bvecs
if len(bvals.shape) > 1:
raise IOError("bval file should have one row")
if max(bvals.shape) != max(bvecs.shape):
raise IOError("b-values and b-vectors shapes do not correspond")
return bvals, bvecs
After Change
if bvecs is None:
return bvals, bvecs
if 3 not in bvecs.shape:
raise IOError("bvec file should have three rows")
if bvecs.ndim != 2:
bvecs = bvecs[None, ...]
bvals = bvals[None, ...]msg = "Only 1 direction detected on your bvec file. For diffusion "
msg += "dataset, it is recommended to have minimum 3 directions."
msg += "You may have problem during the reconstruction step."
warnings.warn(msg)
if bvecs.shape[1] !=3 and bvecs.shape[1] > bvecs.shape[0]: