File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -182,12 +182,11 @@ def proc_file(infile, opts):
182
182
183
183
# container for potential NIfTI1 header extensions
184
184
if opts .store_header :
185
- exts = nifti1 .Nifti1Extensions ()
186
185
# dump the full PAR header content into an extension
187
186
with open (infile , 'r' ) as fobj :
188
187
hdr_dump = fobj .read ()
189
188
dump_ext = nifti1 .Nifti1Extension ('comment' , hdr_dump )
190
- exts .append (dump_ext )
189
+ nhdr . extensions .append (dump_ext )
191
190
192
191
verbose ('Writing %s' % outfilename )
193
192
nibabel .save (nimg , outfilename )
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ def test_parrec2nii():
129
129
data = img .get_data ()
130
130
assert_data_similar (data , eg_dict )
131
131
assert_almost_equal (img .header .get_zooms (), eg_dict ['zooms' ])
132
+ # Standard save does not save extensions
133
+ assert_equal (len (img .header .extensions ), 0 )
132
134
# Does not overwrite unless option given
133
135
code , stdout , stderr = run_command (
134
136
['parrec2nii' , fname ], check_code = False )
@@ -149,6 +151,10 @@ def test_parrec2nii():
149
151
check_conversion (base_cmd + ['--scaling=off' ],
150
152
pr_img .dataobj .get_unscaled (),
151
153
out_froot )
154
+ # Save extensions
155
+ run_command (base_cmd + ['--store-header' ])
156
+ img = load (out_froot )
157
+ assert_equal (len (img .header .extensions ), 1 )
152
158
153
159
154
160
@script_test
You can’t perform that action at this time.
0 commit comments