Skip to content

BF: Misplaced parenthesis #347

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

Merged
merged 2 commits into from
Sep 8, 2015
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def get_qform(self, coded=False):
quat = self.get_qform_quaternion()
R = quat2mat(quat)
vox = hdr['pixdim'][1:4].copy()
if np.any(vox) < 0:
if np.any(vox < 0):
raise HeaderDataError('pixdims[1,2,3] should be positive')
qfac = hdr['pixdim'][0]
if qfac not in (-1, 1):
Expand Down
4 changes: 4 additions & 0 deletions nibabel/tests/test_nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ def test_qform(self):
assert_true, ehdr['qform_code'] == xfas['scanner']
ehdr.set_qform(A, xfas['aligned'])
assert_true, ehdr['qform_code'] == xfas['aligned']
# Test pixdims[1,2,3] are checked for negatives
for dims in ((-1, 1, 1), (1, -1, 1), (1, 1, -1)):
ehdr['pixdim'][1:4] = dims
assert_raises(HeaderDataError, ehdr.get_qform)

def test_sform(self):
# Test roundtrip case
Expand Down