Skip to content

Commit 39bfb99

Browse files
committed
Merge branch 'fix/FugueInterface' into bug/fixFUGUEsettings
2 parents 0998e5e + f46fb75 commit 39bfb99

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Next Release
22
============
33

4+
* FIX: FUGUE interface was adding wrong parameter in forward warping mode.
45
* API: Interfaces to external packages are no longer available in the top-level ``nipype`` namespace, and must be imported directly (e.g. ``from nipype.interfaces import fsl``).
56
* ENH: New ANTs interface: ApplyTransformsToPoints
67
* ENH: New FreeSurfer workflow: create_skullstripped_recon_flow()

nipype/interfaces/fsl/preprocess.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,9 +1159,8 @@ def _gen_filename(self, name):
11591159
class FUGUEInputSpec(FSLCommandInputSpec):
11601160
in_file = File(exists=True, argstr='--in=%s',
11611161
desc='filename of input volume')
1162-
unwarped_file = File(
1163-
argstr='--unwarp=%s', genfile=True,
1164-
desc='apply unwarping and save as filename', hash_files=False)
1162+
unwarped_file = File(argstr='--unwarp=%s', desc='apply unwarping and save as filename',
1163+
hash_files=False)
11651164
forward_warping = traits.Bool(
11661165
False, usedefault=True,
11671166
desc='apply forward warping instead of unwarping')
@@ -1242,7 +1241,16 @@ class FUGUE(FSLCommand):
12421241
Examples
12431242
--------
12441243
1245-
Please insert examples for use of this command
1244+
>>> from nipype.interfaces.fsl.preprocess import FUGUE
1245+
>>> fugue = FUGUE()
1246+
>>> fugue.inputs.forward_warping = True
1247+
>>> fugue.inputs.in_file = 'epi.nii'
1248+
>>> fugue.inputs.mask_file = 'epi_mask.nii'
1249+
>>> fugue.inputs.shift_in_file = 'image.nii' # Previously computed with fugue as well
1250+
>>> fugue.inputs.unwarp_direction = 'y'
1251+
>>> fugue.cmdline #doctest: +ELLIPSIS
1252+
'fugue --in=epi.nii --mask=epi_mask.nii --loadshift=image.nii --unwarpdir=y --warp=.../epi_warped.nii.gz'
1253+
>>> fugue.run() #doctest: +SKIP
12461254
12471255
"""
12481256

@@ -1257,10 +1265,14 @@ def __init__(self, **kwargs):
12571265

12581266
def _list_outputs(self):
12591267
outputs = self._outputs().get()
1260-
if self.inputs.forward_warping:
1268+
1269+
if isdefined(self.inputs.forward_warping) and self.inputs.forward_warping:
12611270
out_field = 'warped_file'
1271+
self.inputs.unwarped_file = Undefined
1272+
outputs.pop('unwarped_file')
12621273
else:
12631274
out_field = 'unwarped_file'
1275+
outputs.pop('warped_file')
12641276

12651277
out_file = getattr(self.inputs, out_field)
12661278
if not isdefined(out_file):
@@ -1279,10 +1291,11 @@ def _list_outputs(self):
12791291
return outputs
12801292

12811293
def _gen_filename(self, name):
1282-
if name == 'unwarped_file' and not self.inputs.forward_warping:
1283-
return self._list_outputs()['unwarped_file']
1284-
if name == 'warped_file' and self.inputs.forward_warping:
1285-
return self._list_outputs()['warped_file']
1294+
is_fwd = isdefined(self.inputs.forward_warping) and self.inputs.forward_warping
1295+
1296+
if (is_fwd and name=='warped_file') or (not is_fwd and name=='unwarped_file'):
1297+
return self._list_outputs()[name]
1298+
12861299
return None
12871300

12881301
def _parse_inputs(self, skip=None):

nipype/interfaces/fsl/tests/test_auto_FUGUE.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def test_FUGUE_inputs():
7979
unwarp_direction=dict(argstr='--unwarpdir=%s',
8080
),
8181
unwarped_file=dict(argstr='--unwarp=%s',
82-
genfile=True,
8382
hash_files=False,
8483
),
8584
warped_file=dict(argstr='--warp=%s',

0 commit comments

Comments
 (0)