Skip to content

Commit 00825c7

Browse files
committed
make to_img the same image/header classes as input image
1 parent 07fa254 commit 00825c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nibabel/processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ def conform(from_img,
374374
raise ValueError("`voxel_size` must have {} values".format(required_ndim))
375375

376376
# Create fake image of the image we want to resample to.
377-
hdr = Nifti1Header()
377+
hdr = from_img.header_class()
378378
hdr.set_data_shape(out_shape)
379379
hdr.set_zooms(voxel_size)
380380
dst_aff = hdr.get_best_affine()
381-
to_img = Nifti1Image(np.empty(out_shape), affine=dst_aff, header=hdr)
381+
to_img = from_img.__class__(np.empty(out_shape), affine=dst_aff, header=hdr)
382382

383383
# Resample input image.
384384
out_img = resample_from_to(

0 commit comments

Comments
 (0)