Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next Release
============

* FIX: FUGUE interface was adding wrong parameter in forward warping mode.
* 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``).
* ENH: New ANTs interface: ApplyTransformsToPoints
* ENH: New FreeSurfer workflow: create_skullstripped_recon_flow()
Expand Down
41 changes: 27 additions & 14 deletions nipype/interfaces/fsl/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,17 @@ def _list_outputs(self):
'_variance.ext', cwd=cwd)
outputs['std_img'] = self._gen_fname(outputs['out_file'] +
'_sigma.ext', cwd=cwd)

# The mean image created if -stats option is specified ('meanvol')
# is missing the top and bottom slices. Therefore we only expose the
# mean image created by -meanvol option ('mean_reg') which isn't
# is missing the top and bottom slices. Therefore we only expose the
# mean image created by -meanvol option ('mean_reg') which isn't
# corrupted.
# Note that the same problem holds for the std and variance image.

if isdefined(self.inputs.mean_vol) and self.inputs.mean_vol:
outputs['mean_img'] = self._gen_fname(outputs['out_file'] +
'_mean_reg.ext', cwd=cwd)

if isdefined(self.inputs.save_mats) and self.inputs.save_mats:
_, filename = os.path.split(outputs['out_file'])
matpathname = os.path.join(cwd, filename + '.mat')
Expand Down Expand Up @@ -1159,9 +1159,8 @@ def _gen_filename(self, name):
class FUGUEInputSpec(FSLCommandInputSpec):
in_file = File(exists=True, argstr='--in=%s',
desc='filename of input volume')
unwarped_file = File(
argstr='--unwarp=%s', genfile=True,
desc='apply unwarping and save as filename', hash_files=False)
unwarped_file = File(argstr='--unwarp=%s', desc='apply unwarping and save as filename',
hash_files=False)
forward_warping = traits.Bool(
False, usedefault=True,
desc='apply forward warping instead of unwarping')
Expand Down Expand Up @@ -1242,7 +1241,16 @@ class FUGUE(FSLCommand):
Examples
--------

Please insert examples for use of this command
>>> from nipype.interfaces.fsl.preprocess import FUGUE
>>> fugue = FUGUE()
>>> fugue.inputs.forward_warping = True
>>> fugue.inputs.in_file = 'epi.nii'
>>> fugue.inputs.mask_file = 'epi_mask.nii'
>>> fugue.inputs.shift_in_file = 'image.nii' # Previously computed with fugue as well
>>> fugue.inputs.unwarp_direction = 'y'
>>> fugue.cmdline #doctest: +ELLIPSIS
'fugue --in=epi.nii --mask=epi_mask.nii --loadshift=image.nii --unwarpdir=y --warp=.../epi_warped.nii.gz'
>>> fugue.run() #doctest: +SKIP

"""

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

def _list_outputs(self):
outputs = self._outputs().get()
if self.inputs.forward_warping:

if isdefined(self.inputs.forward_warping) and self.inputs.forward_warping:
out_field = 'warped_file'
self.inputs.unwarped_file = Undefined
outputs.pop('unwarped_file')
else:
out_field = 'unwarped_file'
outputs.pop('warped_file')

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

def _gen_filename(self, name):
if name == 'unwarped_file' and not self.inputs.forward_warping:
return self._list_outputs()['unwarped_file']
if name == 'warped_file' and self.inputs.forward_warping:
return self._list_outputs()['warped_file']
is_fwd = isdefined(self.inputs.forward_warping) and self.inputs.forward_warping

if (is_fwd and name=='warped_file') or (not is_fwd and name=='unwarped_file'):
return self._list_outputs()[name]

return None

def _parse_inputs(self, skip=None):
Expand Down
1 change: 0 additions & 1 deletion nipype/interfaces/fsl/tests/test_auto_FUGUE.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_FUGUE_inputs():
unwarp_direction=dict(argstr='--unwarpdir=%s',
),
unwarped_file=dict(argstr='--unwarp=%s',
genfile=True,
hash_files=False,
),
warped_file=dict(argstr='--warp=%s',
Expand Down