@@ -628,24 +628,29 @@ def test_affines_init():
628
628
hdr = img .get_header ()
629
629
assert_equal (hdr ['qform_code' ], 0 )
630
630
assert_equal (hdr ['sform_code' ], 2 )
631
+ assert_array_equal (hdr .get_zooms (), [2 , 3 , 4 ])
631
632
# This is also true for affines with header passed
632
633
qaff = np .diag ([3 , 4 , 5 , 1 ])
633
634
saff = np .diag ([6 , 7 , 8 , 1 ])
634
635
hdr .set_qform (qaff , code = 'scanner' )
635
636
hdr .set_sform (saff , code = 'talairach' )
637
+ assert_array_equal (hdr .get_zooms (), [3 , 4 , 5 ])
636
638
img = Nifti1Image (arr , aff , hdr )
637
639
new_hdr = img .get_header ()
638
640
# Again affine is sort of anonymous space
639
641
assert_equal (new_hdr ['qform_code' ], 0 )
640
642
assert_equal (new_hdr ['sform_code' ], 2 )
641
643
assert_array_equal (new_hdr .get_sform (), aff )
644
+ assert_array_equal (new_hdr .get_zooms (), [2 , 3 , 4 ])
642
645
# But if no affine passed, codes and matrices stay the same
643
646
img = Nifti1Image (arr , None , hdr )
644
647
new_hdr = img .get_header ()
645
648
assert_equal (new_hdr ['qform_code' ], 1 ) # scanner
646
649
assert_array_equal (new_hdr .get_qform (), qaff )
647
650
assert_equal (new_hdr ['sform_code' ], 3 ) # Still talairach
648
651
assert_array_equal (new_hdr .get_sform (), saff )
652
+ # Pixdims as in the original header
653
+ assert_array_equal (new_hdr .get_zooms (), [3 , 4 , 5 ])
649
654
650
655
651
656
0 commit comments