From a5b5aab6ee6e7da281e1c03c0ba369e54a71aed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20F=C3=B6rster?= Date: Wed, 24 Oct 2018 14:55:03 +0200 Subject: [PATCH 1/2] Add new parameters 'cnr_maps' and 'residuals' to FSL eddy interface --- nipype/interfaces/fsl/epi.py | 16 ++++++++++++++++ nipype/interfaces/fsl/tests/test_auto_Eddy.py | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/nipype/interfaces/fsl/epi.py b/nipype/interfaces/fsl/epi.py index 84bd9e8dba..64e6dbb001 100644 --- a/nipype/interfaces/fsl/epi.py +++ b/nipype/interfaces/fsl/epi.py @@ -659,6 +659,8 @@ class EddyInputSpec(FSLCommandInputSpec): "the field specified by --field and first volume " "in file --imain") use_cuda = traits.Bool(False, desc="Run eddy using cuda gpu") + cnr_maps = traits.Bool(False, desc='Output CNR-Maps', argstr='--cnr_maps') + residuals = traits.Bool(False, desc='Output Residuals', argstr='--residuals') class EddyOutputSpec(TraitedSpec): @@ -685,6 +687,10 @@ class EddyOutputSpec(TraitedSpec): exists=True, desc=('Text-file with a plain language report on what ' 'outlier slices eddy has found')) + out_cnr_maps = File( + exists=True, desc='path/name of file with the cnr_maps') + out_residuals = File( + exists=True, desc='path/name of file with the residuals') class Eddy(FSLCommand): @@ -787,6 +793,16 @@ def _list_outputs(self): self.inputs.out_base) out_outlier_report = os.path.abspath( '%s.eddy_outlier_report' % self.inputs.out_base) + if isdefined(self.inputs.cnr_maps) and self.inputs.cnr_maps: + out_cnr_maps = os.path.abspath( + '%s.eddy_cnr_maps.nii.gz' % self.inputs.out_base) + if os.path.exists(out_cnr_maps): + outputs['out_cnr_maps'] = out_cnr_maps + if isdefined(self.inputs.residuals) and self.inputs.residuals: + out_residuals = os.path.abspath( + '%s.eddy_residuals.nii.gz' % self.inputs.out_base) + if os.path.exists(out_residuals): + outputs['out_residuals'] = out_residuals if os.path.exists(out_rotated_bvecs): outputs['out_rotated_bvecs'] = out_rotated_bvecs diff --git a/nipype/interfaces/fsl/tests/test_auto_Eddy.py b/nipype/interfaces/fsl/tests/test_auto_Eddy.py index 1e3cdf644d..6b150ad640 100644 --- a/nipype/interfaces/fsl/tests/test_auto_Eddy.py +++ b/nipype/interfaces/fsl/tests/test_auto_Eddy.py @@ -74,6 +74,8 @@ def test_Eddy_inputs(): session=dict(argstr='--session=%s', ), slm=dict(argstr='--slm=%s', ), use_cuda=dict(), + cnr_maps=dict(argstr='--cnr_maps', ), + residuals=dict(argstr='--residuals', ), ) inputs = Eddy.input_spec() @@ -89,6 +91,8 @@ def test_Eddy_outputs(): out_restricted_movement_rms=dict(), out_rotated_bvecs=dict(), out_shell_alignment_parameters=dict(), + out_cnr_maps=dict(), + out_residuals=dict(), ) outputs = Eddy.output_spec() From 91ba89464ad6d928e877d58fb9d1176ebf8fa1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20F=C3=B6rster?= Date: Mon, 10 Dec 2018 14:11:54 +0100 Subject: [PATCH 2/2] Add min_ver flag to the new eddy input-traits --- nipype/interfaces/fsl/epi.py | 6 ++++-- nipype/interfaces/fsl/tests/test_auto_Eddy.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nipype/interfaces/fsl/epi.py b/nipype/interfaces/fsl/epi.py index 64e6dbb001..a13da0e0dc 100644 --- a/nipype/interfaces/fsl/epi.py +++ b/nipype/interfaces/fsl/epi.py @@ -659,8 +659,10 @@ class EddyInputSpec(FSLCommandInputSpec): "the field specified by --field and first volume " "in file --imain") use_cuda = traits.Bool(False, desc="Run eddy using cuda gpu") - cnr_maps = traits.Bool(False, desc='Output CNR-Maps', argstr='--cnr_maps') - residuals = traits.Bool(False, desc='Output Residuals', argstr='--residuals') + cnr_maps = traits.Bool( + False, desc='Output CNR-Maps', argstr='--cnr_maps', min_ver='5.0.10') + residuals = traits.Bool( + False, desc='Output Residuals', argstr='--residuals', min_ver='5.0.10') class EddyOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/fsl/tests/test_auto_Eddy.py b/nipype/interfaces/fsl/tests/test_auto_Eddy.py index 6b150ad640..c3cebf6937 100644 --- a/nipype/interfaces/fsl/tests/test_auto_Eddy.py +++ b/nipype/interfaces/fsl/tests/test_auto_Eddy.py @@ -74,8 +74,8 @@ def test_Eddy_inputs(): session=dict(argstr='--session=%s', ), slm=dict(argstr='--slm=%s', ), use_cuda=dict(), - cnr_maps=dict(argstr='--cnr_maps', ), - residuals=dict(argstr='--residuals', ), + cnr_maps=dict(argstr='--cnr_maps', min_ver='5.0.10', ), + residuals=dict(argstr='--residuals', min_ver='5.0.10', ), ) inputs = Eddy.input_spec()