Skip to content

Commit 44efa75

Browse files
committed
RF+API: add qform, sform code 1 for parrec2nii
As discussed in #478
1 parent 42959a3 commit 44efa75

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

nibabel/parrec2nii_cmd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ def proc_file(infile, opts):
221221
nhdr = nimg.header
222222
nhdr.set_data_dtype(out_dtype)
223223
nhdr.set_slope_inter(slope, intercept)
224-
nhdr.set_qform(affine, code=2)
224+
nhdr.set_sform(affine, code=1)
225+
nhdr.set_qform(affine, code=1)
225226

226227
if 'parse' in opts.minmax:
227228
# need to get the scaled data

nibabel/tests/test_parrec2nii.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def test_parrec2nii_sets_qform_with_code2():
7070

7171
infile = 'nonexistent.PAR'
7272
parrec2nii.proc_file(infile, opts)
73-
nhdr.set_qform.assert_called_with(pr_hdr.get_affine(), code=2)
73+
nhdr.set_qform.assert_called_with(AN_OLD_AFFINE, code=1)
74+
nhdr.set_sform.assert_called_with(AN_OLD_AFFINE, code=1)
7475

7576

7677
def test_parrec2nii_save_load_qform_code():
@@ -98,6 +99,6 @@ def test_parrec2nii_save_load_qform_code():
9899
outfname = join(pth, basename(fname)).replace('.PAR', '.nii')
99100
assert_true(isfile(outfname))
100101
img = nibabel.load(outfname)
101-
assert_almost_equal(img.get_affine(), PAR_AFFINE, 4)
102-
assert_array_equal(img.header['qform_code'], 2)
103-
assert_array_equal(img.header['sform_code'], 2)
102+
assert_almost_equal(img.affine, PAR_AFFINE, 4)
103+
assert_array_equal(img.header['qform_code'], 1)
104+
assert_array_equal(img.header['sform_code'], 1)

0 commit comments

Comments
 (0)