From 735c712c246323288adb3eb91e081c5a50589bbe Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Wed, 11 May 2022 22:57:16 +0300 Subject: [PATCH 1/9] fixed some bugs in the interface to dwifslpreproc --- nipype/interfaces/mrtrix3/preprocess.py | 110 +++++++++++++++++++----- 1 file changed, 87 insertions(+), 23 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index ef67365f0b..3f26cbeabe 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -5,21 +5,26 @@ import os.path as op from ..base import ( - CommandLineInputSpec, CommandLine, - traits, - TraitedSpec, + CommandLineInputSpec, + Directory, File, - isdefined, - Undefined, InputMultiObject, + TraitedSpec, + Undefined, + isdefined, + traits, ) -from .base import MRTrix3BaseInputSpec, MRTrix3Base +from .base import MRTrix3Base, MRTrix3BaseInputSpec class DWIDenoiseInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image" + exists=True, + argstr="%s", + position=-2, + mandatory=True, + desc="input DWI image", ) mask = File(exists=True, argstr="-mask %s", position=1, desc="mask image") extent = traits.Tuple( @@ -88,7 +93,11 @@ class DWIDenoise(MRTrix3Base): class MRDeGibbsInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image" + exists=True, + argstr="%s", + position=-2, + mandatory=True, + desc="input DWI image", ) axes = traits.ListInt( default_value=[0, 1], @@ -177,9 +186,15 @@ class MRDeGibbs(MRTrix3Base): class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image" + exists=True, + argstr="%s", + position=-2, + mandatory=True, + desc="input DWI image", + ) + in_mask = File( + argstr="-mask %s", desc="input mask image for bias field estimation" ) - in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -245,7 +260,11 @@ def _format_arg(self, name, trait_spec, value): class DWIPreprocInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", position=0, mandatory=True, desc="input DWI image" + exists=True, + argstr="%s", + position=0, + mandatory=True, + desc="input DWI image", ) out_file = File( "preproc.mif", @@ -267,7 +286,7 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec): ) pe_dir = traits.Str( argstr="-pe_dir %s", - mandatory=True, + mandatory=False, desc="Specify the phase encoding direction of the input series, can be a signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS), or NIfTI axis codes (e.g. i-, j, k)", ) ro_time = traits.Float( @@ -283,16 +302,42 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec): argstr="-align_seepi", desc="Achieve alignment between the SE-EPI images used for inhomogeneity field estimation, and the DWIs", ) - eddy_options = traits.Str( - argstr='-eddy_options "%s"', - desc="Manually provide additional command-line options to the eddy command", + json_import = File( + exists=True, + argstr="-json_import %s", + desc="Import image header information from an associated JSON file (may be necessary to determine phase encoding information)", ) topup_options = traits.Str( argstr='-topup_options "%s"', desc="Manually provide additional command-line options to the topup command", ) + eddy_options = traits.Str( + argstr='-eddy_options "%s"', + desc="Manually provide additional command-line options to the eddy command", + ) + eddy_mask = File( + exists=True, + argstr="-eddy_mask %s", + desc="Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask", + ) + eddy_slspec = File( + exists=True, + argstr="-eddy_slspec %s", + desc="Provide a file containing slice groupings for eddy's slice-to-volume registration", + ) + eddyqc_text = Directory( + exists=False, + argstr="-eddyqc_text %s", + desc="Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory", + ) + eddyqc_all = Directory( + exists=False, + argstr="-eddyqc_all %s", + desc="Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory", + ) export_grad_mrtrix = traits.Bool( - argstr="-export_grad_mrtrix", desc="export new gradient files in mrtrix format" + argstr="-export_grad_mrtrix", + desc="export new gradient files in mrtrix format", ) export_grad_fsl = traits.Bool( argstr="-export_grad_fsl", desc="export gradient files in FSL format" @@ -367,7 +412,9 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) + outputs["out_grad_mrtrix"] = op.abspath( + self.inputs.out_grad_mrtrix + ) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -387,7 +434,11 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): desc="response estimation algorithm (multi-tissue)", ) in_file = File( - exists=True, argstr="%s", position=-5, mandatory=True, desc="input DWI image" + exists=True, + argstr="%s", + position=-5, + mandatory=True, + desc="input DWI image", ) mtt_file = File(argstr="%s", position=-4, desc="input 5tt image") wm_file = File( @@ -397,9 +448,15 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File(argstr="%s", position=-2, desc="output GM response text file") - csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") - in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") + gm_file = File( + argstr="%s", position=-2, desc="output GM response text file" + ) + csf_file = File( + argstr="%s", position=-1, desc="output CSF response text file" + ) + in_mask = File( + exists=True, argstr="-mask %s", desc="provide initial mask image" + ) max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", @@ -511,10 +568,17 @@ class ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec): desc="input anatomical image", ) in_t1w = File( - exists=True, argstr="%s", mandatory=True, position=-3, desc="input T1 image" + exists=True, + argstr="%s", + mandatory=True, + position=-3, + desc="input T1 image", ) in_config = File( - exists=True, argstr="%s", position=-2, desc="connectome configuration file" + exists=True, + argstr="%s", + position=-2, + desc="connectome configuration file", ) out_file = File( From 411e57791f54a764d6315c68f358f03c737d2a4a Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Wed, 11 May 2022 23:09:54 +0300 Subject: [PATCH 2/9] updated my ORCID in zenodo --- .zenodo.json | 9 +++------ .../mrtrix3/tests/test_auto_DWIPreproc.py | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index d7cacccedd..9a5cdc68cc 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -540,7 +540,8 @@ }, { "affiliation": "Sagol School of Neuroscience, Tel Aviv University", - "name": "Ben-Zvi, Gal" + "name": "Ben-Zvi, Gal", + "orcid": "0000-0002-5655-9423" }, { "affiliation": "University of Newcastle, Australia", @@ -891,11 +892,7 @@ "orcid": "0000-0002-5312-6729" } ], - "keywords": [ - "neuroimaging", - "workflow", - "pipeline" - ], + "keywords": ["neuroimaging", "workflow", "pipeline"], "license": "Apache-2.0", "upload_type": "software" } diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py index bc53d67b4b..bec19d11cc 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py @@ -13,9 +13,23 @@ def test_DWIPreproc_inputs(): bval_scale=dict( argstr="-bvalue_scaling %s", ), + eddy_mask=dict( + argstr="-eddy_mask %s", + extensions=None, + ), eddy_options=dict( argstr='-eddy_options "%s"', ), + eddy_slspec=dict( + argstr="-eddy_slspec %s", + extensions=None, + ), + eddyqc_all=dict( + argstr="-eddyqc_all %s", + ), + eddyqc_text=dict( + argstr="-eddyqc_text %s", + ), environ=dict( nohash=True, usedefault=True, @@ -52,6 +66,10 @@ def test_DWIPreproc_inputs(): mandatory=True, position=0, ), + json_import=dict( + argstr="-json_import %s", + extensions=None, + ), nthreads=dict( argstr="-nthreads %d", nohash=True, @@ -82,7 +100,7 @@ def test_DWIPreproc_inputs(): ), pe_dir=dict( argstr="-pe_dir %s", - mandatory=True, + mandatory=False, ), ro_time=dict( argstr="-readout_time %f", From 285f187141801d3b3e847ec7ef57822e056c162c Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Wed, 11 May 2022 23:33:25 +0300 Subject: [PATCH 3/9] reformatted to pass pre-commit hooks --- nipype/interfaces/mrtrix3/preprocess.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 3f26cbeabe..8a42a1ca43 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -192,9 +192,7 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): mandatory=True, desc="input DWI image", ) - in_mask = File( - argstr="-mask %s", desc="input mask image for bias field estimation" - ) + in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -412,9 +410,7 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath( - self.inputs.out_grad_mrtrix - ) + outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -448,15 +444,9 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File( - argstr="%s", position=-2, desc="output GM response text file" - ) - csf_file = File( - argstr="%s", position=-1, desc="output CSF response text file" - ) - in_mask = File( - exists=True, argstr="-mask %s", desc="provide initial mask image" - ) + gm_file = File(argstr="%s", position=-2, desc="output GM response text file") + csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") + in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", From 9d372603aa76811b6cca41217a535eac7d8cdbdc Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Thu, 12 May 2022 19:10:39 +0300 Subject: [PATCH 4/9] removed default values for gradients' files outputs --- nipype/interfaces/mrtrix3/preprocess.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 8a42a1ca43..41133301a7 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -192,7 +192,9 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): mandatory=True, desc="input DWI image", ) - in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") + in_mask = File( + argstr="-mask %s", desc="input mask image for bias field estimation" + ) use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -343,13 +345,12 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec): out_grad_mrtrix = File( "grad.b", argstr="%s", - usedefault=True, requires=["export_grad_mrtrix"], desc="name of new gradient file", ) out_grad_fsl = traits.Tuple( - File("grad.bvecs", usedefault=True, desc="bvecs"), - File("grad.bvals", usedefault=True, desc="bvals"), + File("grad.bvecs", desc="bvecs"), + File("grad.bvals", desc="bvals"), argstr="%s, %s", requires=["export_grad_fsl"], desc="Output (bvecs, bvals) gradients FSL format", @@ -410,7 +411,9 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) + outputs["out_grad_mrtrix"] = op.abspath( + self.inputs.out_grad_mrtrix + ) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -444,9 +447,15 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File(argstr="%s", position=-2, desc="output GM response text file") - csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") - in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") + gm_file = File( + argstr="%s", position=-2, desc="output GM response text file" + ) + csf_file = File( + argstr="%s", position=-1, desc="output CSF response text file" + ) + in_mask = File( + exists=True, argstr="-mask %s", desc="provide initial mask image" + ) max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", From 443f7f44937405f26d8aa5571ec088fa86b70758 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Thu, 12 May 2022 19:19:17 +0300 Subject: [PATCH 5/9] edited pre-existing tests to match the new keyword arguments --- nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py index bec19d11cc..9a0c59ddd0 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py @@ -96,7 +96,6 @@ def test_DWIPreproc_inputs(): argstr="%s", extensions=None, requires=["export_grad_mrtrix"], - usedefault=True, ), pe_dir=dict( argstr="-pe_dir %s", From 9306be7eed03a11e8a8300b2aea4b824fa437675 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Thu, 12 May 2022 19:20:18 +0300 Subject: [PATCH 6/9] reformatted to match project's settings --- nipype/interfaces/mrtrix3/preprocess.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 41133301a7..15808c895e 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -192,9 +192,7 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): mandatory=True, desc="input DWI image", ) - in_mask = File( - argstr="-mask %s", desc="input mask image for bias field estimation" - ) + in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -411,9 +409,7 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath( - self.inputs.out_grad_mrtrix - ) + outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -447,15 +443,9 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File( - argstr="%s", position=-2, desc="output GM response text file" - ) - csf_file = File( - argstr="%s", position=-1, desc="output CSF response text file" - ) - in_mask = File( - exists=True, argstr="-mask %s", desc="provide initial mask image" - ) + gm_file = File(argstr="%s", position=-2, desc="output GM response text file") + csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") + in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", From 87e870463d9f48987931049cbd173384d029c049 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Fri, 13 May 2022 13:32:10 +0300 Subject: [PATCH 7/9] changes dwifslpreproc outputs' configuration and reset tests to match the new one --- nipype/interfaces/mrtrix3/preprocess.py | 37 ++++++++++--------- .../mrtrix3/tests/test_auto_DWIPreproc.py | 12 +----- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 15808c895e..b4b9259927 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -192,7 +192,9 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): mandatory=True, desc="input DWI image", ) - in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") + in_mask = File( + argstr="-mask %s", desc="input mask image for bias field estimation" + ) use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -333,25 +335,16 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec): argstr="-eddyqc_all %s", desc="Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory", ) - export_grad_mrtrix = traits.Bool( - argstr="-export_grad_mrtrix", - desc="export new gradient files in mrtrix format", - ) - export_grad_fsl = traits.Bool( - argstr="-export_grad_fsl", desc="export gradient files in FSL format" - ) out_grad_mrtrix = File( "grad.b", - argstr="%s", - requires=["export_grad_mrtrix"], - desc="name of new gradient file", + argstr="-export_grad_mrtrix %s", + desc="export new gradient files in mrtrix format", ) out_grad_fsl = traits.Tuple( File("grad.bvecs", desc="bvecs"), File("grad.bvals", desc="bvals"), - argstr="%s, %s", - requires=["export_grad_fsl"], - desc="Output (bvecs, bvals) gradients FSL format", + argstr="-export_grad_fsl %s, %s", + desc="export gradient files in FSL format", ) @@ -409,7 +402,9 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) + outputs["out_grad_mrtrix"] = op.abspath( + self.inputs.out_grad_mrtrix + ) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -443,9 +438,15 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File(argstr="%s", position=-2, desc="output GM response text file") - csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") - in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") + gm_file = File( + argstr="%s", position=-2, desc="output GM response text file" + ) + csf_file = File( + argstr="%s", position=-1, desc="output CSF response text file" + ) + in_mask = File( + exists=True, argstr="-mask %s", desc="provide initial mask image" + ) max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py index 9a0c59ddd0..c8604de0fe 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py @@ -34,12 +34,6 @@ def test_DWIPreproc_inputs(): nohash=True, usedefault=True, ), - export_grad_fsl=dict( - argstr="-export_grad_fsl", - ), - export_grad_mrtrix=dict( - argstr="-export_grad_mrtrix", - ), grad_file=dict( argstr="-grad %s", extensions=None, @@ -89,13 +83,11 @@ def test_DWIPreproc_inputs(): usedefault=True, ), out_grad_fsl=dict( - argstr="%s, %s", - requires=["export_grad_fsl"], + argstr="-export_grad_fsl %s, %s", ), out_grad_mrtrix=dict( - argstr="%s", + argstr="-export_grad_mrtrix %s", extensions=None, - requires=["export_grad_mrtrix"], ), pe_dir=dict( argstr="-pe_dir %s", From e726ac4441e6e88586e5e1711d0c4c72b766279a Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Fri, 13 May 2022 13:35:56 +0300 Subject: [PATCH 8/9] updated docstrings to match the new configurations --- nipype/interfaces/mrtrix3/preprocess.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index b4b9259927..df3f968acb 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -192,9 +192,7 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec): mandatory=True, desc="input DWI image", ) - in_mask = File( - argstr="-mask %s", desc="input mask image for bias field estimation" - ) + in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation") use_ants = traits.Bool( argstr="ants", mandatory=True, @@ -386,7 +384,7 @@ class DWIPreproc(MRTrix3Base): >>> preproc.inputs.rpe_options = 'none' >>> preproc.inputs.out_file = "preproc.mif" >>> preproc.inputs.eddy_options = '--slm=linear --repol' # linear second level model and replace outliers - >>> preproc.inputs.export_grad_mrtrix = True # export final gradient table in MRtrix format + >>> preproc.inputs.out_grad_mrtrix = "grad.b" # export final gradient table in MRtrix format >>> preproc.inputs.ro_time = 0.165240 # 'TotalReadoutTime' in BIDS JSON metadata files >>> preproc.inputs.pe_dir = 'j' # 'PhaseEncodingDirection' in BIDS JSON metadata files >>> preproc.cmdline @@ -402,9 +400,7 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) if self.inputs.export_grad_mrtrix: - outputs["out_grad_mrtrix"] = op.abspath( - self.inputs.out_grad_mrtrix - ) + outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix) if self.inputs.export_grad_fsl: outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0]) outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1]) @@ -438,15 +434,9 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): usedefault=True, desc="output WM response text file", ) - gm_file = File( - argstr="%s", position=-2, desc="output GM response text file" - ) - csf_file = File( - argstr="%s", position=-1, desc="output CSF response text file" - ) - in_mask = File( - exists=True, argstr="-mask %s", desc="provide initial mask image" - ) + gm_file = File(argstr="%s", position=-2, desc="output GM response text file") + csf_file = File(argstr="%s", position=-1, desc="output CSF response text file") + in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image") max_sh = InputMultiObject( traits.Int, argstr="-lmax %s", From 4ab9084e2e02928b1623ec5e9e70e794a735c663 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 13 Jul 2022 12:15:22 -0400 Subject: [PATCH 9/9] Apply suggestions from code review --- nipype/interfaces/mrtrix3/preprocess.py | 1 - nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py | 1 - 2 files changed, 2 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index df3f968acb..a39dec40d8 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -284,7 +284,6 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec): ) pe_dir = traits.Str( argstr="-pe_dir %s", - mandatory=False, desc="Specify the phase encoding direction of the input series, can be a signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS), or NIfTI axis codes (e.g. i-, j, k)", ) ro_time = traits.Float( diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py index c8604de0fe..7c0231bd70 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIPreproc.py @@ -91,7 +91,6 @@ def test_DWIPreproc_inputs(): ), pe_dir=dict( argstr="-pe_dir %s", - mandatory=False, ), ro_time=dict( argstr="-readout_time %f",