Skip to content

Commit 7d845e2

Browse files
committed
fix: cannot access image_defs attributes like a dictionary. fix typo in test_diffusion_parameters_v4.
1 parent 7f42d65 commit 7d845e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

nibabel/parrec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def get_q_vectors(self):
703703
acquisition.
704704
"""
705705
bvals, bvecs = self.get_bvals_bvecs()
706-
if bvals is None and bvecs is None:
706+
if bvals is None or bvecs is None:
707707
return None
708708
return bvecs * bvals[:, np.newaxis]
709709

@@ -728,7 +728,7 @@ def get_bvals_bvecs(self):
728728
# All bvals within volume should be the same
729729
assert not np.any(np.diff(bvals, axis=0))
730730
bvals = bvals[0]
731-
if 'diffusion' not in self.image_defs:
731+
if 'diffusion' not in self.image_defs.dtype.names:
732732
return bvals, None
733733
bvecs = self.image_defs['diffusion'][reorder].reshape(
734734
(n_slices, n_vols, 3), order='F')

nibabel/tests/test_parrec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ def test_diffusion_parameters_v4():
350350
assert_almost_equal(bvals, DTI_PAR_BVALS)
351351
# no b-vector info in V4 .PAR files
352352
assert_equal(bvecs, None)
353-
assert_equal(dti_hdr.get_q_vectors(), None)
353+
assert_equal(dti_v4_hdr.get_q_vectors(), None)
354354

355355

356356
def test_null_diffusion_params():
357357
# Test non-diffusion PARs return None for diffusion params
358358
for par, fobj in gen_par_fobj():
359-
if basename(par) in ('DTI.PAR', 'NA.PAR'):
359+
if basename(par) in ('DTI.PAR', 'DTIv40.PAR', 'NA.PAR'):
360360
continue
361361
gen_info, slice_info = parse_PAR_header(fobj)
362362
with suppress_warnings():

0 commit comments

Comments
 (0)