From 6ea8e5d70868517e5da9f17eacd4303f9285202a Mon Sep 17 00:00:00 2001 From: Kesshi jordan Date: Fri, 19 May 2017 14:29:35 -0700 Subject: [PATCH 01/24] added interface for dtitk --- .zenodo.json | 5 + nipype/interfaces/dtitk/utils.py | 461 +++++++++++++++++++++++++++++++ 2 files changed, 466 insertions(+) create mode 100644 nipype/interfaces/dtitk/utils.py diff --git a/.zenodo.json b/.zenodo.json index f5ec9ab0ea..acb88c13e5 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -81,6 +81,11 @@ "name": "Keshavan, Anisha", "orcid": "0000-0003-3554-043X" }, + { + "affiliation": "UC Berkeley - UCSF Graduate Program in Bioengineering", + "name": "Jordan, Kesshi", + "orcid": "0000-0001-6313-0580" + }, { "affiliation": "Developer", "name": "Clark, Daniel", diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py new file mode 100644 index 0000000000..4863a1fe94 --- /dev/null +++ b/nipype/interfaces/dtitk/utils.py @@ -0,0 +1,461 @@ +__author__ = 'kjordan' + +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, isdefined, split_filename +from nipype.utils.filemanip import fname_presuffix +import os +from nipype.interfaces.fsl.base import Info + + + +# TODO: fix all wrappers to reflect the one with ScalarVol + +class CommandLineDtitk(CommandLine): + + def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, + ext=None): + """Generate a filename based on the given parameters. + + The filename will take the form: cwd/basename. + If change_ext is True, it will use the extentions specified in + intputs.output_type. + + Parameters + ---------- + basename : str + Filename to base the new filename on. + cwd : str + Path to prefix to the new filename. (default is os.getcwd()) + suffix : str + Suffix to add to the `basename`. (defaults is '' ) + change_ext : bool + Flag to change the filename extension to the FSL output type. + (default True) + + Returns + ------- + fname : str + New filename based on given parameters. + + """ + + if basename == '': + msg = 'Unable to generate filename for command %s. ' % self.cmd + msg += 'basename is not set!' + raise ValueError(msg) + if cwd is None: + cwd = os.getcwd() + if ext is None: + #print "AAA" + #print self.inputs.output_type + ext = Info.output_type_to_ext(self.inputs.output_type) + if change_ext: + if suffix: + suffix = ''.join((suffix, ext)) + else: + suffix = ext + if suffix is None: + suffix = '' + fname = fname_presuffix(basename, suffix=suffix, + use_ext=False, newpath=cwd) + return fname + + +class TVAdjustOriginInputSpec(CommandLineInputSpec): + in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + + +class TVAdjustOriginOutputSpec(TraitedSpec): + out_file = traits.Str(exists=True) + + +class TVAdjustOriginTask(CommandLineDtitk): + input_spec = TVAdjustOriginInputSpec + output_spec = TVAdjustOriginOutputSpec + _cmd = 'TVAdjustVoxelspace' + _suffix = "_originzero" + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) + return outputs + + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + +class TVAdjustVoxSpInputSpec(CommandLineInputSpec): + in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ + argstr="-target %s") + vsize = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ + argstr="-vsize %s") + +class TVAdjustVoxSpOutputSpec(TraitedSpec): + out_file = traits.Str(exists=True) + + +class TVAdjustVoxSpTask(CommandLineDtitk): + input_spec = TVAdjustVoxSpInputSpec + output_spec = TVAdjustVoxSpOutputSpec + _cmd = 'TVAdjustVoxelspace' + _suffix = '_reslice' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) + return outputs + + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + +class RigidInputSpec(CommandLineInputSpec): + fixed_file = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=True, \ + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, mandatory=True, \ + position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ + exists=True, mandatory=True, position=2, + argstr="%s", desc="similarity metric") + +class RigidOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class RigidTask(CommandLineDtitk): + input_spec = RigidInputSpec + output_spec = RigidOutputSpec + _cmd = 'dti_rigid_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz','.aff') + outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') + return outputs + + +class AffineInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ + position=0, argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ + position=1, argstr="%s") + in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ + exists=True, mandatory=False, position=3, argstr="%s", desc = "similarity metric") + in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", \ + desc="initialize using rigid transform??") + + +class AffineOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class AffineTask(CommandLineDtitk): + input_spec = AffineInputSpec + output_spec = AffineOutputSpec + _cmd = 'dti_affine_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff.nii.gz') + return outputs + + +class DiffeoInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ + position=0, argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ + position=1, argstr="%s") + in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, argstr="%s") + in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, position=3, argstr="%s") + + +class DiffeoOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class DiffeoTask(CommandLineDtitk): + input_spec = DiffeoInputSpec + output_spec = DiffeoOutputSpec + _cmd = 'dti_diffeomorphic_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','_aff_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff_diffeo.nii.gz') + return outputs + + +class ComposeXfmInputSpec(CommandLineInputSpec): + in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, mandatory=False, position=1, argstr="-df %s") + in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") + out_path = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", \ + name_source="in_df", name_template="%s_comboaff.nii.gz") + + +class ComposeXfmOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class ComposeXfmTask(CommandLineDtitk): + input_spec = ComposeXfmInputSpec + output_spec = ComposeXfmOutputSpec + _cmd = 'dfRightComposeAffine' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', '_combo.df.nii.gz') + return outputs + + +class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ + name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") + + +class diffeoSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class diffeoSymTensor3DVolTask(CommandLineDtitk): + input_spec = diffeoSymTensor3DVolInputSpec + output_spec = diffeoSymTensor3DVolOutputSpec + _cmd = 'deformationSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + + +class affSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ + name_source="in_tensor", name_template="%s_affxfmd.nii.gz") + + +class affSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class affSymTensor3DVolTask(CommandLineDtitk): + input_spec = affSymTensor3DVolInputSpec + output_spec = affSymTensor3DVolOutputSpec + _cmd = 'affineSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class affScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', position=2, argstr="-target %s") + out_path = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", + name_source="in_volume", name_template="%s_affxfmd.nii.gz") + + +class affScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class affScalarVolTask(CommandLineDtitk): + input_spec = affScalarVolInputSpec + output_spec = affScalarVolOutputSpec + _cmd = 'affineScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class diffeoScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=2, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") + out_path = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", \ + name_template="%s_diffeoxfmd.nii.gz") + in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, argstr="-vsize %s") + in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, argstr="-flip %s") + in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, argstr="-type %s") + in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, position=7, argstr="-interp %s") + + +class diffeoScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class diffeoScalarVolTask(CommandLineDtitk): + input_spec = diffeoScalarVolInputSpec + output_spec = diffeoScalarVolOutputSpec + _cmd = 'deformationScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd",newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + +''' +#TODO not using these yet... need to be tested + +class SVAdjustVoxSpInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ + argstr="-target %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=1, \ + argstr="-out %s", name_source="in_volume", name_template='%s_origmvd.nii.gz') + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + + +class SVAdjustVoxSpOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class SVAdjustVoxSpTask(CommandLineDtitk): + input_spec = SVAdjustVoxSpInputSpec + output_spec = SVAdjustVoxSpOutputSpec + _cmd = 'SVAdjustVoxelspace' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_origmvd", newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs +''' + +''' +class TVResampleInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ + argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz" ) + + +class TVResampleOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class TVResampleTask(CommandLineDtitk): + input_spec = TVResampleInputSpec + output_spec = TVResampleOutputSpec + _cmd = 'TVResample' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class SVResampleInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ + argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz") + + +class SVResampleOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class SVResampleTask(CommandLineDtitk): + input_spec = SVResampleInputSpec + output_spec = SVResampleOutputSpec + _cmd = 'SVResample' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_resampled",newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + +class TVtoolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") + in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, \ + argstr="-%s", desc='') + + +class TVtoolOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class TVtoolTask(CommandLineDtitk): + input_spec = TVtoolInputSpec + output_spec = TVtoolOutputSpec + _cmd = 'TVtool' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_tensor.replace('.nii.gz', '_'+self.inputs.in_flag+'.nii.gz') + return outputs + + +class BinThreshInputSpec(CommandLineInputSpec): + in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") + in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, argstr="%s") + + +class BinThreshOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class BinThreshTask(CommandLineDtitk): + input_spec = BinThreshInputSpec + output_spec = BinThreshOutputSpec + _cmd='BinaryThresholdImageFilter' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + +''' +''' + def _gen_filename(self, name): + print "diffeo worked" + out_file = self.inputs.out_file + if not isdefined(out_file) and isdefined(self.inputs.in_volume): + out_file = self._gen_filename(self.inputs.in_file, suffix='_diffeoxfmd') + return os.path.abspath(out_file) + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs +''' From 52325527acf43a2171b34d4924c67d0895154051 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 15:49:22 -0700 Subject: [PATCH 02/24] Added interface for DTITK command-line tools --- nipype/interfaces/dtitk/base.py | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 nipype/interfaces/dtitk/base.py diff --git a/nipype/interfaces/dtitk/base.py b/nipype/interfaces/dtitk/base.py new file mode 100644 index 0000000000..d5a10af8bf --- /dev/null +++ b/nipype/interfaces/dtitk/base.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""The dtitk module provides classes for interfacing with the `DTITK +`_ command line tools. + +These are the base tools for working with DTITK. +Preprocessing tools are found in dtitk/preprocess.py +Registration tools are found in dtitk/registration.py + +Currently these tools are supported: + +* Rigid Tensor Registration +* Affine Tensor Registration +* Diffeomorphic Tensor Registration + +Examples +-------- +See the docstrings of the individual classes for examples. + +""" +from __future__ import print_function, division, unicode_literals, \ + absolute_import + +import os + +from ... import logging +from ...utils.filemanip import fname_presuffix +from ..base import traits, CommandLine +from nipype.interfaces.fsl.base import Info + +LOGGER = logging.getLogger('interface') + + +class CommandLineDtitk(CommandLine): + + def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, + ext=None): + """Generate a filename based on the given parameters. + + The filename will take the form: cwd/basename. + If change_ext is True, it will use the extentions specified in + intputs.output_type. + + Parameters + ---------- + basename : str + Filename to base the new filename on. + cwd : str + Path to prefix to the new filename. (default is os.getcwd()) + suffix : str + Suffix to add to the `basename`. (defaults is '' ) + change_ext : bool + Flag to change the filename extension to the FSL output type. + (default True) + + Returns + ------- + fname : str + New filename based on given parameters. + + """ + + if basename == '': + msg = 'Unable to generate filename for command %s. ' % self.cmd + msg += 'basename is not set!' + raise ValueError(msg) + if cwd is None: + cwd = os.getcwd() + if ext is None: + ext = Info.output_type_to_ext(self.inputs.output_type) + if change_ext: + if suffix: + suffix = ''.join((suffix, ext)) + else: + suffix = ext + if suffix is None: + suffix = '' + fname = fname_presuffix(basename, suffix=suffix, + use_ext=False, newpath=cwd) + return fname From ae5922677f4bc6952f212c298de2678e7f06480d Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 16:51:41 -0700 Subject: [PATCH 03/24] Added several docstring tests and untested interfaces --- nipype/interfaces/dtitk/utils.py | 545 +++++++++++++------------------ 1 file changed, 224 insertions(+), 321 deletions(-) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 4863a1fe94..e7dfa2272f 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,69 +1,18 @@ __author__ = 'kjordan' -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, isdefined, split_filename -from nipype.utils.filemanip import fname_presuffix +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, File, \ + traits, isdefined, split_filename import os -from nipype.interfaces.fsl.base import Info - - - -# TODO: fix all wrappers to reflect the one with ScalarVol - -class CommandLineDtitk(CommandLine): - - def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, - ext=None): - """Generate a filename based on the given parameters. - - The filename will take the form: cwd/basename. - If change_ext is True, it will use the extentions specified in - intputs.output_type. - - Parameters - ---------- - basename : str - Filename to base the new filename on. - cwd : str - Path to prefix to the new filename. (default is os.getcwd()) - suffix : str - Suffix to add to the `basename`. (defaults is '' ) - change_ext : bool - Flag to change the filename extension to the FSL output type. - (default True) - - Returns - ------- - fname : str - New filename based on given parameters. - - """ - - if basename == '': - msg = 'Unable to generate filename for command %s. ' % self.cmd - msg += 'basename is not set!' - raise ValueError(msg) - if cwd is None: - cwd = os.getcwd() - if ext is None: - #print "AAA" - #print self.inputs.output_type - ext = Info.output_type_to_ext(self.inputs.output_type) - if change_ext: - if suffix: - suffix = ''.join((suffix, ext)) - else: - suffix = ext - if suffix is None: - suffix = '' - fname = fname_presuffix(basename, suffix=suffix, - use_ext=False, newpath=cwd) - return fname +from .base import CommandLineDtitk class TVAdjustOriginInputSpec(CommandLineInputSpec): - in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + in_file = File(desc="image to resample", exists=True, mandatory=True, + position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, + argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') class TVAdjustOriginOutputSpec(TraitedSpec): @@ -71,6 +20,18 @@ class TVAdjustOriginOutputSpec(TraitedSpec): class TVAdjustOriginTask(CommandLineDtitk): + """ + Moves the origin of a tensor volume to zero + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVAdjustOriginTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ + input_spec = TVAdjustOriginInputSpec output_spec = TVAdjustOriginOutputSpec _cmd = 'TVAdjustVoxelspace' @@ -80,7 +41,11 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -89,20 +54,36 @@ def _gen_filename(self, name): return self._list_outputs()["out_file"] return None + class TVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') - target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ - argstr="-target %s") - vsize = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ - argstr="-vsize %s") + in_file = File(desc="image to resample", exists=True, mandatory=True, + position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, + argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') + target = traits.Str(desc='target volume', exists=True, mandatory=False, + position=2, argstr="-target %s") + vsize = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=3, argstr="-vsize %s") + class TVAdjustVoxSpOutputSpec(TraitedSpec): out_file = traits.Str(exists=True) class TVAdjustVoxSpTask(CommandLineDtitk): + """ + Adjusts the voxel space of a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVAdjustVoxSpTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = TVAdjustVoxSpInputSpec output_spec = TVAdjustVoxSpOutputSpec _cmd = 'TVAdjustVoxelspace' @@ -112,7 +93,11 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -122,217 +107,21 @@ def _gen_filename(self, name): return None -class RigidInputSpec(CommandLineInputSpec): - fixed_file = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=True, \ - position=0, argstr="%s") - moving_file = traits.Str(desc="diffusion tensor image path", exists=True, mandatory=True, \ - position=1, argstr="%s") - similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ - exists=True, mandatory=True, position=2, - argstr="%s", desc="similarity metric") - -class RigidOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class RigidTask(CommandLineDtitk): - input_spec = RigidInputSpec - output_spec = RigidOutputSpec - _cmd = 'dti_rigid_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz','.aff') - outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') - return outputs - - -class AffineInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ - position=0, argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ - position=1, argstr="%s") - in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ - exists=True, mandatory=False, position=3, argstr="%s", desc = "similarity metric") - in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", \ - desc="initialize using rigid transform??") - - -class AffineOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class AffineTask(CommandLineDtitk): - input_spec = AffineInputSpec - output_spec = AffineOutputSpec - _cmd = 'dti_affine_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff.nii.gz') - return outputs - - -class DiffeoInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ - position=0, argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ - position=1, argstr="%s") - in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, argstr="%s") - in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, position=3, argstr="%s") - - -class DiffeoOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class DiffeoTask(CommandLineDtitk): - input_spec = DiffeoInputSpec - output_spec = DiffeoOutputSpec - _cmd = 'dti_diffeomorphic_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','_aff_diffeo.df.nii.gz') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff_diffeo.nii.gz') - return outputs - - -class ComposeXfmInputSpec(CommandLineInputSpec): - in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, mandatory=False, position=1, argstr="-df %s") - in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") - out_path = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", \ - name_source="in_df", name_template="%s_comboaff.nii.gz") - - -class ComposeXfmOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class ComposeXfmTask(CommandLineDtitk): - input_spec = ComposeXfmInputSpec - output_spec = ComposeXfmOutputSpec - _cmd = 'dfRightComposeAffine' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', '_combo.df.nii.gz') - return outputs - - -class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ - name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") - - -class diffeoSymTensor3DVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class diffeoSymTensor3DVolTask(CommandLineDtitk): - input_spec = diffeoSymTensor3DVolInputSpec - output_spec = diffeoSymTensor3DVolOutputSpec - _cmd = 'deformationSymTensor3DVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path - return outputs - - -class affSymTensor3DVolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ - name_source="in_tensor", name_template="%s_affxfmd.nii.gz") - - -class affSymTensor3DVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class affSymTensor3DVolTask(CommandLineDtitk): - input_spec = affSymTensor3DVolInputSpec - output_spec = affSymTensor3DVolOutputSpec - _cmd = 'affineSymTensor3DVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - - -class affScalarVolInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', position=2, argstr="-target %s") - out_path = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", - name_source="in_volume", name_template="%s_affxfmd.nii.gz") - - -class affScalarVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='moved volume', exists=True) +# TODO not using these yet... need to be tested -class affScalarVolTask(CommandLineDtitk): - input_spec = affScalarVolInputSpec - output_spec = affScalarVolOutputSpec - _cmd = 'affineScalarVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - - -class diffeoScalarVolInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=2, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - out_path = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", \ - name_template="%s_diffeoxfmd.nii.gz") - in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, argstr="-vsize %s") - in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, argstr="-flip %s") - in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, argstr="-type %s") - in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, position=7, argstr="-interp %s") - - -class diffeoScalarVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='moved volume', exists=True) - - -class diffeoScalarVolTask(CommandLineDtitk): - input_spec = diffeoScalarVolInputSpec - output_spec = diffeoScalarVolOutputSpec - _cmd = 'deformationScalarVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd",newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - -''' -#TODO not using these yet... need to be tested - class SVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ - argstr="-target %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=1, \ - argstr="-out %s", name_source="in_volume", name_template='%s_origmvd.nii.gz') - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + in_volume = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_target = traits.Str(desc='target volume', exists=True, mandatory=False, + position=2, argstr="-target %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=3, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=1, argstr="-out %s", name_source="in_volume", + name_template='%s_origmvd.nii.gz') + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') class SVAdjustVoxSpOutputSpec(TraitedSpec): @@ -340,27 +129,50 @@ class SVAdjustVoxSpOutputSpec(TraitedSpec): class SVAdjustVoxSpTask(CommandLineDtitk): + """ + Adjusts the voxel space of a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.SVAdjustVoxSpTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = SVAdjustVoxSpInputSpec output_spec = SVAdjustVoxSpOutputSpec _cmd = 'SVAdjustVoxelspace' + _suffix = '_reslice' def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_origmvd", newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs -''' -''' + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + class TVResampleInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ - argstr="-size %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ - argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz" ) + in_tensor = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, + mandatory=False, position=1, argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=2, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=3, argstr="-out %s", name_source="in_volume", + name_template="%s_resampled.nii.gz" ) class TVResampleOutputSpec(TraitedSpec): @@ -368,24 +180,51 @@ class TVResampleOutputSpec(TraitedSpec): class TVResampleTask(CommandLineDtitk): + """ + Resamples a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVResampleTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = TVResampleInputSpec output_spec = TVResampleOutputSpec _cmd = 'TVResample' + _suffix = '_resampled' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + class SVResampleInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + in_volume = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, + mandatory=False, position=1, \ argstr="-size %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ - argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=2, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=3, argstr="-out %s", name_source="in_volume", + name_template="%s_resampled.nii.gz") class SVResampleOutputSpec(TraitedSpec): @@ -393,21 +232,45 @@ class SVResampleOutputSpec(TraitedSpec): class SVResampleTask(CommandLineDtitk): + """ + Resamples a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.SVResampleTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = SVResampleInputSpec output_spec = SVResampleOutputSpec _cmd = 'SVResample' + _suffix = '_resampled' def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_resampled",newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + class TVtoolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") - in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, \ - argstr="-%s", desc='') + in_tensor = traits.Str(desc="image to resample", exists=True, + mandatory=False, position=0, argstr="-in %s") + in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, + mandatory=False, position=1, argstr="-%s", desc='') class TVtoolOutputSpec(TraitedSpec): @@ -415,20 +278,49 @@ class TVtoolOutputSpec(TraitedSpec): class TVtoolTask(CommandLineDtitk): + """ + Calculates a tensor metric volume from a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVtoolTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_flag = 'fa' + >>> node.run() + """ input_spec = TVtoolInputSpec output_spec = TVtoolOutputSpec _cmd = 'TVtool' def _list_outputs(self): + _suffix = self.inputs.in_flag outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.in_tensor.replace('.nii.gz', '_'+self.inputs.in_flag+'.nii.gz') + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=_suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + class BinThreshInputSpec(CommandLineInputSpec): - in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") - in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, argstr="%s") + in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, + argstr="%s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, + argstr="%s") + in_numbers = traits.Str(desc='LB UB inside_value outside_value', + exists=True, mandatory=False, position=2, + argstr="%s") class BinThreshOutputSpec(TraitedSpec): @@ -436,26 +328,37 @@ class BinThreshOutputSpec(TraitedSpec): class BinThreshTask(CommandLineDtitk): + """ + Binarizes an image based on parameters + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.BinThreshTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_numbers = '0 100 1 0' + >>> node.run() + """ + input_spec = BinThreshInputSpec output_spec = BinThreshOutputSpec - _cmd='BinaryThresholdImageFilter' + _cmd = 'BinaryThresholdImageFilter' + _suffix = '_bin' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs -''' -''' def _gen_filename(self, name): - print "diffeo worked" - out_file = self.inputs.out_file - if not isdefined(out_file) and isdefined(self.inputs.in_volume): - out_file = self._gen_filename(self.inputs.in_file, suffix='_diffeoxfmd') - return os.path.abspath(out_file) - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path - return outputs -''' + if name == "out_file": + return self._list_outputs()["out_file"] + return None From f1dc18b57e68b52d8b5d88972cab3a7ce527f860 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 17:12:53 -0700 Subject: [PATCH 04/24] changed relative imports to absolute, fixed docstring tests --- nipype/interfaces/dtitk/registration.py | 348 ++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 nipype/interfaces/dtitk/registration.py diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py new file mode 100644 index 0000000000..08382a4e25 --- /dev/null +++ b/nipype/interfaces/dtitk/registration.py @@ -0,0 +1,348 @@ +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, \ + traits, isdefined +from nipype.utils.filemanip import fname_presuffix +import os +from base import CommandLineDtitk + + +class RigidInputSpec(CommandLineInputSpec): + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=True, + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, + mandatory=True, position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=True, position=2, argstr="%s", + desc="similarity metric") + + +class RigidOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class RigidTask(CommandLineDtitk): + """ + Performs rigid registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.RigidTask() + >>> node.inputs.fixed_file = 'diffusion.nii' + >>> node.inputs.moving_file = 'diffusion.nii' + >>> node.inputs.similarity_metric = 'EDS' + >>> node.run() + """ + input_spec = RigidInputSpec + output_spec = RigidOutputSpec + _cmd = 'dti_rigid_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', '.aff') + outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', + '_aff.nii.gz') + return outputs + + +class AffineInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + in_moving_txt = traits.Str( + desc="moving list of diffusion tensor image paths", exists=True, + mandatory=False, position=1, argstr="%s") + in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=False, position=3, argstr="%s", + desc = "similarity metric") + in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, + mandatory=False, position=4, argstr="%s", + desc="initialize using rigid transform??") + + +class AffineOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class AffineTask(CommandLineDtitk): + """ + Performs affine registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.AffineTask() + >>> node.inputs.in_fixed_tensor = 'diffusion.nii' + >>> node.inputs.in_moving_txt = 'dirs.txt' + >>> node.inputs.in_similarity_metric = 'EDS' + >>> node.run() + """ + + input_spec = AffineInputSpec + output_spec = AffineOutputSpec + _cmd = 'dti_affine_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', + '_aff.nii.gz') + return outputs + + +class DiffeoInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image " + "paths", exists=True, mandatory=False, + position=1, argstr="%s") + in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, + argstr="%s") + in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, + position=3, argstr="%s") + + +class DiffeoOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class DiffeoTask(CommandLineDtitk): + """ + Performs diffeomorphic registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.DiffeoTask() + >>> node.inputs.in_fixed_tensor = 'diffusion.nii' + >>> node.inputs.in_moving_txt = 'dirs.txt' + >>> node.inputs.in_mask = 'mask.nii' + >>> node.inputs.in_numbers = '6 0.002' + >>> node.run() + """ + input_spec = DiffeoInputSpec + output_spec = DiffeoOutputSpec + _cmd = 'dti_diffeomorphic_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz','_aff_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '_aff_diffeo.nii.gz') + return outputs + + +class ComposeXfmInputSpec(CommandLineInputSpec): + in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, + mandatory=False, position=1, argstr="-df %s") + in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, + position=0, argstr="-aff %s") + out_path = traits.Str(desc='output_path', exists=True, mandatory=False, + position=2, argstr="-out %s", name_source="in_df", + name_template="%s_comboaff.nii.gz") + + +class ComposeXfmOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class ComposeXfmTask(CommandLineDtitk): + """ + Combines diffeomorphic and affine transforms + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.ComposeXfmTask() + >>> node.inputs.in_df = 'ants_Warp.nii.gz' + >>> node.inputs.in_aff= 'ants_Affine.txt' + >>> node.run() + """ + input_spec = ComposeXfmInputSpec + output_spec = ComposeXfmOutputSpec + _cmd = 'dfRightComposeAffine' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', + '_combo.df.nii.gz') + return outputs + + +class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, + argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-out %s", name_source="in_tensor", + name_template="%s_diffeoxfmd.nii.gz") + + +class diffeoSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class diffeoSymTensor3DVolTask(CommandLineDtitk): + """ + Applies diffeomorphic transform to a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.diffeoSymTensor3DVolTask() + >>> node.inputs.in_tensor = 'diffusion.nii' + >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' + >>> node.run() + """ + + input_spec = diffeoSymTensor3DVolInputSpec + output_spec = diffeoSymTensor3DVolOutputSpec + _cmd = 'deformationSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + + +class affSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, + argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-out %s", name_source="in_tensor", + name_template="%s_affxfmd.nii.gz") + + +class affSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class affSymTensor3DVolTask(CommandLineDtitk): + """ + Applies affine transform to a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.affSymTensor3DVolTask() + >>> node.inputs.in_tensor = 'diffusion.nii' + >>> node.inputs.in_xfm = 'ants_Affine.txt' + >>> node.run() + """ + input_spec = affSymTensor3DVolInputSpec + output_spec = affSymTensor3DVolOutputSpec + _cmd = 'affineSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class affScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', position=2, argstr="-target %s") + out_path = traits.Str(desc='', mandatory=False, position=3, + argstr="-out %s", name_source="in_volume", + name_template="%s_affxfmd.nii.gz") + + +class affScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class affScalarVolTask(CommandLineDtitk): + """ + Applies affine transform to a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.affScalarVolTask() + >>> node.inputs.in_volume = 'fa.nii.gz' + >>> node.inputs.in_xfm = 'ants_Affine.txt' + >>> node.run() + """ + input_spec = affScalarVolInputSpec + output_spec = affScalarVolOutputSpec + _cmd = 'affineScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class diffeoScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=2, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-target %s") + out_path = traits.Str(desc='', position=1, argstr="-out %s", + name_source="in_volume", + name_template="%s_diffeoxfmd.nii.gz") + in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, + argstr="-vsize %s") + in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, + argstr="-flip %s") + in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, + argstr="-type %s") + in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, + position=7, argstr="-interp %s") + + +class diffeoScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class diffeoScalarVolTask(CommandLineDtitk): + """ + Applies diffeomorphic transform to a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.diffeoScalarVolTask() + >>> node.inputs.in_tensor = 'fa.nii.gz' + >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' + >>> node.run() + """ + + input_spec = diffeoScalarVolInputSpec + output_spec = diffeoScalarVolOutputSpec + _cmd = 'deformationScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, + suffix="_diffeoxfmd", + newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs From c7122ac8eee27fd63379d186c34c35d2e36a27d9 Mon Sep 17 00:00:00 2001 From: Kesshi Jordan Date: Thu, 7 Sep 2017 13:58:59 -0700 Subject: [PATCH 05/24] added init --- nipype/interfaces/dtitk/__init__.py | 12 ++++++++++++ nipype/interfaces/dtitk/registration.py | 6 +++--- nipype/interfaces/dtitk/utils.py | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 nipype/interfaces/dtitk/__init__.py diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py new file mode 100644 index 0000000000..1e033a36ea --- /dev/null +++ b/nipype/interfaces/dtitk/__init__.py @@ -0,0 +1,12 @@ +"""The dtitk module provides classes for interfacing with the `Diffusion +Tensor Imaging Toolkit (DTI-TK) +`_ command line tools. + +Top-level namespace for dti-tk. +""" + +#from .base import () +from .registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, +diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) +from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, +TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 08382a4e25..8b54dcfc5e 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -1,8 +1,8 @@ -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, \ +from ..base import TraitedSpec, CommandLineInputSpec, \ traits, isdefined -from nipype.utils.filemanip import fname_presuffix +from ...utils.filemanip import fname_presuffix import os -from base import CommandLineDtitk +from .base import CommandLineDtitk class RigidInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index e7dfa2272f..291007679f 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,6 +1,6 @@ __author__ = 'kjordan' -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, File, \ +from ..base import TraitedSpec, CommandLineInputSpec, File, \ traits, isdefined, split_filename import os from .base import CommandLineDtitk From 7b8b5db835a8db00543100a6c6525e6c9686fb21 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 15 Sep 2017 09:17:29 -0700 Subject: [PATCH 06/24] changed input variable names --- nipype/interfaces/dtitk/__init__.py | 4 ++-- nipype/interfaces/dtitk/utils.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 1e033a36ea..3f50f17d2d 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -6,7 +6,7 @@ """ #from .base import () -from .registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, +from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) -from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, +from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 291007679f..754ea26d98 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -111,7 +111,7 @@ def _gen_filename(self, name): class SVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, argstr="-target %s") @@ -164,7 +164,7 @@ def _gen_filename(self, name): class TVResampleInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, argstr="-size %s") @@ -215,7 +215,7 @@ def _gen_filename(self, name): class SVResampleInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ @@ -267,7 +267,7 @@ def _gen_filename(self, name): class TVtoolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, argstr="-%s", desc='') @@ -314,7 +314,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): - in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, + in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") From 1127b4d7fba6197b1a3c2a1819492730e1e3af71 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 15 Sep 2017 10:27:43 -0700 Subject: [PATCH 07/24] added # doctest: +SKIP --- nipype/interfaces/afni/preprocess.py | 24 +++---- .../afni/tests/test_auto_TCatSubBrick.py | 44 ++++++++++++ nipype/interfaces/dtitk/__init__.py | 13 ++-- nipype/interfaces/dtitk/registration.py | 16 ++--- .../dtitk/tests/test_auto_AffineTask.py | 53 ++++++++++++++ .../dtitk/tests/test_auto_BinThreshTask.py | 47 ++++++++++++ .../dtitk/tests/test_auto_CommandLineDtitk.py | 23 ++++++ .../dtitk/tests/test_auto_ComposeXfmTask.py | 49 +++++++++++++ .../dtitk/tests/test_auto_DiffeoTask.py | 53 ++++++++++++++ .../dtitk/tests/test_auto_RigidTask.py | 48 +++++++++++++ .../tests/test_auto_SVAdjustVoxSpTask.py | 59 +++++++++++++++ .../dtitk/tests/test_auto_SVResampleTask.py | 54 ++++++++++++++ .../tests/test_auto_TVAdjustOriginTask.py | 46 ++++++++++++ .../tests/test_auto_TVAdjustVoxSpTask.py | 56 +++++++++++++++ .../dtitk/tests/test_auto_TVResampleTask.py | 54 ++++++++++++++ .../dtitk/tests/test_auto_TVtoolTask.py | 42 +++++++++++ .../dtitk/tests/test_auto_affScalarVolTask.py | 51 +++++++++++++ .../tests/test_auto_affSymTensor3DVolTask.py | 54 ++++++++++++++ .../tests/test_auto_diffeoScalarVolTask.py | 72 +++++++++++++++++++ .../test_auto_diffeoSymTensor3DVolTask.py | 54 ++++++++++++++ nipype/interfaces/dtitk/utils.py | 21 +++--- 21 files changed, 898 insertions(+), 35 deletions(-) create mode 100644 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_AffineTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_RigidTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index e0e2518ef1..91a68bd97b 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -119,7 +119,7 @@ class AlignEpiAnatPyOutputSpec(TraitedSpec): desc="matrix to volume register and align epi" "to anatomy and put into standard space") epi_vr_motion = File( - desc="motion parameters from EPI time-series" + desc="motion parameters from EPI time-series" "registration (tsh included in name if slice" "timing correction is also included).") skullstrip = File( @@ -131,20 +131,20 @@ class AlignEpiAnatPy(AFNIPythonCommand): an EPI and an anatomical structural dataset, and applies the resulting transformation to one or the other to bring them into alignment. - This script computes the transforms needed to align EPI and - anatomical datasets using a cost function designed for this purpose. The - script combines multiple transformations, thereby minimizing the amount of + This script computes the transforms needed to align EPI and + anatomical datasets using a cost function designed for this purpose. The + script combines multiple transformations, thereby minimizing the amount of interpolation applied to the data. - + Basic Usage: align_epi_anat.py -anat anat+orig -epi epi+orig -epi_base 5 - + The user must provide EPI and anatomical datasets and specify the EPI - sub-brick to use as a base in the alignment. + sub-brick to use as a base in the alignment. Internally, the script always aligns the anatomical to the EPI dataset, - and the resulting transformation is saved to a 1D file. - As a user option, the inverse of this transformation may be applied to the + and the resulting transformation is saved to a 1D file. + As a user option, the inverse of this transformation may be applied to the EPI dataset in order to align it to the anatomical data instead. This program generates several kinds of output in the form of datasets @@ -182,7 +182,7 @@ def _list_outputs(self): epi_prefix = ''.join(self._gen_fname(self.inputs.in_file).split('+')[:-1]) outputtype = self.inputs.outputtype if outputtype == 'AFNI': - ext = '.HEAD' + ext = '.HEAD' else: Info.output_type_to_ext(outputtype) matext = '.1D' @@ -620,7 +620,7 @@ class AutoTLRCInputSpec(CommandLineInputSpec): mandatory=True, exists=True, copyfile=False) - base = traits.Str( + base = traits.Str( desc = ' Reference anatomical volume' ' Usually this volume is in some standard space like' ' TLRC or MNI space and with afni dataset view of' @@ -706,7 +706,7 @@ def _list_outputs(self): ext = '.HEAD' outputs['out_file'] = os.path.abspath(self._gen_fname(self.inputs.in_file, suffix='+tlrc')+ext) return outputs - + class BandpassInputSpec(AFNICommandInputSpec): in_file = File( desc='input file to 3dBandpass', diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py new file mode 100644 index 0000000000..a32e594298 --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -0,0 +1,44 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TCatSubBrick + + +def test_TCatSubBrick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_files=dict(argstr='%s%s ...', + copyfile=False, + mandatory=True, + position=-1, + ), + out_file=dict(argstr='-prefix %s', + genfile=True, + ), + outputtype=dict(), + rlt=dict(argstr='-rlt%s', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TCatSubBrick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TCatSubBrick_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TCatSubBrick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 3f50f17d2d..0f6588ca5f 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -5,8 +5,11 @@ Top-level namespace for dti-tk. """ -#from .base import () -from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, -diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) -from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, -TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) +# from .base import () +from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, + ComposeXfmTask, diffeoSymTensor3DVolTask, + affSymTensor3DVolTask, affScalarVolTask, + diffeoScalarVolTask) +from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, + SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, + TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 8b54dcfc5e..8a8a0175fd 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -33,7 +33,7 @@ class RigidTask(CommandLineDtitk): >>> node.inputs.fixed_file = 'diffusion.nii' >>> node.inputs.moving_file = 'diffusion.nii' >>> node.inputs.similarity_metric = 'EDS' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = RigidInputSpec output_spec = RigidOutputSpec @@ -79,7 +79,7 @@ class AffineTask(CommandLineDtitk): >>> node.inputs.in_fixed_tensor = 'diffusion.nii' >>> node.inputs.in_moving_txt = 'dirs.txt' >>> node.inputs.in_similarity_metric = 'EDS' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = AffineInputSpec @@ -126,7 +126,7 @@ class DiffeoTask(CommandLineDtitk): >>> node.inputs.in_moving_txt = 'dirs.txt' >>> node.inputs.in_mask = 'mask.nii' >>> node.inputs.in_numbers = '6 0.002' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = DiffeoInputSpec output_spec = DiffeoOutputSpec @@ -166,7 +166,7 @@ class ComposeXfmTask(CommandLineDtitk): >>> node = dtitk.ComposeXfmTask() >>> node.inputs.in_df = 'ants_Warp.nii.gz' >>> node.inputs.in_aff= 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = ComposeXfmInputSpec output_spec = ComposeXfmOutputSpec @@ -206,7 +206,7 @@ class diffeoSymTensor3DVolTask(CommandLineDtitk): >>> node = dtitk.diffeoSymTensor3DVolTask() >>> node.inputs.in_tensor = 'diffusion.nii' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = diffeoSymTensor3DVolInputSpec @@ -246,7 +246,7 @@ class affSymTensor3DVolTask(CommandLineDtitk): >>> node = dtitk.affSymTensor3DVolTask() >>> node.inputs.in_tensor = 'diffusion.nii' >>> node.inputs.in_xfm = 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = affSymTensor3DVolInputSpec output_spec = affSymTensor3DVolOutputSpec @@ -284,7 +284,7 @@ class affScalarVolTask(CommandLineDtitk): >>> node = dtitk.affScalarVolTask() >>> node.inputs.in_volume = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = affScalarVolInputSpec output_spec = affScalarVolOutputSpec @@ -331,7 +331,7 @@ class diffeoScalarVolTask(CommandLineDtitk): >>> node = dtitk.diffeoScalarVolTask() >>> node.inputs.in_tensor = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = diffeoScalarVolInputSpec diff --git a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py new file mode 100644 index 0000000000..865619366a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import AffineTask + + +def test_AffineTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fixed_tensor=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_moving_txt=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + in_similarity_metric=dict(argstr='%s', + exists=True, + mandatory=False, + position=3, + ), + in_usetrans_flag=dict(argstr='%s', + exists=True, + mandatory=False, + position=4, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = AffineTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_AffineTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = AffineTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py new file mode 100644 index 0000000000..e430677193 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -0,0 +1,47 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import BinThreshTask + + +def test_BinThreshTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_image=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_numbers=dict(argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = BinThreshTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_BinThreshTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = BinThreshTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py new file mode 100644 index 0000000000..e0934c9b76 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py @@ -0,0 +1,23 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import CommandLineDtitk + + +def test_CommandLineDtitk_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = CommandLineDtitk.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + diff --git a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py new file mode 100644 index 0000000000..9b98fc48e4 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py @@ -0,0 +1,49 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import ComposeXfmTask + + +def test_ComposeXfmTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_aff=dict(argstr='-aff %s', + exists=True, + mandatory=False, + position=0, + ), + in_df=dict(argstr='-df %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_df', + name_template='%s_comboaff.nii.gz', + position=2, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = ComposeXfmTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_ComposeXfmTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = ComposeXfmTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py new file mode 100644 index 0000000000..ad3b8b7366 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import DiffeoTask + + +def test_DiffeoTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fixed_tensor=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_mask=dict(argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + in_moving_txt=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + in_numbers=dict(argstr='%s', + exists=True, + mandatory=False, + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = DiffeoTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DiffeoTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = DiffeoTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py new file mode 100644 index 0000000000..e099d4c6a0 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py @@ -0,0 +1,48 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import RigidTask + + +def test_RigidTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + fixed_file=dict(argstr='%s', + exists=True, + mandatory=True, + position=0, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + moving_file=dict(argstr='%s', + exists=True, + mandatory=True, + position=1, + ), + similarity_metric=dict(argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = RigidTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_RigidTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = RigidTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py new file mode 100644 index 0000000000..c4f1bdeec1 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -0,0 +1,59 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import SVAdjustVoxSpTask + + +def test_SVAdjustVoxSpTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_origmvd.nii.gz', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = SVAdjustVoxSpTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_SVAdjustVoxSpTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = SVAdjustVoxSpTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py new file mode 100644 index 0000000000..5e4af63e87 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import SVResampleTask + + +def test_SVResampleTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_arraysz=dict(argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = SVResampleTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_SVResampleTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = SVResampleTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py new file mode 100644 index 0000000000..55947095a9 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py @@ -0,0 +1,46 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVAdjustOriginTask + + +def test_TVAdjustOriginTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict(argstr='-out %s', + genfile=True, + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVAdjustOriginTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVAdjustOriginTask_outputs(): + output_map = dict(out_file=dict(exists=True, + ), + ) + outputs = TVAdjustOriginTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py new file mode 100644 index 0000000000..1512ff67a4 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py @@ -0,0 +1,56 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVAdjustVoxSpTask + + +def test_TVAdjustVoxSpTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict(argstr='-out %s', + genfile=True, + position=1, + ), + target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + terminal_output=dict(nohash=True, + ), + vsize=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), + ) + inputs = TVAdjustVoxSpTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVAdjustVoxSpTask_outputs(): + output_map = dict(out_file=dict(exists=True, + ), + ) + outputs = TVAdjustVoxSpTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py new file mode 100644 index 0000000000..ec16b3adee --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVResampleTask + + +def test_TVResampleTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_arraysz=dict(argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVResampleTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVResampleTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TVResampleTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py new file mode 100644 index 0000000000..bba66e0279 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -0,0 +1,42 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVtoolTask + + +def test_TVtoolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_flag=dict(argstr='-%s', + exists=True, + mandatory=False, + position=1, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVtoolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVtoolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TVtoolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py new file mode 100644 index 0000000000..55dc779e9a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py @@ -0,0 +1,51 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import affScalarVolTask + + +def test_affScalarVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + position=2, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + mandatory=False, + name_source='in_volume', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = affScalarVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_affScalarVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = affScalarVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py new file mode 100644 index 0000000000..c0da08cb55 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import affSymTensor3DVolTask + + +def test_affSymTensor3DVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = affSymTensor3DVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_affSymTensor3DVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = affSymTensor3DVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py new file mode 100644 index 0000000000..c396ec6e4a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py @@ -0,0 +1,72 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import diffeoScalarVolTask + + +def test_diffeoScalarVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_flip=dict(argstr='-flip %s', + exists=True, + mandatory=False, + position=5, + ), + in_interp=dict(argstr='-interp %s', + exists=True, + mandatory=False, + position=7, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=3, + ), + in_type=dict(argstr='-type %s', + exists=True, + mandatory=False, + position=6, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_vsize=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=4, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + name_source='in_volume', + name_template='%s_diffeoxfmd.nii.gz', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = diffeoScalarVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_diffeoScalarVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = diffeoScalarVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py new file mode 100644 index 0000000000..af2069fe4f --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import diffeoSymTensor3DVolTask + + +def test_diffeoSymTensor3DVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_diffeoxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = diffeoSymTensor3DVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_diffeoSymTensor3DVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = diffeoSymTensor3DVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 754ea26d98..2075ac5253 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -29,7 +29,7 @@ class TVAdjustOriginTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVAdjustOriginTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVAdjustOriginInputSpec @@ -82,7 +82,7 @@ class TVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVAdjustVoxSpTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVAdjustVoxSpInputSpec output_spec = TVAdjustVoxSpOutputSpec @@ -138,7 +138,7 @@ class SVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVAdjustVoxSpTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = SVAdjustVoxSpInputSpec output_spec = SVAdjustVoxSpOutputSpec @@ -165,14 +165,15 @@ def _gen_filename(self, name): class TVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=3, argstr="-out %s", name_source="in_volume", - name_template="%s_resampled.nii.gz" ) + position=3, argstr="-out %s", + name_source="in_volume", + name_template="%s_resampled.nii.gz") class TVResampleOutputSpec(TraitedSpec): @@ -189,7 +190,7 @@ class TVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVResampleTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVResampleInputSpec output_spec = TVResampleOutputSpec @@ -241,7 +242,7 @@ class SVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVResampleTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = SVResampleInputSpec output_spec = SVResampleOutputSpec @@ -288,7 +289,7 @@ class TVtoolTask(CommandLineDtitk): >>> node = dtitk.TVtoolTask() >>> node.inputs.in_file = 'diffusion.nii' >>> node.inputs.in_flag = 'fa' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVtoolInputSpec output_spec = TVtoolOutputSpec @@ -338,7 +339,7 @@ class BinThreshTask(CommandLineDtitk): >>> node = dtitk.BinThreshTask() >>> node.inputs.in_file = 'diffusion.nii' >>> node.inputs.in_numbers = '0 100 1 0' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = BinThreshInputSpec From 54d9d1de3088ed15e1303f0910ce4154b3b0bfea Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 18 Sep 2017 17:32:26 -0700 Subject: [PATCH 08/24] added init file --- nipype/interfaces/dtitk/tests/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 nipype/interfaces/dtitk/tests/__init__.py diff --git a/nipype/interfaces/dtitk/tests/__init__.py b/nipype/interfaces/dtitk/tests/__init__.py new file mode 100644 index 0000000000..99fb243f19 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: From 0a4bda27fdeebffef5709b2239ba809f3026d53a Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 18 Sep 2017 22:19:31 -0700 Subject: [PATCH 09/24] fixed variable name changes --- .cache/v/cache/lastfailed | 22 ++++++++++++ nipype/interfaces/dtitk/base.py | 2 +- nipype/interfaces/dtitk/registration.py | 35 ++++++++++-------- nipype/interfaces/dtitk/utils.py | 48 +++++++++++++------------ 4 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 .cache/v/cache/lastfailed diff --git a/.cache/v/cache/lastfailed b/.cache/v/cache/lastfailed new file mode 100644 index 0000000000..5fcc465fa5 --- /dev/null +++ b/.cache/v/cache/lastfailed @@ -0,0 +1,22 @@ +{ + "nipype/algorithms/tests/test_tsnr.py": true, + "nipype/interfaces/dtitk/tests/test_auto_AffineTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py": true, + "nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_RigidTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py": true, + "nipype/pipeline/plugins/tests/test_base.py": true, + "nipype/testing/tests/test_utils.py": true, + "nipype/workflows/rsfmri/fsl/tests/test_resting.py": true +} \ No newline at end of file diff --git a/nipype/interfaces/dtitk/base.py b/nipype/interfaces/dtitk/base.py index d5a10af8bf..b14ad5ed23 100644 --- a/nipype/interfaces/dtitk/base.py +++ b/nipype/interfaces/dtitk/base.py @@ -26,7 +26,7 @@ from ... import logging from ...utils.filemanip import fname_presuffix -from ..base import traits, CommandLine +from ..base import CommandLine from nipype.interfaces.fsl.base import Info LOGGER = logging.getLogger('interface') diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 8a8a0175fd..c30c5f2a8f 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -41,7 +41,8 @@ class RigidTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', '.aff') + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', + '.aff') outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') return outputs @@ -55,8 +56,8 @@ class AffineInputSpec(CommandLineInputSpec): desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, position=1, argstr="%s") in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, - mandatory=False, position=3, argstr="%s", - desc = "similarity metric") + mandatory=False, position=3, + argstr="%s", desc="similarity metric") in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", desc="initialize using rigid transform??") @@ -88,10 +89,10 @@ class AffineTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz', - '.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', - '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '_aff.nii.gz') return outputs @@ -135,7 +136,7 @@ class DiffeoTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz','_aff_diffeo.df.nii.gz') + '.nii.gz', '_aff_diffeo.df.nii.gz') outputs['out_file'] = self.inputs.in_fixed_tensor.replace( '.nii.gz', '_aff_diffeo.nii.gz') return outputs @@ -182,7 +183,8 @@ def _list_outputs(self): class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") @@ -222,8 +224,8 @@ def _list_outputs(self): class affSymTensor3DVolInputSpec(CommandLineInputSpec): in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, - position=1, argstr="-trans %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, @@ -261,7 +263,8 @@ def _list_outputs(self): class affScalarVolInputSpec(CommandLineInputSpec): in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', position=2, argstr="-target %s") out_path = traits.Str(desc='', mandatory=False, position=3, @@ -299,7 +302,8 @@ def _list_outputs(self): class diffeoScalarVolInputSpec(CommandLineInputSpec): in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") @@ -329,7 +333,7 @@ class diffeoScalarVolTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.diffeoScalarVolTask() - >>> node.inputs.in_tensor = 'fa.nii.gz' + >>> node.inputs.in_volume = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' >>> node.run() # doctest: +SKIP """ @@ -343,6 +347,7 @@ def _list_outputs(self): if not isdefined(self.inputs.out_path): self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd", - newpath=os.path.abspath(".")) + newpath=os.path.abspath( + ".")) outputs['out_file'] = os.path.abspath(self.inputs.out_path) return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 2075ac5253..31546754d8 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,7 +1,7 @@ __author__ = 'kjordan' from ..base import TraitedSpec, CommandLineInputSpec, File, \ - traits, isdefined, split_filename + traits, isdefined import os from .base import CommandLineDtitk @@ -44,8 +44,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -96,8 +96,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -112,13 +112,14 @@ def _gen_filename(self, name): class SVAdjustVoxSpInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, argstr="-target %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=1, argstr="-out %s", name_source="in_volume", + position=1, argstr="-out %s", + name_source="in_file", name_template='%s_origmvd.nii.gz') origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') @@ -152,8 +153,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + plit(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -172,7 +173,7 @@ class TVResampleInputSpec(CommandLineInputSpec): mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", - name_source="in_volume", + name_source="in_file", name_template="%s_resampled.nii.gz") @@ -204,8 +205,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -217,14 +218,15 @@ def _gen_filename(self, name): class SVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, - mandatory=False, position=1, \ + mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=3, argstr="-out %s", name_source="in_volume", + position=3, argstr="-out %s", + name_source="in_file", name_template="%s_resampled.nii.gz") @@ -256,8 +258,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -269,7 +271,7 @@ def _gen_filename(self, name): class TVtoolInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=False, position=0, argstr="-in %s") + mandatory=False, position=0, argstr="-in %s") in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, argstr="-%s", desc='') @@ -303,8 +305,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=_suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -316,7 +318,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, - argstr="%s") + argstr="%s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") in_numbers = traits.Str(desc='LB UB inside_value outside_value', @@ -354,8 +356,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs From b37f65f35dfb461473dbc6bafc141686f7c58c19 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 19 Sep 2017 08:56:45 -0700 Subject: [PATCH 10/24] added auto-generated tests --- .../dtitk/tests/test_auto_BinThreshTask.py | 2 +- .../dtitk/tests/test_auto_SVAdjustVoxSpTask.py | 12 ++++++------ .../dtitk/tests/test_auto_SVResampleTask.py | 4 ++-- .../dtitk/tests/test_auto_TVResampleTask.py | 4 ++-- .../interfaces/dtitk/tests/test_auto_TVtoolTask.py | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py index e430677193..b294953b4d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -12,7 +12,7 @@ def test_BinThreshTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - in_image=dict(argstr='%s', + in_file=dict(argstr='%s', exists=True, mandatory=False, position=0, diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py index c4f1bdeec1..48464fdc0b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -12,16 +12,16 @@ def test_SVAdjustVoxSpTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), + in_file=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), in_target=dict(argstr='-target %s', exists=True, mandatory=False, position=2, ), - in_volume=dict(argstr='-in %s', - exists=True, - mandatory=True, - position=0, - ), in_voxsz=dict(argstr='-vsize %s', exists=True, mandatory=False, @@ -35,7 +35,7 @@ def test_SVAdjustVoxSpTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_origmvd.nii.gz', position=1, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py index 5e4af63e87..28dd918e79 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -17,7 +17,7 @@ def test_SVResampleTask_inputs(): mandatory=False, position=1, ), - in_volume=dict(argstr='-in %s', + in_file=dict(argstr='-in %s', exists=True, mandatory=True, position=0, @@ -30,7 +30,7 @@ def test_SVResampleTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py index ec16b3adee..a591a20634 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -17,7 +17,7 @@ def test_TVResampleTask_inputs(): mandatory=False, position=1, ), - in_tensor=dict(argstr='-in %s', + in_file=dict(argstr='-in %s', exists=True, mandatory=True, position=0, @@ -30,7 +30,7 @@ def test_TVResampleTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py index bba66e0279..8452af91ff 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -12,15 +12,15 @@ def test_TVtoolTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - in_flag=dict(argstr='-%s', + in_file=dict(argstr='-in %s', exists=True, mandatory=False, - position=1, + position=0, ), - in_tensor=dict(argstr='-in %s', + in_flag=dict(argstr='-%s', exists=True, mandatory=False, - position=0, + position=1, ), terminal_output=dict(nohash=True, ), From 3182baafefec643ac1f80ee9a02b70e2fef070a1 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 3 Oct 2017 10:37:55 -0700 Subject: [PATCH 11/24] removed .cache from git --- .cache/v/cache/lastfailed | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .cache/v/cache/lastfailed diff --git a/.cache/v/cache/lastfailed b/.cache/v/cache/lastfailed deleted file mode 100644 index 5fcc465fa5..0000000000 --- a/.cache/v/cache/lastfailed +++ /dev/null @@ -1,22 +0,0 @@ -{ - "nipype/algorithms/tests/test_tsnr.py": true, - "nipype/interfaces/dtitk/tests/test_auto_AffineTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py": true, - "nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_RigidTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py": true, - "nipype/pipeline/plugins/tests/test_base.py": true, - "nipype/testing/tests/test_utils.py": true, - "nipype/workflows/rsfmri/fsl/tests/test_resting.py": true -} \ No newline at end of file From 8812dc777eea64dcdcbc786ca3fb25fae4c3e63b Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 13 Oct 2017 14:18:17 -0700 Subject: [PATCH 12/24] fixed some changes from mgxd code review, but circle failing so testing that --- nipype/interfaces/dtitk/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 0f6588ca5f..e3f3cb7aab 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -6,10 +6,10 @@ """ # from .base import () -from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, - ComposeXfmTask, diffeoSymTensor3DVolTask, - affSymTensor3DVolTask, affScalarVolTask, - diffeoScalarVolTask) -from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, - SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, - TVtoolTask, BinThreshTask) +from .registration import (RigidTask, AffineTask, DiffeoTask, + ComposeXfmTask, diffeoSymTensor3DVolTask, + affSymTensor3DVolTask, affScalarVolTask, + diffeoScalarVolTask) +from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, + SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, + TVtoolTask, BinThreshTask) From 6a393ca5b0529bd904ef3f17009a1ee085103286 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 12:00:52 -0700 Subject: [PATCH 13/24] testing file naming --- nipype/interfaces/dtitk/registration.py | 13 +++++++++++-- nipype/interfaces/dtitk/utils.py | 16 ++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index c30c5f2a8f..c07fc67410 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -39,14 +39,23 @@ class RigidTask(CommandLineDtitk): output_spec = RigidOutputSpec _cmd = 'dti_rigid_sn' + def _gen_outfilename(self): + out_file = self.inputs.out_file + if not isdefined(out_file) and isdefined(self.inputs.in_file): + out_file = self._gen_fname(self.inputs.in_file, + suffix='.aff', change_ext=False) + def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', - '.aff') + outputs['out_file_xfm'] = self._gen_outfilename() outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') return outputs + def _gen_fname(self, name): + if name == 'out_file': + return self._gen_outfilename() + class AffineInputSpec(CommandLineInputSpec): in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 31546754d8..9e036597e7 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -117,7 +117,7 @@ class SVAdjustVoxSpInputSpec(CommandLineInputSpec): position=2, argstr="-target %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=1, argstr="-out %s", name_source="in_file", name_template='%s_origmvd.nii.gz') @@ -146,23 +146,23 @@ class SVAdjustVoxSpTask(CommandLineDtitk): _cmd = 'SVAdjustVoxelspace' _suffix = '_reslice' + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, + outputs["out_file"] = self._gen_filename(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( self.inputs.in_file. - plit(".")[1:])) + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs - def _gen_filename(self, name): - if name == "out_file": - return self._list_outputs()["out_file"] - return None - class TVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, From d240443905bd6d53bafbca6e082b76d975368d94 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 13:44:53 -0700 Subject: [PATCH 14/24] Rigid registration node tested and works --- nipype/interfaces/dtitk/registration.py | 37 +++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index c07fc67410..a1ebf1c902 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -14,6 +14,20 @@ class RigidInputSpec(CommandLineInputSpec): similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, mandatory=True, position=2, argstr="%s", desc="similarity metric") + samplingX = traits.Float(mandatory=True, position=3, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingY = traits.Float(mandatory=True, position=4, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingZ = traits.Float(mandatory=True, position=5, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + ftol = traits.Float(mandatory=True, position=6, argstr="%s", + desc="cost function tolerance", default_value=0.01) + useInTrans = traits.Float(mandatory=False, position=7, argstr="%s", + desc="to initialize with existing xfm set as 1", + default_value=1) class RigidOutputSpec(TraitedSpec): @@ -33,23 +47,30 @@ class RigidTask(CommandLineDtitk): >>> node.inputs.fixed_file = 'diffusion.nii' >>> node.inputs.moving_file = 'diffusion.nii' >>> node.inputs.similarity_metric = 'EDS' + >>> node.inputs.samplingX = 4 + >>> node.inputs.samplingY = 4 + >>> node.inputs.samplingZ = 4 + >>> node.inputs.ftol = 0.01 + >>> node.inputs.useInTrans = 1 >>> node.run() # doctest: +SKIP """ input_spec = RigidInputSpec output_spec = RigidOutputSpec - _cmd = 'dti_rigid_sn' + _cmd = 'dti_rigid_reg' def _gen_outfilename(self): - out_file = self.inputs.out_file - if not isdefined(out_file) and isdefined(self.inputs.in_file): - out_file = self._gen_fname(self.inputs.in_file, - suffix='.aff', change_ext=False) + # out_file = self.inputs.out_file + # if not isdefined(out_file) and isdefined(self.inputs.in_file): + out_file = self._gen_fname(self.inputs.in_file, + suffix='.aff', change_ext=False) + return out_file def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self._gen_outfilename() - outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', - '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.moving_file.replace('.nii.gz', + '_aff.nii.gz') return outputs def _gen_fname(self, name): From 0807cdbc623b13880e73c79eaa8cf06b14406c7e Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 15:45:44 -0700 Subject: [PATCH 15/24] tested affine --- nipype/interfaces/dtitk/registration.py | 88 +++++++++++++------------ 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index a1ebf1c902..7c8608cf0a 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -1,5 +1,4 @@ -from ..base import TraitedSpec, CommandLineInputSpec, \ - traits, isdefined +from ..base import TraitedSpec, CommandLineInputSpec, traits, isdefined from ...utils.filemanip import fname_presuffix import os from .base import CommandLineDtitk @@ -44,8 +43,8 @@ class RigidTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.RigidTask() - >>> node.inputs.fixed_file = 'diffusion.nii' - >>> node.inputs.moving_file = 'diffusion.nii' + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -58,13 +57,6 @@ class RigidTask(CommandLineDtitk): output_spec = RigidOutputSpec _cmd = 'dti_rigid_reg' - def _gen_outfilename(self): - # out_file = self.inputs.out_file - # if not isdefined(out_file) and isdefined(self.inputs.in_file): - out_file = self._gen_fname(self.inputs.in_file, - suffix='.aff', change_ext=False) - return out_file - def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', @@ -73,24 +65,30 @@ def _list_outputs(self): '_aff.nii.gz') return outputs - def _gen_fname(self, name): - if name == 'out_file': - return self._gen_outfilename() - class AffineInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", - exists=True, mandatory=False, position=0, - argstr="%s") - in_moving_txt = traits.Str( - desc="moving list of diffusion tensor image paths", exists=True, - mandatory=False, position=1, argstr="%s") - in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, - mandatory=False, position=3, - argstr="%s", desc="similarity metric") - in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, - mandatory=False, position=4, argstr="%s", - desc="initialize using rigid transform??") + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=True, + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, + mandatory=True, position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=True, position=2, argstr="%s", + desc="similarity metric") + samplingX = traits.Float(mandatory=True, position=3, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingY = traits.Float(mandatory=True, position=4, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingZ = traits.Float(mandatory=True, position=5, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + ftol = traits.Float(mandatory=True, position=6, argstr="%s", + desc="cost function tolerance", default_value=0.01) + useInTrans = traits.Float(mandatory=False, position=7, argstr="%s", + desc="to initialize with existing xfm set as 1", + default_value=1) class AffineOutputSpec(TraitedSpec): @@ -100,29 +98,33 @@ class AffineOutputSpec(TraitedSpec): class AffineTask(CommandLineDtitk): """ - Performs affine registration between two tensor volumes - - Example - ------- + Performs affine registration between two tensor volumes - >>> import nipype.interfaces.dtitk as dtitk - >>> node = dtitk.AffineTask() - >>> node.inputs.in_fixed_tensor = 'diffusion.nii' - >>> node.inputs.in_moving_txt = 'dirs.txt' - >>> node.inputs.in_similarity_metric = 'EDS' - >>> node.run() # doctest: +SKIP - """ + Example + ------- + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.AffineTask() + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.similarity_metric = 'EDS' + >>> node.inputs.samplingX = 4 + >>> node.inputs.samplingY = 4 + >>> node.inputs.samplingZ = 4 + >>> node.inputs.ftol = 0.01 + >>> node.inputs.useInTrans = 1 + >>> node.run() # doctest: +SKIP + """ input_spec = AffineInputSpec output_spec = AffineOutputSpec - _cmd = 'dti_affine_sn' + _cmd = 'dti_affine_reg' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.moving_file.replace('.nii.gz', + '_aff.nii.gz') return outputs From 78821e465002ba34e5df63b73693512708b6fa15 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 1 Dec 2017 18:04:47 -0800 Subject: [PATCH 16/24] returned to .nii.gz; will deal with .nii later --- nipype/interfaces/dtitk/registration.py | 51 +++++++++++++++---------- nipype/interfaces/dtitk/utils.py | 10 ++--- stderr.nipype | 3 ++ stdout.nipype | 3 ++ 4 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 stderr.nipype create mode 100644 stdout.nipype diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 7c8608cf0a..6bea8d31b2 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -44,7 +44,7 @@ class RigidTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.RigidTask() >>> node.inputs.fixed_file = 'diffusion.nii.gz' - >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -106,7 +106,7 @@ class AffineTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.AffineTask() >>> node.inputs.fixed_file = 'diffusion.nii.gz' - >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -129,16 +129,23 @@ def _list_outputs(self): class DiffeoInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", - exists=True, mandatory=False, position=0, - argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image " - "paths", exists=True, mandatory=False, - position=1, argstr="%s") - in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, - argstr="%s") - in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, - position=3, argstr="%s") + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + moving_file = traits.Str(desc="moving diffusion tensor image", + exists=True, mandatory=False, + position=1, argstr="%s") + mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, + argstr="%s") + legacy = traits.Float(desc="legacy parameter; always set to 1", + exists=True, mandatory=True, + position=3, default_value=1, argstr="%s") + n_iters = traits.Float(desc="number of iterations", + exists=True, mandatory=True, + position=4, default_value=6, argstr="%s") + ftol = traits.Float(desc="iteration for the optimization to stop", + exists=True, mandatory=True, + position=5, default_value=0.002, argstr="%s") class DiffeoOutputSpec(TraitedSpec): @@ -155,22 +162,24 @@ class DiffeoTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.DiffeoTask() - >>> node.inputs.in_fixed_tensor = 'diffusion.nii' - >>> node.inputs.in_moving_txt = 'dirs.txt' - >>> node.inputs.in_mask = 'mask.nii' - >>> node.inputs.in_numbers = '6 0.002' + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' + >>> node.inputs.mask = 'mask.nii.gz' + >>> node.inputs.legacy = 1 + >>> node.inputs.n_iters = 6 + >>> node.inputs.ftol = 0.002 >>> node.run() # doctest: +SKIP """ input_spec = DiffeoInputSpec output_spec = DiffeoOutputSpec - _cmd = 'dti_diffeomorphic_sn' + _cmd = 'dti_diffeomorphic_reg' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff_diffeo.df.nii.gz') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff_diffeo.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace( + '.nii.gz', '_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.moving_file.replace( + '.nii.gz', '_diffeo.nii.gz') return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 9e036597e7..354ca165db 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -138,7 +138,7 @@ class SVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVAdjustVoxSpTask() - >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_file = 'diffusion.nii.gz' >>> node.run() # doctest: +SKIP """ input_spec = SVAdjustVoxSpInputSpec @@ -156,8 +156,8 @@ def _list_outputs(self): outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): outputs["out_file"] = self._gen_filename(self.inputs.in_file, - suffix=self._suffix, - ext='.' + '.'.join( + suffix=self._suffix, + ext='.' + '.'.join( self.inputs.in_file. split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) @@ -171,7 +171,7 @@ class TVResampleInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") @@ -190,7 +190,7 @@ class TVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVResampleTask() - >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_file = 'diffusion.nii.gz' >>> node.run() # doctest: +SKIP """ input_spec = TVResampleInputSpec diff --git a/stderr.nipype b/stderr.nipype new file mode 100644 index 0000000000..5de72f2f86 --- /dev/null +++ b/stderr.nipype @@ -0,0 +1,3 @@ +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 191: [: 1.0: integer expression expected +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 197: [: 6.0: integer expression expected +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 205: [: 6.0: integer expression expected diff --git a/stdout.nipype b/stdout.nipype new file mode 100644 index 0000000000..a9c6c87468 --- /dev/null +++ b/stdout.nipype @@ -0,0 +1,3 @@ +registering /Users/kesshijordan/ref_data/interscan_dys/Trio/IC004-1_dti_b2000_EC_tensorx1000_aff.nii.gz to /Users/kesshijordan/ref_data/interscan_dys/Prisma/IC004-4_dti_b2500_SC_EC_tensorx1000.nii.gz ... +starting at Mon Oct 30 18:05:41 PDT 2017 +ending at Mon Oct 30 18:05:41 PDT 2017 From 948811f62fa96af89b7a295d021927dfaf986983 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Sun, 3 Dec 2017 11:41:30 -0800 Subject: [PATCH 17/24] changed output var names --- nipype/interfaces/dtitk/registration.py | 22 +++++++++++----------- nipype/interfaces/dtitk/utils.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 6bea8d31b2..2a6baf1343 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -188,7 +188,7 @@ class ComposeXfmInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-df %s") in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") - out_path = traits.Str(desc='output_path', exists=True, mandatory=False, + out_file = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", name_source="in_df", name_template="%s_comboaff.nii.gz") @@ -229,7 +229,7 @@ class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") @@ -258,7 +258,7 @@ class diffeoSymTensor3DVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path + outputs['out_file'] = self.inputs.out_file return outputs @@ -269,7 +269,7 @@ class affSymTensor3DVolInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_tensor", name_template="%s_affxfmd.nii.gz") @@ -297,7 +297,7 @@ class affSymTensor3DVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs @@ -308,7 +308,7 @@ class affScalarVolInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', position=2, argstr="-target %s") - out_path = traits.Str(desc='', mandatory=False, position=3, + out_file = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", name_source="in_volume", name_template="%s_affxfmd.nii.gz") @@ -336,7 +336,7 @@ class affScalarVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs @@ -348,7 +348,7 @@ class diffeoScalarVolInputSpec(CommandLineInputSpec): position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - out_path = traits.Str(desc='', position=1, argstr="-out %s", + = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", name_template="%s_diffeoxfmd.nii.gz") in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, @@ -385,10 +385,10 @@ class diffeoScalarVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, + if not isdefined(self.inputs.out_file): + self.inputs.out_file = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd", newpath=os.path.abspath( ".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 354ca165db..1eb8b6f715 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -224,7 +224,7 @@ class SVResampleInputSpec(CommandLineInputSpec): argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") @@ -319,7 +319,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, From 89628d0b48890b8e7f2d287a843f6f70b85d2228 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 4 Dec 2017 14:47:42 -0800 Subject: [PATCH 18/24] fixed typo --- nipype/interfaces/dtitk/registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 2a6baf1343..3dd1c068c8 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -348,7 +348,7 @@ class diffeoScalarVolInputSpec(CommandLineInputSpec): position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - = traits.Str(desc='', position=1, argstr="-out %s", + out_file = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", name_template="%s_diffeoxfmd.nii.gz") in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, From 9c8440505bc39458e3c374daec05dc5ae4360a3b Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 4 Dec 2017 18:03:03 -0800 Subject: [PATCH 19/24] fix typo --- nipype/interfaces/dtitk/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 1eb8b6f715..86e0c08b8c 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -224,7 +224,7 @@ class SVResampleInputSpec(CommandLineInputSpec): argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") From 7ad09b8c961f65a81febbd6e5825a29de4ebfc38 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 5 Dec 2017 17:54:03 -0800 Subject: [PATCH 20/24] regenerated tests so var names are updated --- .../afni/tests/test_auto_TCatSubBrick.py | 6 ++- .../dtitk/tests/test_auto_AffineTask.py | 44 +++++++++++++------ .../dtitk/tests/test_auto_BinThreshTask.py | 5 ++- .../dtitk/tests/test_auto_CommandLineDtitk.py | 3 +- .../dtitk/tests/test_auto_ComposeXfmTask.py | 5 ++- .../dtitk/tests/test_auto_DiffeoTask.py | 29 ++++++++---- .../dtitk/tests/test_auto_RigidTask.py | 23 +++++++++- .../tests/test_auto_SVAdjustVoxSpTask.py | 5 ++- .../dtitk/tests/test_auto_SVResampleTask.py | 5 ++- .../tests/test_auto_TVAdjustOriginTask.py | 3 +- .../tests/test_auto_TVAdjustVoxSpTask.py | 3 +- .../dtitk/tests/test_auto_TVResampleTask.py | 5 ++- .../dtitk/tests/test_auto_TVtoolTask.py | 3 +- .../dtitk/tests/test_auto_affScalarVolTask.py | 5 ++- .../tests/test_auto_affSymTensor3DVolTask.py | 5 ++- .../tests/test_auto_diffeoScalarVolTask.py | 5 ++- .../test_auto_diffeoSymTensor3DVolTask.py | 5 ++- .../tests/test_auto_SimpleInterface.py | 16 +++++++ 18 files changed, 128 insertions(+), 47 deletions(-) create mode 100644 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py index a32e594298..da3b0fb383 100644 --- a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -17,6 +17,9 @@ def test_TCatSubBrick_inputs(): mandatory=True, position=-1, ), + num_threads=dict(nohash=True, + usedefault=True, + ), out_file=dict(argstr='-prefix %s', genfile=True, ), @@ -24,7 +27,8 @@ def test_TCatSubBrick_inputs(): rlt=dict(argstr='-rlt%s', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TCatSubBrick.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py index 865619366a..6e74049c5a 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py @@ -9,30 +9,46 @@ def test_AffineTask_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_fixed_tensor=dict(argstr='%s', + fixed_file=dict(argstr='%s', exists=True, - mandatory=False, + mandatory=True, position=0, ), - in_moving_txt=dict(argstr='%s', + ftol=dict(argstr='%s', + mandatory=True, + position=6, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + moving_file=dict(argstr='%s', exists=True, - mandatory=False, + mandatory=True, position=1, ), - in_similarity_metric=dict(argstr='%s', - exists=True, - mandatory=False, + samplingX=dict(argstr='%s', + mandatory=True, position=3, ), - in_usetrans_flag=dict(argstr='%s', - exists=True, - mandatory=False, + samplingY=dict(argstr='%s', + mandatory=True, position=4, ), - terminal_output=dict(nohash=True, + samplingZ=dict(argstr='%s', + mandatory=True, + position=5, + ), + similarity_metric=dict(argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict(argstr='%s', + mandatory=False, + position=7, ), ) inputs = AffineTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py index b294953b4d..65d97cf574 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -22,12 +22,13 @@ def test_BinThreshTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='%s', + out_file=dict(argstr='%s', exists=True, mandatory=False, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = BinThreshTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py index e0934c9b76..b6b55b809a 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py +++ b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py @@ -12,7 +12,8 @@ def test_CommandLineDtitk_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = CommandLineDtitk.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py index 9b98fc48e4..e0fed353c9 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py @@ -22,14 +22,15 @@ def test_ComposeXfmTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_df', name_template='%s_comboaff.nii.gz', position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = ComposeXfmTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py index ad3b8b7366..0363ce3203 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py @@ -9,30 +9,41 @@ def test_DiffeoTask_inputs(): environ=dict(nohash=True, usedefault=True, ), + fixed_file=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + ftol=dict(argstr='%s', + exists=True, + mandatory=True, + position=5, + ), ignore_exception=dict(nohash=True, usedefault=True, ), - in_fixed_tensor=dict(argstr='%s', + legacy=dict(argstr='%s', exists=True, - mandatory=False, - position=0, + mandatory=True, + position=3, ), - in_mask=dict(argstr='%s', + mask=dict(argstr='%s', exists=True, mandatory=False, position=2, ), - in_moving_txt=dict(argstr='%s', + moving_file=dict(argstr='%s', exists=True, mandatory=False, position=1, ), - in_numbers=dict(argstr='%s', + n_iters=dict(argstr='%s', exists=True, - mandatory=False, - position=3, + mandatory=True, + position=4, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = DiffeoTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py index e099d4c6a0..0abd84091d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py @@ -14,6 +14,10 @@ def test_RigidTask_inputs(): mandatory=True, position=0, ), + ftol=dict(argstr='%s', + mandatory=True, + position=6, + ), ignore_exception=dict(nohash=True, usedefault=True, ), @@ -22,12 +26,29 @@ def test_RigidTask_inputs(): mandatory=True, position=1, ), + samplingX=dict(argstr='%s', + mandatory=True, + position=3, + ), + samplingY=dict(argstr='%s', + mandatory=True, + position=4, + ), + samplingZ=dict(argstr='%s', + mandatory=True, + position=5, + ), similarity_metric=dict(argstr='%s', exists=True, mandatory=True, position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict(argstr='%s', + mandatory=False, + position=7, ), ) inputs = RigidTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py index 48464fdc0b..1660485f1b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -32,14 +32,15 @@ def test_SVAdjustVoxSpTask_inputs(): mandatory=False, position=4, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_origmvd.nii.gz', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = SVAdjustVoxSpTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py index 28dd918e79..a6528fb696 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -27,14 +27,15 @@ def test_SVResampleTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = SVResampleTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py index 55947095a9..09477662a2 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py @@ -25,7 +25,8 @@ def test_TVAdjustOriginTask_inputs(): genfile=True, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVAdjustOriginTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py index 1512ff67a4..8bca0161cf 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py @@ -30,7 +30,8 @@ def test_TVAdjustVoxSpTask_inputs(): mandatory=False, position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), vsize=dict(argstr='-vsize %s', exists=True, diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py index a591a20634..6168a67682 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -27,14 +27,15 @@ def test_TVResampleTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVResampleTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py index 8452af91ff..75e8681685 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -22,7 +22,8 @@ def test_TVtoolTask_inputs(): mandatory=False, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVtoolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py index 55dc779e9a..0cfb8a820d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py @@ -25,13 +25,14 @@ def test_affScalarVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', mandatory=False, name_source='in_volume', name_template='%s_affxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = affScalarVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py index c0da08cb55..9b86a7457d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py @@ -27,14 +27,15 @@ def test_affSymTensor3DVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_tensor', name_template='%s_affxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = affSymTensor3DVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py index c396ec6e4a..483dc1254c 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py @@ -47,12 +47,13 @@ def test_diffeoScalarVolTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', name_source='in_volume', name_template='%s_diffeoxfmd.nii.gz', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = diffeoScalarVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py index af2069fe4f..8d12125421 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py @@ -27,14 +27,15 @@ def test_diffeoSymTensor3DVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_tensor', name_template='%s_diffeoxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = diffeoSymTensor3DVolTask.input_spec() diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py new file mode 100644 index 0000000000..b00d1f9a3c --- /dev/null +++ b/nipype/interfaces/tests/test_auto_SimpleInterface.py @@ -0,0 +1,16 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import SimpleInterface + + +def test_SimpleInterface_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + ) + inputs = SimpleInterface.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + From 64f7202c3732a843b8d1d632792bf5e158d4fe23 Mon Sep 17 00:00:00 2001 From: Kesshi Jordan Date: Thu, 11 Jan 2018 13:38:34 -0800 Subject: [PATCH 21/24] Delete stderr.nipype --- stderr.nipype | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 stderr.nipype diff --git a/stderr.nipype b/stderr.nipype deleted file mode 100644 index 5de72f2f86..0000000000 --- a/stderr.nipype +++ /dev/null @@ -1,3 +0,0 @@ -/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 191: [: 1.0: integer expression expected -/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 197: [: 6.0: integer expression expected -/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 205: [: 6.0: integer expression expected From 80a42621c00cd6ea6543820caac081010be17d85 Mon Sep 17 00:00:00 2001 From: Kesshi Jordan Date: Thu, 11 Jan 2018 13:38:49 -0800 Subject: [PATCH 22/24] Delete stdout.nipype --- stdout.nipype | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 stdout.nipype diff --git a/stdout.nipype b/stdout.nipype deleted file mode 100644 index a9c6c87468..0000000000 --- a/stdout.nipype +++ /dev/null @@ -1,3 +0,0 @@ -registering /Users/kesshijordan/ref_data/interscan_dys/Trio/IC004-1_dti_b2000_EC_tensorx1000_aff.nii.gz to /Users/kesshijordan/ref_data/interscan_dys/Prisma/IC004-4_dti_b2500_SC_EC_tensorx1000.nii.gz ... -starting at Mon Oct 30 18:05:41 PDT 2017 -ending at Mon Oct 30 18:05:41 PDT 2017 From da312360264b7d3e1d625c8a4c44de065eff05a7 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Fri, 19 Jan 2018 09:22:31 -0600 Subject: [PATCH 23/24] make specs --- .../dtitk/tests/test_auto_AffineTask.py | 111 ++++++++-------- .../dtitk/tests/test_auto_BinThreshTask.py | 64 +++++----- .../dtitk/tests/test_auto_CommandLineDtitk.py | 27 ++-- .../dtitk/tests/test_auto_ComposeXfmTask.py | 68 +++++----- .../dtitk/tests/test_auto_DiffeoTask.py | 99 ++++++++------- .../dtitk/tests/test_auto_RigidTask.py | 111 ++++++++-------- .../tests/test_auto_SVAdjustVoxSpTask.py | 90 ++++++------- .../dtitk/tests/test_auto_SVResampleTask.py | 79 ++++++------ .../tests/test_auto_TVAdjustOriginTask.py | 61 ++++----- .../tests/test_auto_TVAdjustVoxSpTask.py | 83 ++++++------ .../dtitk/tests/test_auto_TVResampleTask.py | 79 ++++++------ .../dtitk/tests/test_auto_TVtoolTask.py | 53 ++++---- .../dtitk/tests/test_auto_affScalarVolTask.py | 73 ++++++----- .../tests/test_auto_affSymTensor3DVolTask.py | 79 ++++++------ .../tests/test_auto_diffeoScalarVolTask.py | 119 ++++++++++-------- .../test_auto_diffeoSymTensor3DVolTask.py | 79 ++++++------ 16 files changed, 684 insertions(+), 591 deletions(-) diff --git a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py index 6e74049c5a..cff7d1c0d1 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py @@ -4,63 +4,74 @@ def test_AffineTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - fixed_file=dict(argstr='%s', - exists=True, - mandatory=True, - position=0, - ), - ftol=dict(argstr='%s', - mandatory=True, - position=6, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - moving_file=dict(argstr='%s', - exists=True, - mandatory=True, - position=1, - ), - samplingX=dict(argstr='%s', - mandatory=True, - position=3, - ), - samplingY=dict(argstr='%s', - mandatory=True, - position=4, - ), - samplingZ=dict(argstr='%s', - mandatory=True, - position=5, - ), - similarity_metric=dict(argstr='%s', - exists=True, - mandatory=True, - position=2, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - useInTrans=dict(argstr='%s', - mandatory=False, - position=7, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + fixed_file=dict( + argstr='%s', + exists=True, + mandatory=True, + position=0, + ), + ftol=dict( + argstr='%s', + mandatory=True, + position=6, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + moving_file=dict( + argstr='%s', + exists=True, + mandatory=True, + position=1, + ), + samplingX=dict( + argstr='%s', + mandatory=True, + position=3, + ), + samplingY=dict( + argstr='%s', + mandatory=True, + position=4, + ), + samplingZ=dict( + argstr='%s', + mandatory=True, + position=5, + ), + similarity_metric=dict( + argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict( + argstr='%s', + mandatory=False, + position=7, + ), ) inputs = AffineTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_AffineTask_outputs(): - output_map = dict(out_file=dict(), - out_file_xfm=dict(), + output_map = dict( + out_file=dict(), + out_file_xfm=dict(), ) outputs = AffineTask.output_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py index 65d97cf574..028a820bae 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -4,43 +4,47 @@ def test_BinThreshTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='%s', - exists=True, - mandatory=False, - position=0, - ), - in_numbers=dict(argstr='%s', - exists=True, - mandatory=False, - position=2, - ), - out_file=dict(argstr='%s', - exists=True, - mandatory=False, - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_numbers=dict( + argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + out_file=dict( + argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = BinThreshTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_BinThreshTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = BinThreshTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py index b6b55b809a..fbd1fcb4ac 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py +++ b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py @@ -4,21 +4,24 @@ def test_CommandLineDtitk_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = CommandLineDtitk.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - diff --git a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py index e0fed353c9..ec5d2153ea 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py @@ -4,45 +4,49 @@ def test_ComposeXfmTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_aff=dict(argstr='-aff %s', - exists=True, - mandatory=False, - position=0, - ), - in_df=dict(argstr='-df %s', - exists=True, - mandatory=False, - position=1, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_df', - name_template='%s_comboaff.nii.gz', - position=2, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_aff=dict( + argstr='-aff %s', + exists=True, + mandatory=False, + position=0, + ), + in_df=dict( + argstr='-df %s', + exists=True, + mandatory=False, + position=1, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_df', + name_template='%s_comboaff.nii.gz', + position=2, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = ComposeXfmTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_ComposeXfmTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = ComposeXfmTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py index 0363ce3203..a0bc0a580b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py @@ -4,58 +4,67 @@ def test_DiffeoTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - fixed_file=dict(argstr='%s', - exists=True, - mandatory=False, - position=0, - ), - ftol=dict(argstr='%s', - exists=True, - mandatory=True, - position=5, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - legacy=dict(argstr='%s', - exists=True, - mandatory=True, - position=3, - ), - mask=dict(argstr='%s', - exists=True, - mandatory=False, - position=2, - ), - moving_file=dict(argstr='%s', - exists=True, - mandatory=False, - position=1, - ), - n_iters=dict(argstr='%s', - exists=True, - mandatory=True, - position=4, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + fixed_file=dict( + argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + ftol=dict( + argstr='%s', + exists=True, + mandatory=True, + position=5, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + legacy=dict( + argstr='%s', + exists=True, + mandatory=True, + position=3, + ), + mask=dict( + argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + moving_file=dict( + argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + n_iters=dict( + argstr='%s', + exists=True, + mandatory=True, + position=4, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = DiffeoTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_DiffeoTask_outputs(): - output_map = dict(out_file=dict(), - out_file_xfm=dict(), + output_map = dict( + out_file=dict(), + out_file_xfm=dict(), ) outputs = DiffeoTask.output_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py index 0abd84091d..fbe65d92f2 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py @@ -4,63 +4,74 @@ def test_RigidTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - fixed_file=dict(argstr='%s', - exists=True, - mandatory=True, - position=0, - ), - ftol=dict(argstr='%s', - mandatory=True, - position=6, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - moving_file=dict(argstr='%s', - exists=True, - mandatory=True, - position=1, - ), - samplingX=dict(argstr='%s', - mandatory=True, - position=3, - ), - samplingY=dict(argstr='%s', - mandatory=True, - position=4, - ), - samplingZ=dict(argstr='%s', - mandatory=True, - position=5, - ), - similarity_metric=dict(argstr='%s', - exists=True, - mandatory=True, - position=2, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - useInTrans=dict(argstr='%s', - mandatory=False, - position=7, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + fixed_file=dict( + argstr='%s', + exists=True, + mandatory=True, + position=0, + ), + ftol=dict( + argstr='%s', + mandatory=True, + position=6, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + moving_file=dict( + argstr='%s', + exists=True, + mandatory=True, + position=1, + ), + samplingX=dict( + argstr='%s', + mandatory=True, + position=3, + ), + samplingY=dict( + argstr='%s', + mandatory=True, + position=4, + ), + samplingZ=dict( + argstr='%s', + mandatory=True, + position=5, + ), + similarity_metric=dict( + argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict( + argstr='%s', + mandatory=False, + position=7, + ), ) inputs = RigidTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_RigidTask_outputs(): - output_map = dict(out_file=dict(), - out_file_xfm=dict(), + output_map = dict( + out_file=dict(), + out_file_xfm=dict(), ) outputs = RigidTask.output_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py index 1660485f1b..d60b203ffa 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -4,55 +4,61 @@ def test_SVAdjustVoxSpTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-in %s', - exists=True, - mandatory=True, - position=0, - ), - in_target=dict(argstr='-target %s', - exists=True, - mandatory=False, - position=2, - ), - in_voxsz=dict(argstr='-vsize %s', - exists=True, - mandatory=False, - position=3, - ), - origin=dict(argstr='-origin %s', - exists=True, - mandatory=False, - position=4, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_file', - name_template='%s_origmvd.nii.gz', - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_target=dict( + argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_voxsz=dict( + argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), + origin=dict( + argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_file', + name_template='%s_origmvd.nii.gz', + position=1, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = SVAdjustVoxSpTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_SVAdjustVoxSpTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = SVAdjustVoxSpTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py index a6528fb696..64f4cadb60 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -4,50 +4,55 @@ def test_SVResampleTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_arraysz=dict(argstr='-size %s', - exists=True, - mandatory=False, - position=1, - ), - in_file=dict(argstr='-in %s', - exists=True, - mandatory=True, - position=0, - ), - in_voxsz=dict(argstr='-vsize %s', - exists=True, - mandatory=False, - position=2, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_file', - name_template='%s_resampled.nii.gz', - position=3, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_arraysz=dict( + argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_file=dict( + argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict( + argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_file', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = SVResampleTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_SVResampleTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = SVResampleTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py index 09477662a2..bad6039007 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py @@ -4,42 +4,45 @@ def test_TVAdjustOriginTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-in %s', - mandatory=True, - position=0, - ), - origin=dict(argstr='-origin %s', - exists=True, - mandatory=False, - position=4, - ), - out_file=dict(argstr='-out %s', - genfile=True, - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict( + argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict( + argstr='-out %s', + genfile=True, + position=1, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = TVAdjustOriginTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_TVAdjustOriginTask_outputs(): - output_map = dict(out_file=dict(exists=True, - ), - ) + output_map = dict(out_file=dict(exists=True, ), ) outputs = TVAdjustOriginTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py index 8bca0161cf..2da57d8862 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py @@ -4,52 +4,57 @@ def test_TVAdjustVoxSpTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-in %s', - mandatory=True, - position=0, - ), - origin=dict(argstr='-origin %s', - exists=True, - mandatory=False, - position=4, - ), - out_file=dict(argstr='-out %s', - genfile=True, - position=1, - ), - target=dict(argstr='-target %s', - exists=True, - mandatory=False, - position=2, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - vsize=dict(argstr='-vsize %s', - exists=True, - mandatory=False, - position=3, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict( + argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict( + argstr='-out %s', + genfile=True, + position=1, + ), + target=dict( + argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), + vsize=dict( + argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), ) inputs = TVAdjustVoxSpTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_TVAdjustVoxSpTask_outputs(): - output_map = dict(out_file=dict(exists=True, - ), - ) + output_map = dict(out_file=dict(exists=True, ), ) outputs = TVAdjustVoxSpTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py index 6168a67682..044e8f67d2 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -4,50 +4,55 @@ def test_TVResampleTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_arraysz=dict(argstr='-size %s', - exists=True, - mandatory=False, - position=1, - ), - in_file=dict(argstr='-in %s', - exists=True, - mandatory=True, - position=0, - ), - in_voxsz=dict(argstr='-vsize %s', - exists=True, - mandatory=False, - position=2, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_file', - name_template='%s_resampled.nii.gz', - position=3, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_arraysz=dict( + argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_file=dict( + argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict( + argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_file', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = TVResampleTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_TVResampleTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = TVResampleTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py index 75e8681685..8fb0ce055a 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -4,38 +4,41 @@ def test_TVtoolTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-in %s', - exists=True, - mandatory=False, - position=0, - ), - in_flag=dict(argstr='-%s', - exists=True, - mandatory=False, - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_flag=dict( + argstr='-%s', + exists=True, + mandatory=False, + position=1, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = TVtoolTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_TVtoolTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = TVtoolTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py index 0cfb8a820d..02d22b1820 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py @@ -4,47 +4,52 @@ def test_affScalarVolTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_target=dict(argstr='-target %s', - position=2, - ), - in_volume=dict(argstr='-in %s', - exists=True, - mandatory=False, - position=0, - ), - in_xfm=dict(argstr='-trans %s', - exists=True, - mandatory=False, - position=1, - ), - out_file=dict(argstr='-out %s', - mandatory=False, - name_source='in_volume', - name_template='%s_affxfmd.nii.gz', - position=3, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_target=dict( + argstr='-target %s', + position=2, + ), + in_volume=dict( + argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict( + argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_file=dict( + argstr='-out %s', + mandatory=False, + name_source='in_volume', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = affScalarVolTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_affScalarVolTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = affScalarVolTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py index 9b86a7457d..40198fa9e7 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py @@ -4,50 +4,55 @@ def test_affSymTensor3DVolTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_target=dict(argstr='-target %s', - exists=True, - mandatory=False, - position=2, - ), - in_tensor=dict(argstr='-in %s', - exists=True, - mandatory=False, - position=0, - ), - in_xfm=dict(argstr='-trans %s', - exists=True, - mandatory=False, - position=1, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_tensor', - name_template='%s_affxfmd.nii.gz', - position=3, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_target=dict( + argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict( + argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict( + argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = affSymTensor3DVolTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_affSymTensor3DVolTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = affSymTensor3DVolTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py index 483dc1254c..5b02f34984 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py @@ -4,68 +4,77 @@ def test_diffeoScalarVolTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_flip=dict(argstr='-flip %s', - exists=True, - mandatory=False, - position=5, - ), - in_interp=dict(argstr='-interp %s', - exists=True, - mandatory=False, - position=7, - ), - in_target=dict(argstr='-target %s', - exists=True, - mandatory=False, - position=3, - ), - in_type=dict(argstr='-type %s', - exists=True, - mandatory=False, - position=6, - ), - in_volume=dict(argstr='-in %s', - exists=True, - mandatory=False, - position=0, - ), - in_vsize=dict(argstr='-vsize %s', - exists=True, - mandatory=False, - position=4, - ), - in_xfm=dict(argstr='-trans %s', - exists=True, - mandatory=False, - position=2, - ), - out_file=dict(argstr='-out %s', - name_source='in_volume', - name_template='%s_diffeoxfmd.nii.gz', - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_flip=dict( + argstr='-flip %s', + exists=True, + mandatory=False, + position=5, + ), + in_interp=dict( + argstr='-interp %s', + exists=True, + mandatory=False, + position=7, + ), + in_target=dict( + argstr='-target %s', + exists=True, + mandatory=False, + position=3, + ), + in_type=dict( + argstr='-type %s', + exists=True, + mandatory=False, + position=6, + ), + in_volume=dict( + argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_vsize=dict( + argstr='-vsize %s', + exists=True, + mandatory=False, + position=4, + ), + in_xfm=dict( + argstr='-trans %s', + exists=True, + mandatory=False, + position=2, + ), + out_file=dict( + argstr='-out %s', + name_source='in_volume', + name_template='%s_diffeoxfmd.nii.gz', + position=1, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = diffeoScalarVolTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_diffeoScalarVolTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = diffeoScalarVolTask.output_spec() for key, metadata in list(output_map.items()): diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py index 8d12125421..7f3926c71b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py @@ -4,50 +4,55 @@ def test_diffeoSymTensor3DVolTask_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_target=dict(argstr='-target %s', - exists=True, - mandatory=False, - position=2, - ), - in_tensor=dict(argstr='-in %s', - exists=True, - mandatory=False, - position=0, - ), - in_xfm=dict(argstr='-trans %s', - exists=True, - mandatory=False, - position=1, - ), - out_file=dict(argstr='-out %s', - exists=True, - mandatory=False, - name_source='in_tensor', - name_template='%s_diffeoxfmd.nii.gz', - position=3, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_target=dict( + argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict( + argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict( + argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_file=dict( + argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_diffeoxfmd.nii.gz', + position=3, + ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), ) inputs = diffeoSymTensor3DVolTask.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value - - def test_diffeoSymTensor3DVolTask_outputs(): - output_map = dict(out_file=dict(), - ) + output_map = dict(out_file=dict(), ) outputs = diffeoSymTensor3DVolTask.output_spec() for key, metadata in list(output_map.items()): From f60c149009300a5cdd14173608187ac27c2d3c9a Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Fri, 19 Jan 2018 09:23:41 -0600 Subject: [PATCH 24/24] TEST: Drop extra auto test --- .../tests/test_auto_SimpleInterface.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py deleted file mode 100644 index b00d1f9a3c..0000000000 --- a/nipype/interfaces/tests/test_auto_SimpleInterface.py +++ /dev/null @@ -1,16 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..base import SimpleInterface - - -def test_SimpleInterface_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - ) - inputs = SimpleInterface.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value -