From 07f460168cdc52ca309cd7826e35ec416be05212 Mon Sep 17 00:00:00 2001 From: Matthieu Joulot <85217698+MatthieuJoulot@users.noreply.github.com> Date: Wed, 28 Sep 2022 09:19:02 +0200 Subject: [PATCH 1/3] Fix non mandatory output issue in DWIBiasCorrect The function `_list_outputs` in `DWIBiasCorrect` doesn't take into account the fact that `output_file` is not a mandatory input, thus making any pipeline using this interface without specifying the output crash. --- nipype/interfaces/mrtrix3/preprocess.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index be87930a38..2836e5d5f1 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -256,11 +256,12 @@ def _format_arg(self, name, trait_spec, value): return super()._format_arg(name, trait_spec, value) def _list_outputs(self): - outputs = self.output_spec().get() - outputs["out_file"] = op.abspath(self.inputs.out_file) - if self.inputs.bias: - outputs["bias"] = op.abspath(self.inputs.bias) - return outputs + if self.inputs.out_file: + outputs = self.output_spec().get() + outputs["out_file"] = op.abspath(self.inputs.out_file) + if self.inputs.bias: + outputs["bias"] = op.abspath(self.inputs.bias) + return outputs class DWIPreprocInputSpec(MRTrix3BaseInputSpec): From 4b7993c9c4f8595c2274c8610113fac9a5b2c978 Mon Sep 17 00:00:00 2001 From: Matthieu Joulot <85217698+MatthieuJoulot@users.noreply.github.com> Date: Thu, 29 Sep 2022 09:13:56 +0200 Subject: [PATCH 2/3] Fix indent level --- nipype/interfaces/mrtrix3/preprocess.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 2836e5d5f1..c29e4904a4 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -259,9 +259,9 @@ def _list_outputs(self): if self.inputs.out_file: outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) - if self.inputs.bias: - outputs["bias"] = op.abspath(self.inputs.bias) - return outputs + if self.inputs.bias: + outputs["bias"] = op.abspath(self.inputs.bias) + return outputs class DWIPreprocInputSpec(MRTrix3BaseInputSpec): From ddc81d336b25d6e469a9bb2094f36340c3c6f8d1 Mon Sep 17 00:00:00 2001 From: Matthieu Joulot <85217698+MatthieuJoulot@users.noreply.github.com> Date: Thu, 29 Sep 2022 17:34:42 +0200 Subject: [PATCH 3/3] Update nipype/interfaces/mrtrix3/preprocess.py Co-authored-by: Chris Markiewicz --- nipype/interfaces/mrtrix3/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index c29e4904a4..a097295eea 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -256,8 +256,8 @@ def _format_arg(self, name, trait_spec, value): return super()._format_arg(name, trait_spec, value) def _list_outputs(self): + outputs = self.output_spec().get() if self.inputs.out_file: - outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.bias: outputs["bias"] = op.abspath(self.inputs.bias)