Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to read bval from PVM_DwEffBval and bvec from PVM_DwGradVec #96

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions brkraw/lib/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,21 +823,9 @@ def _get_temp_info(self, visu_pars):
# DTI
@staticmethod
def _get_bdata(method):
# [220201] parse the input value directly instead of final values & remove bmat
bval = get_value(method, 'PVM_DwBvalEach')
bval = [bval] if isinstance(bval, int) else bval
num_b0 = get_value(method, 'PVM_DwAoImages')
num_exp = get_value(method, 'PVM_DwNDiffExp')
num_dir = int((num_exp - num_b0) / len(bval))
bdir = get_value(method, 'PVM_DwDir')
bvals = np.r_[np.zeros(num_b0), np.concatenate([bval for i in np.ones(num_dir).astype(int)], axis=0)]
bvecs = np.concatenate([np.zeros([num_b0, 3])] + [bdir] * len(bval), axis=0).T
# test if results are correctly built
try:
assert(bvals.shape[0] == num_exp)
assert(bvecs.shape[-1] == num_exp)
except:
raise UnexpectedError('Exceptional case is reported, please report on issue at brkraw github')
"""Extract, format, and return diffusion bval and bvec"""
bvals = np.array(get_value(method, 'PVM_DwEffBval'))
bvecs = np.array(get_value(method, 'PVM_DwGradVec').T)
return bvals, bvecs

# Generals
Expand Down