From 567345763960c30f8cf808a5b301129c58a92ffb Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 31 Aug 2015 01:49:06 -0400 Subject: [PATCH 1/2] fix: let spm use base class for version --- nipype/interfaces/freesurfer/tests/test_auto_MRIConvert.py | 1 + nipype/interfaces/spm/preprocess.py | 6 ++++-- nipype/pipeline/utils.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/freesurfer/tests/test_auto_MRIConvert.py b/nipype/interfaces/freesurfer/tests/test_auto_MRIConvert.py index 27263cbd97..37cac9792d 100644 --- a/nipype/interfaces/freesurfer/tests/test_auto_MRIConvert.py +++ b/nipype/interfaces/freesurfer/tests/test_auto_MRIConvert.py @@ -196,3 +196,4 @@ def test_MRIConvert_outputs(): for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value + diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index 133d061a04..2625018f94 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -766,7 +766,8 @@ class Segment(SPMCommand): """ - if Info.version() and Info.version()['name'] == "SPM12": + _local_version = SPMCommand().version + if _local_version and _local_version['name'] == "SPM12": _jobtype = 'tools' _jobname = 'oldseg' else: @@ -893,7 +894,8 @@ class NewSegment(SPMCommand): input_spec = NewSegmentInputSpec output_spec = NewSegmentOutputSpec - if Info.version() and Info.version()['name'] == "SPM12": + _local_version = SPMCommand().version + if _local_version and _local_version['name'] == "SPM12": _jobtype = 'spatial' _jobname = 'preproc' else: diff --git a/nipype/pipeline/utils.py b/nipype/pipeline/utils.py index 27351c8fc5..73f251049a 100644 --- a/nipype/pipeline/utils.py +++ b/nipype/pipeline/utils.py @@ -993,7 +993,7 @@ def clean_working_directory(outputs, cwd, inputs, needed_outputs, config, inputdict = inputs.get() input_files.extend(walk_outputs(inputdict)) needed_files += [path for path, type in input_files if type == 'f'] - for extra in ['_0x*.json', 'provenance.*', 'pyscript*.m', + for extra in ['_0x*.json', 'provenance.*', 'pyscript*.m', 'pyjobs*.mat', 'command.txt', 'result*.pklz', '_inputs.pklz', '_node.pklz']: needed_files.extend(glob(os.path.join(cwd, extra))) if files2keep: From 4bde53ccbdf6ef2af90e30112a9cede74eb7b337 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Tue, 8 Sep 2015 23:34:34 -0400 Subject: [PATCH 2/2] fix: spm version check --- nipype/interfaces/spm/preprocess.py | 4 ++-- nipype/interfaces/spm/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index 2625018f94..9f7949cf67 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -767,7 +767,7 @@ class Segment(SPMCommand): """ _local_version = SPMCommand().version - if _local_version and _local_version['name'] == "SPM12": + if _local_version and '12.' in _local_version: _jobtype = 'tools' _jobname = 'oldseg' else: @@ -895,7 +895,7 @@ class NewSegment(SPMCommand): input_spec = NewSegmentInputSpec output_spec = NewSegmentOutputSpec _local_version = SPMCommand().version - if _local_version and _local_version['name'] == "SPM12": + if _local_version and '12.' in _local_version: _jobtype = 'spatial' _jobname = 'preproc' else: diff --git a/nipype/interfaces/spm/utils.py b/nipype/interfaces/spm/utils.py index f2d136b2b9..2cab617a74 100644 --- a/nipype/interfaces/spm/utils.py +++ b/nipype/interfaces/spm/utils.py @@ -450,7 +450,7 @@ def _list_outputs(self): from glob import glob outputs = self._outputs().get() od = os.path.abspath(self.inputs.output_dir) - + ext = self.inputs.format if self.inputs.output_dir_struct == "flat": outputs['out_files'] = glob(os.path.join(od, '*.%s'%ext))