Skip to content

Commit a320cc5

Browse files
committed
fix: allow uses_qform for apply_xfm matrix
1 parent a81d993 commit a320cc5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nipype/interfaces/fsl/preprocess.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,9 @@ class FLIRTInputSpec(FSLCommandInputSpec):
400400
name_template='%s_flirt.log', desc='output log')
401401
in_matrix_file = File(argstr='-init %s', desc='input 4x4 affine matrix')
402402
apply_xfm = traits.Bool(
403-
argstr='-applyxfm', requires=['in_matrix_file'],
404-
desc='apply transformation supplied by in_matrix_file')
403+
argstr='-applyxfm',
404+
desc=('apply transformation supplied by in_matrix_file or uses_qform to'
405+
' use the affine matrix stored in the reference header'))
405406
apply_isoxfm = traits.Float(
406407
argstr='-applyisoxfm %f', xor=['apply_xfm'],
407408
desc='as applyxfm but forces isotropic resampling')
@@ -561,13 +562,18 @@ def _parse_inputs(self, skip=None):
561562
if isdefined(self.inputs.save_log) and self.inputs.save_log:
562563
if not isdefined(self.inputs.verbose) or self.inputs.verbose == 0:
563564
self.inputs.verbose = 1
565+
if isdefined(self.inputs.apply_xfm) and self.inputs.apply_xfm:
566+
if not self.inputs.in_matrix_file or not self.inputs.uses_qform:
567+
raise RuntimeError('Argument apply_xfm requires in_matrix_file '
568+
'or uses_qform arguments to run')
564569
skip.append('save_log')
565570
return super(FLIRT, self)._parse_inputs(skip=skip)
566571

567572
class ApplyXFMInputSpec(FLIRTInputSpec):
568573
apply_xfm = traits.Bool(
569-
True, argstr='-applyxfm', requires=['in_matrix_file'],
570-
desc='apply transformation supplied by in_matrix_file',
574+
True, argstr='-applyxfm',
575+
desc=('apply transformation supplied by in_matrix_file or uses_qform to'
576+
' use the affine matrix stored in the reference header'),
571577
usedefault=True)
572578

573579

0 commit comments

Comments
 (0)