Skip to content

Commit 2a09ae8

Browse files
committed
address @effigies' comments on MatchHeader
1 parent e52394e commit 2a09ae8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fmriprep/interfaces/images.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,24 +502,26 @@ def _run_interface(self, runtime):
502502
imghdr['dim_info'] = refhdr['dim_info'] # dim_info is lost sometimes
503503

504504
# Set qform
505-
qform, qcode = refhdr.get_qform(coded=True)
505+
qform = refhdr.get_qform()
506+
qcode = int(refhdr['qform_code'])
506507
if not np.allclose(qform, imghdr.get_qform()):
507508
LOGGER.warning(
508509
'q-forms of reference and mask are substantially different')
509-
imghdr.set_qform(qform, int(qcode))
510+
imghdr.set_qform(qform, qcode)
510511

511512
# Set sform
512-
sform, scode = refhdr.get_sform(coded=True)
513+
sform = refhdr.get_sform()
514+
scode = int(refhdr['sform_code'])
513515
if not np.allclose(sform, imghdr.get_sform()):
514516
LOGGER.warning(
515517
's-forms of reference and mask are substantially different')
516-
imghdr.set_sform(sform, int(scode))
518+
imghdr.set_sform(sform, scode)
517519

518520
out_file = fname_presuffix(self.inputs.in_file, suffix='_hdr',
519521
newpath=runtime.cwd)
520522

521-
imgnii.__class__(imgnii.get_data(), imgnii.affine, imghdr).to_filename(
522-
out_file)
523+
imgnii.__class__(imgnii.get_data(), imghdr.get_best_affine(),
524+
imghdr).to_filename(out_file)
523525
self._results['out_file'] = out_file
524526
return runtime
525527

0 commit comments

Comments
 (0)