From 735c712c246323288adb3eb91e081c5a50589bbe Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Wed, 11 May 2022 22:57:16 +0300 Subject: [PATCH 01/20] 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 02/20] 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 03/20] 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 04/20] 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 05/20] 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 06/20] 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 07/20] 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 08/20] 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 09/20] 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", From ff8e514be7f65e62ca4781520e400788de45ca71 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 14 Jul 2022 11:32:36 -0400 Subject: [PATCH 10/20] MNT: 1.8.4.dev0 --- doc/interfaces.rst | 2 +- nipype/info.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/interfaces.rst b/doc/interfaces.rst index bad49381c5..7b74d00d4b 100644 --- a/doc/interfaces.rst +++ b/doc/interfaces.rst @@ -8,7 +8,7 @@ Interfaces and Workflows :Release: |version| :Date: |today| -Previous versions: `1.8.2 `_ `1.8.1 `_ +Previous versions: `1.8.3 `_ `1.8.2 `_ Workflows --------- diff --git a/nipype/info.py b/nipype/info.py index b4f8373a1b..4de8f9ff01 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -5,7 +5,7 @@ # nipype version information # Remove .dev0 for release -__version__ = "1.8.3" +__version__ = "1.8.4.dev0" def get_nipype_gitversion(): From 59833da0ec75c1740efbe7a893c2492161e6345e Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 22 Aug 2022 09:43:51 -0400 Subject: [PATCH 11/20] MNT: Pin traits < 6.4 This basically sets a lifetime on nipype 1.x. Refactoring to work with breaking changes in traits seems more work than it's worth (and would presumably break with older traits). --- nipype/info.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipype/info.py b/nipype/info.py index 4de8f9ff01..bfc4e2f841 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -104,6 +104,7 @@ def get_nipype_gitversion(): NUMPY_MIN_VERSION = "1.17" SCIPY_MIN_VERSION = "0.14" TRAITS_MIN_VERSION = "4.6" +TRAITS_MAX_VERSION = "6.4" DATEUTIL_MIN_VERSION = "2.2" SIMPLEJSON_MIN_VERSION = "3.8.0" PROV_MIN_VERSION = "1.5.2" @@ -143,7 +144,7 @@ def get_nipype_gitversion(): "rdflib>=%s" % RDFLIB_MIN_VERSION, "scipy>=%s" % SCIPY_MIN_VERSION, "simplejson>=%s" % SIMPLEJSON_MIN_VERSION, - "traits>=%s,!=5.0" % TRAITS_MIN_VERSION, + "traits>=%s,<%s,!=5.0" % (TRAITS_MIN_VERSION, TRAITS_MAX_VERSION), "filelock>=3.0.0", "etelemetry>=0.2.0", "looseversion", From f4a1f52629853b69a5456c21027e20ae1aba0089 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 22 Aug 2022 09:50:18 -0400 Subject: [PATCH 12/20] CI: Update build OS, actions --- .github/workflows/contrib.yml | 10 +++++----- .github/workflows/package.yml | 4 ++-- .github/workflows/tests.yml | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml index cb4f9117d6..100c332440 100644 --- a/.github/workflows/contrib.yml +++ b/.github/workflows/contrib.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: ['ubuntu-18.04'] + os: ['ubuntu-latest'] python-version: [3.8] nipype-extras: ['dev'] check: ['specs', 'style'] @@ -38,12 +38,12 @@ jobs: CI_SKIP_TEST: 1 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Display Python version @@ -64,12 +64,12 @@ jobs: - name: Run tests run: tools/ci/check.sh if: ${{ matrix.check != 'skiptests' }} - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 with: file: coverage.xml if: ${{ always() }} - name: Upload pytest test results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }} path: test-results.xml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 92b093468a..2d4d665448 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -26,9 +26,9 @@ jobs: - os: ubuntu-latest python-version: 3.8 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Display Python version diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9252958f2d..65aba65687 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,12 +54,12 @@ jobs: CI_SKIP_TEST: 1 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Display Python version @@ -80,12 +80,12 @@ jobs: - name: Run tests run: tools/ci/check.sh if: ${{ matrix.check != 'skiptests' }} - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 with: file: coverage.xml if: ${{ always() }} - name: Upload pytest test results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }} path: test-results.xml From ac1e2d1faae86590972bf37371f47821bdd15926 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 22 Aug 2022 11:32:07 -0400 Subject: [PATCH 13/20] TEST: Coerce close_up_to_column_sign args to arrays before checking for equality --- nipype/algorithms/tests/test_CompCor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nipype/algorithms/tests/test_CompCor.py b/nipype/algorithms/tests/test_CompCor.py index eeb3ce42db..51b1ea60f7 100644 --- a/nipype/algorithms/tests/test_CompCor.py +++ b/nipype/algorithms/tests/test_CompCor.py @@ -12,6 +12,8 @@ def close_up_to_column_sign(a, b, rtol=1e-05, atol=1e-08, equal_nan=False): """SVD can produce sign flips on a per-column basis.""" + a = np.asanyarray(a) + b = np.asanyarray(b) kwargs = dict(rtol=rtol, atol=atol, equal_nan=equal_nan) if np.allclose(a, b, **kwargs): return True From 5a0d77458611cd60050fd3945a6f558561fd4cee Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:37:51 -0400 Subject: [PATCH 14/20] MAINT: Add `maint` extras for maintainers --- nipype/info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/info.py b/nipype/info.py index bfc4e2f841..a87e77e89b 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -171,6 +171,7 @@ def get_nipype_gitversion(): "sphinxcontrib-apidoc", ], "duecredit": ["duecredit"], + "maint": ["GitPython", "fuzzywuzzy"], "nipy": ["nitime", "nilearn", "dipy", "nipy", "matplotlib"], "profiler": ["psutil>=5.0"], "pybids": ["pybids>=0.7.0"], From 5585b055c79f3ac43f0ec1447e9252dcc51fa208 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:38:15 -0400 Subject: [PATCH 15/20] MAINT: Add script to update mailmap --- tools/update_mailmap.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/update_mailmap.sh diff --git a/tools/update_mailmap.sh b/tools/update_mailmap.sh new file mode 100644 index 0000000000..4602e85e3a --- /dev/null +++ b/tools/update_mailmap.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# usage -> bash update_mailmap.sh +# by default, will use the latest tag + +set -ux + +ROOT=$( git rev-parse --show-toplevel ) +MAILMAP=$ROOT/.mailmap + +LAST=$(git describe --tags `git rev-list --tags --max-count=1`) +RELEASE=${1:-$LAST} + +IFS=$'\n' +for NAME in $(git shortlog -nse $RELEASE.. | cut -f2-); do + echo $NAME +done + +# sort and write +sort $MAILMAP > .tmpmailmap +cp .tmpmailmap $MAILMAP +rm .tmpmailmap From 0250bb1745768b384f47f88bd06bb8c610d853aa Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:38:39 -0400 Subject: [PATCH 16/20] MAINT: Update/sort mailmap --- .mailmap | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.mailmap b/.mailmap index 79ac75ba46..ca8fe1b171 100644 --- a/.mailmap +++ b/.mailmap @@ -6,8 +6,8 @@ Alejandro Tabas Alejandro de la Vega Alejandro de la Vega Alexander Schaefer -Alexander Schaefer Alexander Schaefer +Alexander Schaefer Alexandre M. Savio Alexandre M. Savio Andrea Dell'Orco @@ -22,9 +22,9 @@ Anna Doll <45283972+AnnaD15@users.noreply.github.com> Ariel Rokem Ariel Rokem Arman Eshaghi +Ashely Gillman Avneet Kaur Avneet Kaur -Ashely Gillman Basille Pinsard Basille Pinsard Ben Cipollini @@ -39,8 +39,8 @@ Blake Dewey Brendan Moloney Caroline Froehlich Christopher J. Markiewicz -Christopher J. Markiewicz Christopher J. Markiewicz +Christopher J. Markiewicz Christopher John Steele Cindee Madison Colin Buchanan @@ -49,8 +49,8 @@ Colin Buchanan Daniel Brenner Daniel Clark Daniel Geisler -Daniel Geisler Daniel Geisler <3453485+daniel-ge@users.noreply.github.com> +Daniel Geisler Daniel Ginsburg Daniel McNamee David Ellis @@ -89,17 +89,17 @@ Hrvoje Stojic Isaac Schwabacher Jakub Kaczmarzyk James Kent -James Kent James Kent +James Kent Janosch Linkersdörfer Jason Wong Jason Wong Jens Kleesiek Jessica Forbes Jérémy Guillon +Joerg Stadler Joerg Stadler Joerg Stadler -Joerg Stadler John A. Lee John A. Lee Joke Durnez @@ -116,30 +116,28 @@ Kesshi Jordan Kevin Sitek Kevin Sitek -Sin Kim -Sin Kim Koen Helwegen Kornelius Podranski Kristofer Montazeri Krzysztof J. Gorgolewski Krzysztof J. Gorgolewski Krzysztof J. Gorgolewski -Krzysztof J. Gorgolewski Krzysztof J. Gorgolewski Krzysztof J. Gorgolewski Krzysztof J. Gorgolewski +Krzysztof J. Gorgolewski Kshitij Chawla Leonie Lampe Lukas Snoek Marcel Falkiewicz Maria de Fatima Dias Maria de Fatima Dias -Martin Perez-Guevara Martin Norgaard +Martin Perez-Guevara Mathias Goncalves Mathias Goncalves -Mathieu Dubois Mathieu Dubois +Mathieu Dubois Matteo Mancini Matteo Visconti di Oleggio Castello Matteo Visconti di Oleggio Castello @@ -147,8 +145,8 @@ Matthew Cieslak Michael Clark Michael Dayan Michael Dayan -Michael Dayan mick-d Michael Dayan +Michael Dayan mick-d Michael Joseph Michael Joseph Michael Philipp Notter @@ -171,8 +169,8 @@ Paul Kuntke Paul Sharp Ranjit Khanuja Rastko Ćirić -Rastko Ćirić Rastko Ćirić +Rastko Ćirić Raunak Jalan Raunak Jalan <41023976+RaunakJalan@users.noreply.github.com> Ross Markello @@ -186,15 +184,17 @@ Serge Koudoro Sharad Sikka Shariq Iqbal Shariq Iqbal -Shoshana Berleant Shoshana Berleant Shoshana Berleant +Shoshana Berleant Shoshana Berleant Shoshana Berleant Ubuntu Simon Rothmei Simon Rothmei +Sin Kim +Sin Kim Siqi Liu Steven Giavasis -Steven Giavasis Steven Giavasis +Steven Giavasis Steven Tilley Sulantha Mathotaarachchi Sunjae Shim <85246533+sjshim@users.noreply.github.com> From 0ad7e3bb96b173200ace9fa8c0b002a49874b325 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:38:47 -0400 Subject: [PATCH 17/20] MAINT: Update zenodo --- .zenodo.json | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 4e8b3022a2..0703ffa351 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -318,6 +318,11 @@ "name": "Bernardoni, Fabio", "orcid": "0000-0002-5112-405X" }, + { + "affiliation": "Sagol School of Neuroscience, Tel Aviv University", + "name": "Ben-Zvi, Gal", + "orcid": "0000-0002-5655-9423" + }, { "affiliation": "State Key Laboratory of Cognitive Neuroscience and Learning & IDG/McGovern Institute for Brain Research, Beijing Normal University, Beijing, China; Max Planck Institute for Psycholinguistics, Nijmegen, the Netherlands", "name": "Kong, Xiang-Zhen", @@ -456,11 +461,6 @@ "affiliation": "University of Iowa", "name": "Welch, David" }, - { - "affiliation": "Sagol School of Neuroscience, Tel Aviv University", - "name": "Ben-Zvi, Gal", - "orcid": "0000-0002-5655-9423" - }, { "affiliation": "Max Planck Institute for Human Cognitive and Brain Sciences", "name": "Contier, Oliver", @@ -892,7 +892,11 @@ "orcid": "0000-0002-5312-6729" } ], - "keywords": ["neuroimaging", "workflow", "pipeline"], + "keywords": [ + "neuroimaging", + "workflow", + "pipeline" + ], "license": "Apache-2.0", "upload_type": "software" } From 180099708940cf9f71a8c5ee7d35586ce8ac1f14 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:45:50 -0400 Subject: [PATCH 18/20] FIX: Avoid requiring milestone --- tools/update_changes.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/update_changes.sh b/tools/update_changes.sh index b5f5f8c0a4..c3b20df5cd 100755 --- a/tools/update_changes.sh +++ b/tools/update_changes.sh @@ -25,7 +25,8 @@ echo $HEADER >> newchanges echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges echo >> newchanges -if [[ "x$2" != "x" ]]; then +MILESTONE=${2:-""} +if [[ "x$MILESTONE" != "x" ]]; then echo "(\`Full changelog \`__)" >> newchanges echo >> newchanges fi From b13b5d0069b53137f9b93cd7e479a189930ab227 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:46:02 -0400 Subject: [PATCH 19/20] MAINT: Add changelog --- doc/changelog/1.X.X-changelog.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/changelog/1.X.X-changelog.rst b/doc/changelog/1.X.X-changelog.rst index 922d06db6f..433212f4ce 100644 --- a/doc/changelog/1.X.X-changelog.rst +++ b/doc/changelog/1.X.X-changelog.rst @@ -1,3 +1,14 @@ +1.8.4 (September 01, 2022) +========================== + +Bug-fix release in the 1.8.x series. + +This release sets a maximum traits version to avoid new, breaking changes. + + * MNT: Pin traits < 6.4 (https://github.com/nipy/nipype/pull/3501) + * ENH: Add inputs to mrtrix3.DWIPreprocInputSpec and remove mandatory annotation for pe_dir (https://github.com/nipy/nipype/pull/3470) + + 1.8.3 (July 14, 2022) ===================== From e918b2dffdb13eb6c7b55b9064cdcc3a1c9e718a Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 1 Sep 2022 14:46:17 -0400 Subject: [PATCH 20/20] MAINT: Bump version --- nipype/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/info.py b/nipype/info.py index a87e77e89b..49c29f4a65 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -5,7 +5,7 @@ # nipype version information # Remove .dev0 for release -__version__ = "1.8.4.dev0" +__version__ = "1.8.4" def get_nipype_gitversion():