Skip to content

Commit 07fa254

Browse files
committed
correct the re-orientation of the output image in conform
1 parent 6e19298 commit 07fa254

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nibabel/processing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .affines import AffineError, to_matvec, from_matvec, append_diag
2525
from .spaces import vox2out_vox
2626
from .nifti1 import Nifti1Header, Nifti1Image
27-
from .orientations import axcodes2ornt
27+
from .orientations import axcodes2ornt, io_orientation, ornt_transform
2828
from .imageclasses import spatial_axes_first
2929

3030
SIGMA2FWHM = np.sqrt(8 * np.log(2))
@@ -386,5 +386,7 @@ def conform(from_img,
386386
cval=cval, out_class=out_class)
387387

388388
# Reorient to desired orientation.
389-
ornt = axcodes2ornt(orientation, labels=list(zip('RPI', 'LAS')))
390-
return out_img.as_reoriented(ornt)
389+
start_ornt = io_orientation(out_img.affine)
390+
end_ornt = axcodes2ornt(orientation)
391+
transform = ornt_transform(start_ornt, end_ornt)
392+
return out_img.as_reoriented(transform)

0 commit comments

Comments
 (0)