Skip to content

Commit e954f72

Browse files
committed
normalize can take a list of lists of files as input.
1 parent 29895bd commit e954f72

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

nipype/interfaces/spm/preprocess.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,11 @@ class NormalizeInputSpec(SPMCommandInputSpec):
372372
jobtype = traits.Enum('estwrite', 'est', 'write',
373373
desc='one of: est, write, estwrite (opt, estwrite)',
374374
usedefault=True)
375-
apply_to_files = InputMultiPath(File(exists=True), field='subj.resample',
376-
desc='files to apply transformation to (opt)', copyfile=True)
375+
apply_to_files = InputMultiPath(traits.Either(File(exists=True),
376+
traits.List(File(exists=True))),
377+
field='subj.resample',
378+
desc='files to apply transformation to (opt)',
379+
copyfile=True)
377380
parameter_file = File(field='subj.matname', mandatory=True,
378381
xor=['source', 'template'],
379382
desc='normalization parameter file*_sn.mat', copyfile=False)
@@ -486,9 +489,13 @@ def _list_outputs(self):
486489
elif 'write' in self.inputs.jobtype:
487490
outputs['normalized_files'] = []
488491
if isdefined(self.inputs.apply_to_files):
489-
for imgf in filename_to_list(self.inputs.apply_to_files):
490-
outputs['normalized_files'].append(fname_presuffix(imgf, prefix=self.inputs.out_prefix))
491-
492+
filelist = filename_to_list(self.inputs.apply_to_files)
493+
for f in filelist:
494+
if isinstance(f, list):
495+
run = [fname_presuffix(in_f, prefix=self.inputs.out_prefix) for in_f in f]
496+
else:
497+
run = [fname_presuffix(f, prefix=self.inputs.out_prefix)]
498+
outputs['normalized_files'].extend(run)
492499
if isdefined(self.inputs.source):
493500
outputs['normalized_source'] = []
494501
for imgf in filename_to_list(self.inputs.source):

0 commit comments

Comments
 (0)