Skip to content

Commit d577f5d

Browse files
committed
Added requirements of interface.
Also replaced the name_source dynamic setting with str instead of lists, as it seems to produce errors when executing as MapNode of workflows.
1 parent 3a82578 commit d577f5d

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

nipype/interfaces/fsl/preprocess.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,11 @@ class FUGUEInputSpec(FSLCommandInputSpec):
11661166
fmap_in_file = File(exists=True, argstr='--loadfmap=%s',
11671167
desc='filename for loading fieldmap (rad/s)')
11681168
unwarped_file = File(argstr='--unwarp=%s', desc='apply unwarping and save as filename',
1169-
xor=['warped_file'])
1169+
xor=['warped_file'], requires=['in_file'])
11701170
warped_file = File(argstr='--warp=%s', desc='apply forward warping and save as filename',
1171-
xor=['unwarped_file'])
1171+
xor=['unwarped_file'], requires=['in_file'])
11721172

1173-
forward_warping = traits.Bool(False, usedefault=True, mandatory=True,
1173+
forward_warping = traits.Bool(False, usedefault=True, mandatory=True, requires=['in_file'],
11741174
desc='apply forward warping instead of unwarping')
11751175

11761176
dwell_to_asym_ratio = traits.Float(argstr='--dwelltoasym=%.10f',
@@ -1315,13 +1315,13 @@ def _parse_inputs(self, skip=None):
13151315
skip += ['unwarped_file']
13161316
trait_spec = self.inputs.trait('warped_file')
13171317
trait_spec.name_template = "%s_warped"
1318-
trait_spec.name_source = ['in_file']
1318+
trait_spec.name_source = 'in_file'
13191319
trait_spec.output_name = 'warped_file'
13201320
else:
13211321
skip += ['warped_file']
13221322
trait_spec = self.inputs.trait('unwarped_file')
13231323
trait_spec.name_template = "%s_unwarped"
1324-
trait_spec.name_source = ['in_file']
1324+
trait_spec.name_source = 'in_file'
13251325
trait_spec.output_name = 'unwarped_file'
13261326

13271327
# Handle shift output
@@ -1339,11 +1339,11 @@ def _parse_inputs(self, skip=None):
13391339
trait_spec.name_template = '%s_vsm'
13401340

13411341
if input_fmap:
1342-
trait_spec.name_source = ['fmap_in_file']
1342+
trait_spec.name_source = 'fmap_in_file'
13431343
elif input_phase:
1344-
trait_spec.name_source = ['phasemap_in_file']
1344+
trait_spec.name_source = 'phasemap_in_file'
13451345
else:
1346-
trait_spec.name_source = ['shift_in_file']
1346+
trait_spec.name_source = 'shift_in_file'
13471347

13481348
# Handle fieldmap output
13491349
fmap_save_masked = isdefined(self.inputs.save_fmap) and self.inputs.save_shift
@@ -1360,11 +1360,11 @@ def _parse_inputs(self, skip=None):
13601360
trait_spec.name_template = '%s_fieldmap'
13611361

13621362
if input_vsm:
1363-
trait_spec.name_source = ['shift_in_file']
1363+
trait_spec.name_source = 'shift_in_file'
13641364
elif input_phase:
1365-
trait_spec.name_source = ['phasemap_in_file']
1365+
trait_spec.name_source = 'phasemap_in_file'
13661366
else:
1367-
trait_spec.name_source = ['fmap_in_file']
1367+
trait_spec.name_source = 'fmap_in_file'
13681368

13691369
return super(FUGUE, self)._parse_inputs(skip=skip)
13701370

nipype/interfaces/fsl/tests/test_auto_FUGUE.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_FUGUE_inputs():
2323
fmap_out_file=dict(argstr='--savefmap=%s',
2424
),
2525
forward_warping=dict(mandatory=True,
26+
requires=['in_file'],
2627
usedefault=True,
2728
),
2829
fourier_order=dict(argstr='--fourier=%d',
@@ -79,9 +80,11 @@ def test_FUGUE_inputs():
7980
unwarp_direction=dict(argstr='--unwarpdir=%s',
8081
),
8182
unwarped_file=dict(argstr='--unwarp=%s',
83+
requires=['in_file'],
8284
xor=['warped_file'],
8385
),
8486
warped_file=dict(argstr='--warp=%s',
87+
requires=['in_file'],
8588
xor=['unwarped_file'],
8689
),
8790
)

0 commit comments

Comments
 (0)