Skip to content

Commit 6cec6be

Browse files
committed
fix: retroicor - cleaned up interface, vim presets
1 parent 5427538 commit 6cec6be

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
3-
# vi: set ft = python sts = 4 ts = 4 sw = 4 et:
3+
# vi: set ft=python sts=4 ts=4 sw=4 et:
44
"""Afni preprocessing interfaces
55
66
Change directory to provide relative paths for doctests
@@ -2385,7 +2385,9 @@ class RetroicorInputSpec(AFNICommandInputSpec):
23852385
mandatory=True,
23862386
exists=True,
23872387
copyfile=False)
2388-
out_file = File(desc='output image file name', argstr='-prefix %s', mandatory=True, position=1)
2388+
out_file = File(name_template='%s_retroicor', name_source=['in_file'],
2389+
desc='output image file name',
2390+
argstr='-prefix %s', position=1)
23892391
card = File(desc='1D cardiac data file for cardiac correction',
23902392
argstr='-card %s',
23912393
position=-2,
@@ -2439,6 +2441,7 @@ class Retroicor(AFNICommand):
24392441
>>> ret.inputs.in_file = 'functional.nii'
24402442
>>> ret.inputs.card = 'mask.1D'
24412443
>>> ret.inputs.resp = 'resp.1D'
2444+
>>> ret.inputs.outputtype = 'NIFTI'
24422445
>>> res = ret.run() # doctest: +SKIP
24432446
"""
24442447

@@ -2447,6 +2450,13 @@ class Retroicor(AFNICommand):
24472450
output_spec = AFNICommandOutputSpec
24482451

24492452

2453+
def _format_arg(self, name, trait_spec, value):
2454+
if name == 'in_file':
2455+
if not isdefined(self.inputs.card) and not isdefined(self.inputs.resp):
2456+
return None
2457+
return super(Retroicor, self)._format_arg(name, trait_spec, value)
2458+
2459+
24502460
class AFNItoNIFTIInputSpec(AFNICommandInputSpec):
24512461
in_file = File(desc='input file to 3dAFNItoNIFTI',
24522462
argstr='%s',

nipype/interfaces/afni/tests/test_auto_Retroicor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def test_Retroicor_inputs():
2828
position=-5,
2929
),
3030
out_file=dict(argstr='-prefix %s',
31-
mandatory=True,
31+
name_source=[u'in_file'],
32+
name_template='%s_retroicor',
3233
position=1,
3334
),
3435
outputtype=dict(),

0 commit comments

Comments
 (0)