From 5d1c1e9cbd4021d026b91a03cf7c70553db46d94 Mon Sep 17 00:00:00 2001 From: Hershkovitz-hub Date: Thu, 10 Sep 2020 19:10:09 +0300 Subject: [PATCH 1/8] Removed "-" from algorithm specification Resolves #3247 . --- nipype/interfaces/mrtrix3/preprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 9384ef43c7..832d3256ac 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -181,13 +181,13 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): ) in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") use_ants = traits.Bool( - argstr="-ants", + argstr="ants", mandatory=True, desc="use ANTS N4 to estimate the inhomogeneity field", xor=["use_fsl"], ) use_fsl = traits.Bool( - argstr="-fsl", + argstr="fsl", mandatory=True, desc="use FSL FAST to estimate the inhomogeneity field", xor=["use_ants"], From 42544d05d6753589f4dd8f59d54525a135976297 Mon Sep 17 00:00:00 2001 From: Hershkovitz-hub Date: Thu, 10 Sep 2020 19:17:43 +0300 Subject: [PATCH 2/8] Update .zenodo.json --- .zenodo.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.zenodo.json b/.zenodo.json index 7324bd942c..d59c95370b 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -697,6 +697,10 @@ "affiliation": "Sagol School of Neuroscience, Tel Aviv University", "name": "Baratz, Zvi" }, + { + "affiliation": "Sagol School of Neuroscience, Tel Aviv University", + "name": "Ben-Zvi,Gal" + }, { "name": "Matsubara, K" }, From 0021bd3e7945975f73c019416371f87002a53e9a Mon Sep 17 00:00:00 2001 From: Gal Ben-Zvi Date: Mon, 26 Oct 2020 11:59:25 +0200 Subject: [PATCH 3/8] Update nipype/interfaces/mrtrix3/preprocess.py Co-authored-by: Chris Markiewicz --- nipype/interfaces/mrtrix3/preprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 832d3256ac..e0ed0b9be3 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -184,6 +184,7 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): argstr="ants", mandatory=True, desc="use ANTS N4 to estimate the inhomogeneity field", + position=0, xor=["use_fsl"], ) use_fsl = traits.Bool( From 524482e9908f876ce3dff18bfb42d3653ec892c9 Mon Sep 17 00:00:00 2001 From: Gal Ben-Zvi Date: Mon, 26 Oct 2020 11:59:36 +0200 Subject: [PATCH 4/8] Update nipype/interfaces/mrtrix3/preprocess.py Co-authored-by: Chris Markiewicz --- nipype/interfaces/mrtrix3/preprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index e0ed0b9be3..cc34557420 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -191,6 +191,7 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): argstr="fsl", mandatory=True, desc="use FSL FAST to estimate the inhomogeneity field", + position=0, xor=["use_ants"], ) bias = File(argstr="-bias %s", desc="bias field") From 613d647e49b2832b38f7cc8c6d90e533a39b36e6 Mon Sep 17 00:00:00 2001 From: Gal Ben-Zvi Date: Mon, 26 Oct 2020 11:59:44 +0200 Subject: [PATCH 5/8] Update .zenodo.json Co-authored-by: Chris Markiewicz --- .zenodo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index d59c95370b..06ed334796 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -699,7 +699,7 @@ }, { "affiliation": "Sagol School of Neuroscience, Tel Aviv University", - "name": "Ben-Zvi,Gal" + "name": "Ben-Zvi, Gal" }, { "name": "Matsubara, K" From a8a4c7fcb3a851f5a6554c9e6480993d54eaf6a0 Mon Sep 17 00:00:00 2001 From: Gal Ben-Zvi Date: Mon, 26 Oct 2020 12:07:01 +0200 Subject: [PATCH 6/8] Edited file according to Chris's requests --- nipype/interfaces/mrtrix3/preprocess.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index cc34557420..2af0fec354 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -226,14 +226,20 @@ class DWIBiasCorrect(MRTrix3Base): >>> bias_correct.inputs.in_file = 'dwi.mif' >>> bias_correct.inputs.use_ants = True >>> bias_correct.cmdline - 'dwibiascorrect -ants dwi.mif dwi_biascorr.mif' + 'dwibiascorrect ants dwi.mif dwi_biascorr.mif' >>> bias_correct.run() # doctest: +SKIP """ _cmd = "dwibiascorrect" input_spec = DWIBiasCorrectInputSpec output_spec = DWIBiasCorrectOutputSpec - + def _format_arg(self, name, trait_spec, value): + if name in ("use_ants", "use_fsl"): + ver = self.version + # Changed in version 3.0, after release candidates + if ver is not None and (ver[0] < "3" or ver.startswith("3.0_RC")): + return f"-{trait_spec.argstr}" + super()._format_arg(name, trait_spec, value) class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum( From 5ddcc0d6821811b3626c39bea67fdc552b013a4f Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 27 Oct 2020 08:35:10 -0400 Subject: [PATCH 7/8] Update nipype/interfaces/mrtrix3/preprocess.py --- 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 2af0fec354..aa3347c7f9 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -239,7 +239,7 @@ def _format_arg(self, name, trait_spec, value): # Changed in version 3.0, after release candidates if ver is not None and (ver[0] < "3" or ver.startswith("3.0_RC")): return f"-{trait_spec.argstr}" - super()._format_arg(name, trait_spec, value) + return super()._format_arg(name, trait_spec, value) class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum( From 73e98d2e97cc0f860aef2eee14e8aaeb14077398 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sun, 8 Nov 2020 09:00:09 -0500 Subject: [PATCH 8/8] TEST: make specs --- .../mrtrix3/tests/test_auto_DWIBiasCorrect.py | 78 +++++++++++++++---- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIBiasCorrect.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIBiasCorrect.py index 210b39b141..0028748ab9 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIBiasCorrect.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIBiasCorrect.py @@ -4,17 +4,50 @@ def test_DWIBiasCorrect_inputs(): input_map = dict( - args=dict(argstr="%s",), - bias=dict(argstr="-bias %s", extensions=None,), - bval_scale=dict(argstr="-bvalue_scaling %s",), - environ=dict(nohash=True, usedefault=True,), - grad_file=dict(argstr="-grad %s", extensions=None, xor=["grad_fsl"],), - grad_fsl=dict(argstr="-fslgrad %s %s", xor=["grad_file"],), - in_bval=dict(extensions=None,), - in_bvec=dict(argstr="-fslgrad %s %s", extensions=None,), - in_file=dict(argstr="%s", extensions=None, mandatory=True, position=-2,), - in_mask=dict(argstr="-mask %s", extensions=None,), - nthreads=dict(argstr="-nthreads %d", nohash=True,), + args=dict( + argstr="%s", + ), + bias=dict( + argstr="-bias %s", + extensions=None, + ), + bval_scale=dict( + argstr="-bvalue_scaling %s", + ), + environ=dict( + nohash=True, + usedefault=True, + ), + grad_file=dict( + argstr="-grad %s", + extensions=None, + xor=["grad_fsl"], + ), + grad_fsl=dict( + argstr="-fslgrad %s %s", + xor=["grad_file"], + ), + in_bval=dict( + extensions=None, + ), + in_bvec=dict( + argstr="-fslgrad %s %s", + extensions=None, + ), + in_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=-2, + ), + in_mask=dict( + argstr="-mask %s", + extensions=None, + ), + nthreads=dict( + argstr="-nthreads %d", + nohash=True, + ), out_file=dict( argstr="%s", extensions=None, @@ -24,8 +57,18 @@ def test_DWIBiasCorrect_inputs(): name_template="%s_biascorr", position=-1, ), - use_ants=dict(argstr="-ants", mandatory=True, xor=["use_fsl"],), - use_fsl=dict(argstr="-fsl", mandatory=True, xor=["use_ants"],), + use_ants=dict( + argstr="ants", + mandatory=True, + position=0, + xor=["use_fsl"], + ), + use_fsl=dict( + argstr="fsl", + mandatory=True, + position=0, + xor=["use_ants"], + ), ) inputs = DWIBiasCorrect.input_spec() @@ -35,7 +78,14 @@ def test_DWIBiasCorrect_inputs(): def test_DWIBiasCorrect_outputs(): - output_map = dict(bias=dict(extensions=None,), out_file=dict(extensions=None,),) + output_map = dict( + bias=dict( + extensions=None, + ), + out_file=dict( + extensions=None, + ), + ) outputs = DWIBiasCorrect.output_spec() for key, metadata in list(output_map.items()):