From ec35b55573bad4427772bdcd1c68466a48de1f94 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Sat, 30 Oct 2021 18:50:36 +0300 Subject: [PATCH 1/5] added kwarg json_import to mrconvert interface --- nipype/interfaces/mrtrix3/utils.py | 124 +++++++++++++++++++++++------ 1 file changed, 99 insertions(+), 25 deletions(-) diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 77c3047f20..b1414274b3 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -66,7 +66,11 @@ def _list_outputs(self): class Mesh2PVEInputSpec(CommandLineInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-3, desc="input mesh" + exists=True, + argstr="%s", + mandatory=True, + position=-3, + desc="input mesh", ) reference = File( exists=True, @@ -134,9 +138,15 @@ class Generate5ttInputSpec(MRTrix3BaseInputSpec): desc="tissue segmentation algorithm", ) in_file = File( - exists=True, argstr="%s", mandatory=True, position=-2, desc="input image" + exists=True, + argstr="%s", + mandatory=True, + position=-2, + desc="input image", + ) + out_file = File( + argstr="%s", mandatory=True, position=-1, desc="output image" ) - out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") class Generate5ttOutputSpec(TraitedSpec): @@ -173,13 +183,21 @@ def _list_outputs(self): class TensorMetricsInputSpec(CommandLineInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-1, desc="input DTI image" + exists=True, + argstr="%s", + mandatory=True, + position=-1, + desc="input DTI image", ) out_fa = File(argstr="-fa %s", desc="output FA file") out_adc = File(argstr="-adc %s", desc="output ADC file") - out_evec = File(argstr="-vector %s", desc="output selected eigenvector(s) file") - out_eval = File(argstr="-value %s", desc="output selected eigenvalue(s) file") + out_evec = File( + argstr="-vector %s", desc="output selected eigenvector(s) file" + ) + out_eval = File( + argstr="-value %s", desc="output selected eigenvalue(s) file" + ) component = traits.List( [1], usedefault=True, @@ -194,7 +212,8 @@ class TensorMetricsInputSpec(CommandLineInputSpec): exists=True, argstr="-mask %s", desc=( - "only perform computation within the specified binary" " brain mask image" + "only perform computation within the specified binary" + " brain mask image" ), ) modulate = traits.Enum( @@ -246,10 +265,18 @@ def _list_outputs(self): class ComputeTDIInputSpec(CommandLineInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-2, desc="input tractography" + exists=True, + argstr="%s", + mandatory=True, + position=-2, + desc="input tractography", ) out_file = File( - "tdi.mif", argstr="%s", usedefault=True, position=-1, desc="output TDI file" + "tdi.mif", + argstr="%s", + usedefault=True, + position=-1, + desc="output TDI file", ) reference = File( exists=True, @@ -274,7 +301,8 @@ class ComputeTDIInputSpec(CommandLineInputSpec): ) max_tod = traits.Int( argstr="-tod %d", - desc="generate a Track Orientation " "Distribution (TOD) in each voxel.", + desc="generate a Track Orientation " + "Distribution (TOD) in each voxel.", ) contrast = traits.Enum( @@ -353,7 +381,8 @@ class ComputeTDIInputSpec(CommandLineInputSpec): "(these lengths are then taken into account during TWI calculation)", ) ends_only = traits.Bool( - argstr="-ends_only", desc="only map the streamline" " endpoints to the image" + argstr="-ends_only", + desc="only map the streamline" " endpoints to the image", ) tck_weights = File( @@ -363,7 +392,8 @@ class ComputeTDIInputSpec(CommandLineInputSpec): ) nthreads = traits.Int( argstr="-nthreads %d", - desc="number of threads. if zero, the number" " of available cpus will be used", + desc="number of threads. if zero, the number" + " of available cpus will be used", nohash=True, ) @@ -438,10 +468,18 @@ def _list_outputs(self): class TCK2VTKInputSpec(CommandLineInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-2, desc="input tractography" + exists=True, + argstr="%s", + mandatory=True, + position=-2, + desc="input tractography", ) out_file = File( - "tracks.vtk", argstr="%s", usedefault=True, position=-1, desc="output VTK file" + "tracks.vtk", + argstr="%s", + usedefault=True, + position=-1, + desc="output VTK file", ) reference = File( exists=True, @@ -460,7 +498,8 @@ class TCK2VTKInputSpec(CommandLineInputSpec): nthreads = traits.Int( argstr="-nthreads %d", - desc="number of threads. if zero, the number" " of available cpus will be used", + desc="number of threads. if zero, the number" + " of available cpus will be used", nohash=True, ) @@ -498,9 +537,15 @@ def _list_outputs(self): class DWIExtractInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-2, desc="input image" + exists=True, + argstr="%s", + mandatory=True, + position=-2, + desc="input image", + ) + out_file = File( + argstr="%s", mandatory=True, position=-1, desc="output image" ) - out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") bzero = traits.Bool(argstr="-bzero", desc="extract b=0 volumes") nobzero = traits.Bool(argstr="-no_bzero", desc="extract non b=0 volumes") singleshell = traits.Bool( @@ -549,7 +594,11 @@ def _list_outputs(self): class MRConvertInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-2, desc="input image" + exists=True, + argstr="%s", + mandatory=True, + position=-2, + desc="input image", ) out_file = File( "dwi.mif", @@ -566,7 +615,10 @@ class MRConvertInputSpec(MRTrix3BaseInputSpec): desc="extract data at the specified coordinates", ) vox = traits.List( - traits.Float, sep=",", argstr="-vox %s", desc="change the voxel dimensions" + traits.Float, + sep=",", + argstr="-vox %s", + desc="change the voxel dimensions", ) axes = traits.List( traits.Int, @@ -580,6 +632,12 @@ class MRConvertInputSpec(MRTrix3BaseInputSpec): argstr="-scaling %s", desc="specify the data scaling parameter", ) + json_import = File( + exists=True, + argstr="-json_import %s", + mandatory=False, + desc="import data from a JSON file into header key-value pairs", + ) class MRConvertOutputSpec(TraitedSpec): @@ -615,9 +673,15 @@ def _list_outputs(self): class MRMathInputSpec(MRTrix3BaseInputSpec): in_file = File( - exists=True, argstr="%s", mandatory=True, position=-3, desc="input image" + exists=True, + argstr="%s", + mandatory=True, + position=-3, + desc="input image", + ) + out_file = File( + argstr="%s", mandatory=True, position=-1, desc="output image" ) - out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") operation = traits.Enum( "mean", "median", @@ -637,7 +701,9 @@ class MRMathInputSpec(MRTrix3BaseInputSpec): desc="operation to computer along a specified axis", ) axis = traits.Int( - 0, argstr="-axis %d", desc="specfied axis to perform the operation along" + 0, + argstr="-axis %d", + desc="specfied axis to perform the operation along", ) @@ -677,7 +743,11 @@ def _list_outputs(self): class MRResizeInputSpec(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", ) image_size = traits.Tuple( (traits.Int, traits.Int, traits.Int), @@ -794,7 +864,9 @@ class SHConvInputSpec(CommandLineInputSpec): class SHConvOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="the output convoluted spherical harmonics file") + out_file = File( + exists=True, desc="the output convoluted spherical harmonics file" + ) class SHConv(CommandLine): @@ -858,7 +930,9 @@ class SH2AmpInputSpec(CommandLineInputSpec): class SH2AmpOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="the output convoluted spherical harmonics file") + out_file = File( + exists=True, desc="the output convoluted spherical harmonics file" + ) class SH2Amp(CommandLine): From 412f7af292f6ae0f011fc9159eb3e4bc0ece69d3 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Sat, 30 Oct 2021 18:53:12 +0300 Subject: [PATCH 2/5] added kwarg json_export to mrconvert interface --- nipype/interfaces/mrtrix3/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index b1414274b3..941e2ba70b 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -638,10 +638,20 @@ class MRConvertInputSpec(MRTrix3BaseInputSpec): mandatory=False, desc="import data from a JSON file into header key-value pairs", ) + json_export = File( + exists=False, + argstr="-json_export %s", + mandatory=False, + desc="export data from an image header key-value pairs into a JSON file", + ) class MRConvertOutputSpec(TraitedSpec): out_file = File(exists=True, desc="output image") + json_export = File( + exists=True, + desc="exported data from an image header key-value pairs in a JSON file", + ) class MRConvert(MRTrix3Base): From b5246a854366638aa0ef16f50ca5d3b9ace86448 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Sat, 30 Oct 2021 19:20:38 +0300 Subject: [PATCH 3/5] refractoring --- doc/devel/matlab_example1.py | 21 ++++++++++++------- doc/devel/matlab_example2.py | 8 ++++--- .../mrtrix3/tests/test_auto_MRConvert.py | 13 ++++++++++++ nipype/interfaces/mrtrix3/utils.py | 1 + tools/checkspecs.py | 15 +++++++------ tools/gitwash_dumper.py | 6 ++---- tools/run_examples.py | 12 ++++++++--- tools/toollib.py | 4 +++- 8 files changed, 53 insertions(+), 27 deletions(-) diff --git a/doc/devel/matlab_example1.py b/doc/devel/matlab_example1.py index aaf6c4cb3a..9f15389669 100644 --- a/doc/devel/matlab_example1.py +++ b/doc/devel/matlab_example1.py @@ -1,13 +1,17 @@ from nipype.interfaces.matlab import MatlabCommand -from nipype.interfaces.base import TraitedSpec, \ - BaseInterface, BaseInterfaceInputSpec, File +from nipype.interfaces.base import ( + TraitedSpec, + BaseInterface, + BaseInterfaceInputSpec, + File, +) import os from string import Template class ConmapTxt2MatInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, mandatory=True) - out_file = File('cmatrix.mat', usedefault=True) + out_file = File("cmatrix.mat", usedefault=True) class ConmapTxt2MatOutputSpec(TraitedSpec): @@ -19,14 +23,15 @@ class ConmapTxt2Mat(BaseInterface): output_spec = ConmapTxt2MatOutputSpec def _run_interface(self, runtime): - d = dict(in_file=self.inputs.in_file, - out_file=self.inputs.out_file) + d = dict(in_file=self.inputs.in_file, out_file=self.inputs.out_file) # This is your MATLAB code template - script = Template("""in_file = '$in_file'; + script = Template( + """in_file = '$in_file'; out_file = '$out_file'; ConmapTxt2Mat(in_file, out_file); exit; - """).substitute(d) + """ + ).substitute(d) # mfile = True will create an .m file with your script and executed. # Alternatively @@ -43,5 +48,5 @@ def _run_interface(self, runtime): def _list_outputs(self): outputs = self._outputs().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_file) + outputs["out_file"] = os.path.abspath(self.inputs.out_file) return outputs diff --git a/doc/devel/matlab_example2.py b/doc/devel/matlab_example2.py index 8d683ea45f..7d75e307b1 100644 --- a/doc/devel/matlab_example2.py +++ b/doc/devel/matlab_example2.py @@ -4,8 +4,7 @@ class HelloWorldInputSpec(MatlabInputSpec): - name = traits.Str(mandatory=True, - desc='Name of person to say hello to') + name = traits.Str(mandatory=True, desc="Name of person to say hello to") class HelloWorldOutputSpec(TraitedSpec): @@ -29,6 +28,7 @@ class HelloWorld(MatlabCommand): >>> out = hello.run() >>> print out.outputs.matlab_output """ + input_spec = HelloWorldInputSpec output_spec = HelloWorldOutputSpec @@ -37,7 +37,9 @@ def _my_script(self): script = """ disp('Hello %s Python') two = 1 + 1 - """ % (self.inputs.name) + """ % ( + self.inputs.name + ) return script def run(self, **inputs): diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py index 578ffb9b1a..6c1f874273 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py @@ -44,6 +44,16 @@ def test_MRConvert_inputs(): mandatory=True, position=-2, ), + json_export=dict( + argstr="-json_export %s", + extensions=None, + mandatory=False, + ), + json_import=dict( + argstr="-json_import %s", + extensions=None, + mandatory=False, + ), nthreads=dict( argstr="-nthreads %d", nohash=True, @@ -73,6 +83,9 @@ def test_MRConvert_inputs(): def test_MRConvert_outputs(): output_map = dict( + json_export=dict( + extensions=None, + ), out_file=dict( extensions=None, ), diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 941e2ba70b..75dc0e8e8c 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -678,6 +678,7 @@ class MRConvert(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) + outputs["json_export"] = op.abspath(self.inputs.json_export) return outputs diff --git a/tools/checkspecs.py b/tools/checkspecs.py index 032fd122cc..7aaac0d107 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -13,8 +13,7 @@ # Functions and classes class InterfaceChecker(object): - """Class for checking all interface specifications - """ + """Class for checking all interface specifications""" def __init__( self, @@ -23,7 +22,7 @@ def __init__( module_skip_patterns=None, class_skip_patterns=None, ): - r""" Initialize package for parsing + r"""Initialize package for parsing Parameters ---------- @@ -113,14 +112,14 @@ def _uri2path(self, uri): return path def _path2uri(self, dirpath): - """ Convert directory path to uri """ + """Convert directory path to uri""" relpath = dirpath.replace(self.root_path, self.package_name) if relpath.startswith(os.path.sep): relpath = relpath[1:] return relpath.replace(os.path.sep, ".") def _parse_module(self, uri): - """ Parse module defined in *uri* """ + """Parse module defined in *uri*""" filename = self._uri2path(uri) if filename is None: # nothing that we could handle here. @@ -131,7 +130,7 @@ def _parse_module(self, uri): return functions, classes def _parse_lines(self, linesource, module): - """ Parse lines of text for functions and classes """ + """Parse lines of text for functions and classes""" functions = [] classes = [] for line in linesource: @@ -387,7 +386,7 @@ def test_specs(self, uri): return bad_specs def _survives_exclude(self, matchstr, match_type): - """ Returns True if *matchstr* does not match patterns + """Returns True if *matchstr* does not match patterns ``self.package_name`` removed from front of string if present @@ -429,7 +428,7 @@ def _survives_exclude(self, matchstr, match_type): return True def discover_modules(self): - """ Return module sequence discovered from ``self.package_name`` + """Return module sequence discovered from ``self.package_name`` Parameters diff --git a/tools/gitwash_dumper.py b/tools/gitwash_dumper.py index 36efd7f83e..2c08547bac 100755 --- a/tools/gitwash_dumper.py +++ b/tools/gitwash_dumper.py @@ -50,9 +50,7 @@ def cp_files(in_path, globs, out_path): def filename_search_replace(sr_pairs, filename, backup=False): - """ Search and replace for expressions in files - - """ + """Search and replace for expressions in files""" in_txt = open(filename, "rt").read(-1) out_txt = in_txt[:] for in_exp, out_exp in sr_pairs: @@ -94,7 +92,7 @@ def make_link_targets( url=None, ml_url=None, ): - """ Check and make link targets + """Check and make link targets If url is None or ml_url is None, check if there are links present for these in `known_link_fname`. If not, raise error. The check is: diff --git a/tools/run_examples.py b/tools/run_examples.py index 20382ef74d..bd77f1a0a4 100644 --- a/tools/run_examples.py +++ b/tools/run_examples.py @@ -4,9 +4,15 @@ if __name__ == "__main__": - print(dedent("""Nipype examples have been moved to niflow-nipype1-examples. + print( + dedent( + """Nipype examples have been moved to niflow-nipype1-examples. -Install with: pip install niflow-nipype1-examples""")) +Install with: pip install niflow-nipype1-examples""" + ) + ) if sys.argv[1:]: - print("Run this command with: niflow-nipype1-examples " + " ".join(sys.argv[1:])) + print( + "Run this command with: niflow-nipype1-examples " + " ".join(sys.argv[1:]) + ) sys.exit(1) diff --git a/tools/toollib.py b/tools/toollib.py index 77d864f142..e740787575 100644 --- a/tools/toollib.py +++ b/tools/toollib.py @@ -31,7 +31,9 @@ def sh(cmd): def compile_tree(): """Compile all Python files below current directory.""" vstr = ".".join(map(str, sys.version_info[:2])) - stat = os.system("%s %s/lib/python%s/compileall.py ." % (sys.executable, sys.prefix, vstr)) + stat = os.system( + "%s %s/lib/python%s/compileall.py ." % (sys.executable, sys.prefix, vstr) + ) if stat: msg = "*** ERROR: Some Python files in tree do NOT compile! ***\n" msg += "See messages above for the actual file that produced it.\n" From 5979cb869882aa51279b4ec5e6ee9c9ac47c3daf Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Sat, 30 Oct 2021 19:27:41 +0300 Subject: [PATCH 4/5] refractoring w/ black... --- nipype/interfaces/mrtrix/convert.py | 12 ++++++--- nipype/interfaces/mrtrix3/utils.py | 40 ++++++++--------------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/nipype/interfaces/mrtrix/convert.py b/nipype/interfaces/mrtrix/convert.py index 41b593d9a6..b20389c4a1 100644 --- a/nipype/interfaces/mrtrix/convert.py +++ b/nipype/interfaces/mrtrix/convert.py @@ -121,7 +121,9 @@ def track_gen(track_points): "Expecting %s points, found only %s" % (stream_count, n_streams) ) iflogger.error( - "Expecting %s points, found only %s", stream_count, n_streams + "Expecting %s points, found only %s", + stream_count, + n_streams, ) break pts = np.ndarray(shape=(n_pts, pt_cols), dtype=f4dt, buffer=pts_str) @@ -193,7 +195,10 @@ class MRTrix2TrackVis(DipyBaseInterface): output_spec = MRTrix2TrackVisOutputSpec def _run_interface(self, runtime): - from dipy.tracking.utils import move_streamlines, affine_from_fsl_mat_file + from dipy.tracking.utils import ( + move_streamlines, + affine_from_fsl_mat_file, + ) dx, dy, dz = get_data_dims(self.inputs.image_file) vx, vy, vz = get_vox_dims(self.inputs.image_file) @@ -215,7 +220,8 @@ def _run_interface(self, runtime): self.inputs.registration_image_file ): iflogger.info( - "Applying transformation from matrix file %s", self.inputs.matrix_file + "Applying transformation from matrix file %s", + self.inputs.matrix_file, ) xfm = np.genfromtxt(self.inputs.matrix_file) iflogger.info(xfm) diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 75dc0e8e8c..c5059242b6 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -144,9 +144,7 @@ class Generate5ttInputSpec(MRTrix3BaseInputSpec): position=-2, desc="input image", ) - out_file = File( - argstr="%s", mandatory=True, position=-1, desc="output image" - ) + out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") class Generate5ttOutputSpec(TraitedSpec): @@ -192,12 +190,8 @@ class TensorMetricsInputSpec(CommandLineInputSpec): out_fa = File(argstr="-fa %s", desc="output FA file") out_adc = File(argstr="-adc %s", desc="output ADC file") - out_evec = File( - argstr="-vector %s", desc="output selected eigenvector(s) file" - ) - out_eval = File( - argstr="-value %s", desc="output selected eigenvalue(s) file" - ) + out_evec = File(argstr="-vector %s", desc="output selected eigenvector(s) file") + out_eval = File(argstr="-value %s", desc="output selected eigenvalue(s) file") component = traits.List( [1], usedefault=True, @@ -212,8 +206,7 @@ class TensorMetricsInputSpec(CommandLineInputSpec): exists=True, argstr="-mask %s", desc=( - "only perform computation within the specified binary" - " brain mask image" + "only perform computation within the specified binary" " brain mask image" ), ) modulate = traits.Enum( @@ -301,8 +294,7 @@ class ComputeTDIInputSpec(CommandLineInputSpec): ) max_tod = traits.Int( argstr="-tod %d", - desc="generate a Track Orientation " - "Distribution (TOD) in each voxel.", + desc="generate a Track Orientation " "Distribution (TOD) in each voxel.", ) contrast = traits.Enum( @@ -392,8 +384,7 @@ class ComputeTDIInputSpec(CommandLineInputSpec): ) nthreads = traits.Int( argstr="-nthreads %d", - desc="number of threads. if zero, the number" - " of available cpus will be used", + desc="number of threads. if zero, the number" " of available cpus will be used", nohash=True, ) @@ -498,8 +489,7 @@ class TCK2VTKInputSpec(CommandLineInputSpec): nthreads = traits.Int( argstr="-nthreads %d", - desc="number of threads. if zero, the number" - " of available cpus will be used", + desc="number of threads. if zero, the number" " of available cpus will be used", nohash=True, ) @@ -543,9 +533,7 @@ class DWIExtractInputSpec(MRTrix3BaseInputSpec): position=-2, desc="input image", ) - out_file = File( - argstr="%s", mandatory=True, position=-1, desc="output image" - ) + out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") bzero = traits.Bool(argstr="-bzero", desc="extract b=0 volumes") nobzero = traits.Bool(argstr="-no_bzero", desc="extract non b=0 volumes") singleshell = traits.Bool( @@ -690,9 +678,7 @@ class MRMathInputSpec(MRTrix3BaseInputSpec): position=-3, desc="input image", ) - out_file = File( - argstr="%s", mandatory=True, position=-1, desc="output image" - ) + out_file = File(argstr="%s", mandatory=True, position=-1, desc="output image") operation = traits.Enum( "mean", "median", @@ -875,9 +861,7 @@ class SHConvInputSpec(CommandLineInputSpec): class SHConvOutputSpec(TraitedSpec): - out_file = File( - exists=True, desc="the output convoluted spherical harmonics file" - ) + out_file = File(exists=True, desc="the output convoluted spherical harmonics file") class SHConv(CommandLine): @@ -941,9 +925,7 @@ class SH2AmpInputSpec(CommandLineInputSpec): class SH2AmpOutputSpec(TraitedSpec): - out_file = File( - exists=True, desc="the output convoluted spherical harmonics file" - ) + out_file = File(exists=True, desc="the output convoluted spherical harmonics file") class SH2Amp(CommandLine): From 480c1f9a85e4d72a4934825186d24c047eed9643 Mon Sep 17 00:00:00 2001 From: GalBenZvi Date: Sun, 31 Oct 2021 15:23:44 +0200 Subject: [PATCH 5/5] fixed a small issue with output listing --- nipype/interfaces/mrtrix3/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index c5059242b6..e2fa3bab19 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -666,7 +666,8 @@ class MRConvert(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs["out_file"] = op.abspath(self.inputs.out_file) - outputs["json_export"] = op.abspath(self.inputs.json_export) + if self.inputs.json_export: + outputs["json_export"] = op.abspath(self.inputs.json_export) return outputs