Skip to content

Commit e345922

Browse files
committed
fix error when n_fibres is not set
1 parent f540db9 commit e345922

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

nipype/interfaces/fsl/dti.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ class FSLXCommandInputSpec(FSLCommandInputSpec):
111111
desc='b values file')
112112

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

201202
def _list_outputs(self):
202203
outputs = self.output_spec().get()
203-
out_dir = self._out_dir
204+
n_fibres = 2
205+
if isdefined(self.inputs.n_fibres):
206+
n_fibres = self.inputs.n_fibres
204207

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

225-
for i in xrange(1, self.inputs.n_fibres + 1):
228+
for i in xrange(1, n_fibres + 1):
226229
outputs['fsamples'].append(self._gen_fname('f%dsamples' % i,
227230
cwd=out_dir))
228231
outputs['mean_fsamples'].append(self._gen_fname(('mean_f%d'
229232
'samples') % i, cwd=out_dir))
230233

231-
for i in xrange(1, self.inputs.n_fibres + 1):
234+
for i in xrange(1, n_fibres + 1):
232235
outputs['dyads'].append(self._gen_fname('dyads%d' % i,
233236
cwd=out_dir))
234237
outputs['phsamples'].append(self._gen_fname('ph%dsamples' % i,

0 commit comments

Comments
 (0)