diff --git a/nipype/interfaces/fsl/epi.py b/nipype/interfaces/fsl/epi.py index 5eec707a69..ab1cfc3f6a 100644 --- a/nipype/interfaces/fsl/epi.py +++ b/nipype/interfaces/fsl/epi.py @@ -305,32 +305,60 @@ def _list_outputs(self): class EddyInputSpec( FSLCommandInputSpec ): - in_file = File(exists=True, mandatory=True, desc='File containing all the images to estimate distortions for', argstr='--imain=%s' ) - in_mask = File(exists=True, mandatory=True, desc='Mask to indicate brain', argstr='--mask=%s' ) - in_index = File(exists=True, mandatory=True, desc='File containing indices for all volumes in --imain into --acqp and --topup', argstr='--index=%s' ) - in_acqp = File(exists=True, mandatory=True, desc='File containing acquisition parameters', argstr='--acqp=%s' ) - in_bvec = File(exists=True, mandatory=True, desc='File containing the b-vectors for all volumes in --imain', argstr='--bvecs=%s' ) - in_bval = File(exists=True, mandatory=True, desc='File containing the b-values for all volumes in --imain', argstr='--bvals=%s' ) + in_file = File(exists=True, mandatory=True, + desc=('File containing all the images to estimate ' + 'distortions for'), argstr='--imain=%s') + in_mask = File(exists=True, mandatory=True, + desc='Mask to indicate brain', argstr='--mask=%s') + in_index = File(exists=True, mandatory=True, + desc=('File containing indices for all volumes in --imain ' + 'into --acqp and --topup'), argstr='--index=%s') + in_acqp = File(exists=True, mandatory=True, + desc='File containing acquisition parameters', + argstr='--acqp=%s' ) + in_bvec = File(exists=True, mandatory=True, + desc=('File containing the b-vectors for all volumes in ' + '--imain'), argstr='--bvecs=%s') + in_bval = File(exists=True, mandatory=True, + desc=('File containing the b-values for all volumes in ' + '--imain'), argstr='--bvals=%s') + out_base = File( desc='basename for output (warped) image', + argstr='--out=%s' ) + session = File(exists=True, + desc=('File containing session indices for all volumes in ' + '--imain'), argstr='--session=%s') + in_topup_fieldcoef = File(exists=True, argstr="--topup=%s", copyfile=False, + requires=['in_topup_movpar'], + desc=('topup file containing the field ' + 'coefficients')) + in_topup_movpar = File(exists=True, requires=['in_topup_fieldcoef'], + copyfile=False, desc='topup movpar.txt file') + flm = traits.Enum(('linear','quadratic','cubic'), + desc='First level EC model', argstr='--flm=%s' ) + fwhm = traits.Float(desc=('FWHM for conditioning filter when estimating ' + 'the parameters'), argstr='--fwhm=%s') + niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s') + method = traits.Enum(('jac','lsr'), argstr='--resamp=%s', + desc=('Final resampling method (jacobian/least ' + 'squeares)')) + repol = traits.Bool( False, desc='Detect and replace outlier slices', + argstr='--repol' ) - out_base = File( desc='basename for output (warped) image', argstr='--out=%s' ) - - - session = File(exists=True, desc='File containing session indices for all volumes in --imain', argstr='--session=%s' ) - in_topup = File(exists=True, desc='Base name for output files from topup', argstr='--topup=%s' ) - flm = traits.Enum( ('linear','quadratic','cubic'), desc='First level EC model', argstr='--flm=%s' ) - fwhm = traits.Float( desc='FWHM for conditioning filter when estimating the parameters', argstr='--fwhm=%s' ) - niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s' ) - method = traits.Enum( ('jac','lsr'), argstr='--resamp=%s', desc='Final resampling method (jacobian/least squeares)' ) - repol = traits.Bool( False, desc='Detect and replace outlier slices', argstr='--repol' ) class EddyOutputSpec( TraitedSpec ): - out_corrected = File( exists=True, desc='4D image file containing all the corrected volumes' ) - out_parameter = File( exists=True, desc='text file with parameters definining the field and movement for each scan') + out_corrected = File(exists=True, + desc=('4D image file containing all the corrected ' + 'volumes')) + out_parameter = File(exists=True, + desc=('text file with parameters definining the field ' + 'and movement for each scan')) class Eddy( FSLCommand ): - """ Interface for FSL eddy, a tool for estimating and correcting eddy currents induced distortions. - `User guide `_ and - `more info regarding acqp file `_. + """ Interface for FSL eddy, a tool for estimating and correcting eddy + currents induced distortions. `User guide + `_ and + `more info regarding acqp file + `_. Examples -------- @@ -353,10 +381,15 @@ class Eddy( FSLCommand ): input_spec = EddyInputSpec output_spec = EddyOutputSpec + def _format_arg(self, name, spec, value): + if name == 'in_topup_fieldcoef': + return spec.argstr % value.split('_fieldcoef')[0] + return super(Eddy, self)._format_arg(name, spec, value) + def _parse_inputs( self, skip=None ): if skip is None: skip = [] - + if not isdefined(self.inputs.out_base ): self.inputs.out_base = os.path.abspath( './eddy_corrected' ) return super(Eddy, self)._parse_inputs(skip=skip) @@ -365,7 +398,7 @@ def _parse_inputs( self, skip=None ): def _list_outputs(self): outputs = self.output_spec().get() outputs['out_corrected'] = '%s.nii.gz' % self.inputs.out_base - outputs['out_parameter'] = '%s..eddy_parameters' % self.inputs.out_base + outputs['out_parameter'] = '%s.eddy_parameters' % self.inputs.out_base return outputs diff --git a/nipype/interfaces/fsl/tests/test_auto_Eddy.py b/nipype/interfaces/fsl/tests/test_auto_Eddy.py index 20757beb05..a64d96a8ce 100644 --- a/nipype/interfaces/fsl/tests/test_auto_Eddy.py +++ b/nipype/interfaces/fsl/tests/test_auto_Eddy.py @@ -33,7 +33,12 @@ def test_Eddy_inputs(): in_mask=dict(argstr='--mask=%s', mandatory=True, ), - in_topup=dict(argstr='--topup=%s', + in_topup_fieldcoef=dict(argstr='--topup=%s', + copyfile=False, + requires=['in_topup_movpar'], + ), + in_topup_movpar=dict(copyfile=False, + requires=['in_topup_fieldcoef'], ), method=dict(argstr='--resamp=%s', ), diff --git a/nipype/interfaces/vista/tests/test_auto_Vnifti2Image.py b/nipype/interfaces/vista/tests/test_auto_Vnifti2Image.py index 41cc589002..e60ff26bc1 100644 --- a/nipype/interfaces/vista/tests/test_auto_Vnifti2Image.py +++ b/nipype/interfaces/vista/tests/test_auto_Vnifti2Image.py @@ -1,32 +1,33 @@ # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from nipype.testing import assert_equal from nipype.interfaces.vista.vista import Vnifti2Image + def test_Vnifti2Image_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - out_file=dict(hash_files=False, - name_template='%s.v', - name_source=['in_file'], - keep_extension=False, - position=-1, - argstr='-out %s', - ), - args=dict(argstr='%s', + input_map = dict(args=dict(argstr='%s', ), - terminal_output=dict(nohash=True, - mandatory=True, + attributes=dict(argstr='-attr %s', + mandatory=False, + position=2, ), environ=dict(nohash=True, usedefault=True, ), - in_file=dict(position=1, + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-in %s', mandatory=True, - argstr='-in %s', + position=1, ), - attributes=dict(position=2, - mandatory=False, - argstr='-attr %s', + out_file=dict(argstr='-out %s', + hash_files=False, + keep_extension=False, + name_source=['in_file'], + name_template='%s.v', + position=-1, + ), + terminal_output=dict(mandatory=True, + nohash=True, ), ) inputs = Vnifti2Image.input_spec() @@ -34,6 +35,7 @@ def test_Vnifti2Image_inputs(): for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value + def test_Vnifti2Image_outputs(): output_map = dict(out_file=dict(), ) @@ -42,3 +44,4 @@ def test_Vnifti2Image_outputs(): for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value + diff --git a/nipype/interfaces/vista/tests/test_auto_VtoMat.py b/nipype/interfaces/vista/tests/test_auto_VtoMat.py index 3f6538c201..f51e62c939 100644 --- a/nipype/interfaces/vista/tests/test_auto_VtoMat.py +++ b/nipype/interfaces/vista/tests/test_auto_VtoMat.py @@ -1,28 +1,29 @@ # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from nipype.testing import assert_equal from nipype.interfaces.vista.vista import VtoMat + def test_VtoMat_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, + input_map = dict(args=dict(argstr='%s', ), - out_file=dict(hash_files=False, - name_template='%s.mat', - name_source=['in_file'], - keep_extension=False, - position=-1, - argstr='-out %s', + environ=dict(nohash=True, + usedefault=True, ), - args=dict(argstr='%s', + ignore_exception=dict(nohash=True, + usedefault=True, ), - terminal_output=dict(nohash=True, + in_file=dict(argstr='-in %s', mandatory=True, + position=1, ), - environ=dict(nohash=True, - usedefault=True, + out_file=dict(argstr='-out %s', + hash_files=False, + keep_extension=False, + name_source=['in_file'], + name_template='%s.mat', + position=-1, ), - in_file=dict(position=1, - mandatory=True, - argstr='-in %s', + terminal_output=dict(mandatory=True, + nohash=True, ), ) inputs = VtoMat.input_spec() @@ -30,6 +31,7 @@ def test_VtoMat_inputs(): for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value + def test_VtoMat_outputs(): output_map = dict(out_file=dict(), ) @@ -38,3 +40,4 @@ def test_VtoMat_outputs(): for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value +