Skip to content

[FIX] XFibres5 fails in _list_outputs if n_fibres is undefined #1168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 6, 2015
Merged
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: Bug in XFibres5 (https://github.com/nipy/nipype/pull/1168)
* ENH: Attempt to use hard links for data sink.
(https://github.com/nipy/nipype/pull/1161)
* FIX: Updates to SGE Plugins
Expand Down
13 changes: 8 additions & 5 deletions nipype/interfaces/fsl/dti.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ class FSLXCommandInputSpec(FSLCommandInputSpec):
desc='b values file')

logdir = Directory('.', argstr='--logdir=%s', usedefault=True)
n_fibres = traits.Range(low=1, argstr='--nfibres=%d', desc=('Maximum '
'number of fibres to fit in each voxel'))
n_fibres = traits.Range(
usedefault=True, low=1, default=2, argstr='--nfibres=%d',
desc=('Maximum number of fibres to fit in each voxel'))
model = traits.Enum(1, 2, argstr='--model=%d',
desc=('use monoexponential (1, default, required for '
'single-shell) or multiexponential (2, multi-'
Expand Down Expand Up @@ -200,7 +201,9 @@ def _run_interface(self, runtime):

def _list_outputs(self):
outputs = self.output_spec().get()
out_dir = self._out_dir
n_fibres = 2
if isdefined(self.inputs.n_fibres):
n_fibres = self.inputs.n_fibres

if isdefined(self.inputs.logdir):
out_dir = os.path.abspath(self.inputs.logdir)
Expand All @@ -222,13 +225,13 @@ def _list_outputs(self):
for k in multi_out:
outputs[k] = []

for i in xrange(1, self.inputs.n_fibres + 1):
for i in xrange(1, n_fibres + 1):
outputs['fsamples'].append(self._gen_fname('f%dsamples' % i,
cwd=out_dir))
outputs['mean_fsamples'].append(self._gen_fname(('mean_f%d'
'samples') % i, cwd=out_dir))

for i in xrange(1, self.inputs.n_fibres + 1):
for i in xrange(1, n_fibres + 1):
outputs['dyads'].append(self._gen_fname('dyads%d' % i,
cwd=out_dir))
outputs['phsamples'].append(self._gen_fname('ph%dsamples' % i,
Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/fsl/tests/test_auto_BEDPOSTX5.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_BEDPOSTX5_inputs():
model=dict(argstr='--model=%d',
),
n_fibres=dict(argstr='--nfibres=%d',
usedefault=True,
),
n_jumps=dict(argstr='--njumps=%d',
),
Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/fsl/tests/test_auto_FSLXCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_FSLXCommand_inputs():
model=dict(argstr='--model=%d',
),
n_fibres=dict(argstr='--nfibres=%d',
usedefault=True,
),
n_jumps=dict(argstr='--njumps=%d',
),
Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/fsl/tests/test_auto_XFibres5.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_XFibres5_inputs():
model=dict(argstr='--model=%d',
),
n_fibres=dict(argstr='--nfibres=%d',
usedefault=True,
),
n_jumps=dict(argstr='--njumps=%d',
),
Expand Down