From 014df52c29752f310724568054b3e20392e0ea4a Mon Sep 17 00:00:00 2001 From: leeron Date: Wed, 18 May 2016 15:37:13 +0300 Subject: [PATCH] spm coreg fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit spm.interface.preprocess.Coregister’s _format_arg function was creating incorrect input parameters resulting in an infinite loop. "estwrite" was not taken into account and Input parameter "target" should be called with default keep4d=False in order to appropriately create the "ref" parameter for MATLAB. --- nipype/interfaces/spm/preprocess.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index c1af8d025c..14734e7548 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -322,18 +322,17 @@ class Coregister(SPMCommand): def _format_arg(self, opt, spec, val): """Convert input to appropriate format for spm """ - if opt == 'target' or (opt == 'source' and self.inputs.jobtype != "write"): - return scans_for_fnames(filename_to_list(val), - keep4d=True) + if opt == 'target' or (opt == 'source' and "write" not in self.inputs.jobtype): + return scans_for_fnames(filename_to_list(val)) if opt == 'apply_to_files': - return np.array(filename_to_list(val), dtype=object) - if opt == 'source' and self.inputs.jobtype == "write": + return scans_for_fnames(filename_to_list(val)) + if opt == 'source' and "write" in self.inputs.jobtype: if isdefined(self.inputs.apply_to_files): return scans_for_fnames(val + self.inputs.apply_to_files) else: return scans_for_fnames(val) return super(Coregister, self)._format_arg(opt, spec, val) - + def _parse_inputs(self): """validate spm coregister options if set to None ignore """