Skip to content

Commit 234893e

Browse files
committed
fix afni.allineate interface
1 parent 27b33ef commit 234893e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ class AllineateInputSpec(AFNICommandInputSpec):
219219
desc='output file from 3dAllineate',
220220
argstr='-prefix %s',
221221
genfile=True,
222+
hash_files=False,
222223
xor=['allcostx'])
223224
out_param_file = File(
224225
argstr='-1Dparam_save %s',
@@ -485,25 +486,30 @@ def _format_arg(self, name, trait_spec, value):
485486
return arg
486487
return super(Allineate, self)._format_arg(name, trait_spec, value)
487488

489+
def _gen_outfilename(self):
490+
out_file = self.inputs.out_file
491+
if not isdefined(out_file) and isdefined(self.inputs.in_file) and not isdefined(self.inputs.allcostx):
492+
out_file = op.abspath(self._gen_fname(self.inputs.in_file,op.dirname(self.inputs.in_file),suffix='_allineate'))
493+
return out_file
494+
488495
def _list_outputs(self):
489496
outputs = self.output_spec().get()
490497

491-
if self.inputs.out_file:
492-
outputs['out_file'] = op.abspath(self.inputs.out_file)
498+
outputs['out_file'] = self._gen_outfilename()
493499

494-
if self.inputs.out_weight_file:
500+
if isdefined(self.inputs.out_weight_file):
495501
outputs['out_weight_file'] = op.abspath(
496502
self.inputs.out_weight_file)
497503

498-
if self.inputs.out_matrix:
504+
if isdefined(self.inputs.out_matrix):
499505
path, base, ext = split_filename(self.inputs.out_matrix)
500506
if ext.lower() not in ['.1d', '.1D']:
501507
outputs['out_matrix'] = self._gen_fname(
502508
self.inputs.out_matrix, suffix='.aff12.1D')
503509
else:
504510
outputs['out_matrix'] = op.abspath(self.inputs.out_matrix)
505511

506-
if self.inputs.out_param_file:
512+
if isdefined(self.inputs.out_param_file):
507513
path, base, ext = split_filename(self.inputs.out_param_file)
508514
if ext.lower() not in ['.1d', '.1D']:
509515
outputs['out_param_file'] = self._gen_fname(
@@ -519,7 +525,7 @@ def _list_outputs(self):
519525

520526
def _gen_filename(self, name):
521527
if name == 'out_file':
522-
return self._list_outputs()[name]
528+
return self._gen_outfilename()
523529
return None
524530

525531

0 commit comments

Comments
 (0)