1717import numpy as np
1818
1919from nipype .interfaces .fsl .base import FSLCommand , FSLCommandInputSpec , Info
20- from nipype .interfaces .base import (traits , TraitedSpec , OutputMultiPath , File ,
20+ from nipype .interfaces .base import (traits , TraitedSpec , InputMultiPath , File ,
2121 isdefined )
2222
2323
@@ -85,28 +85,28 @@ def _list_outputs(self):
8585
8686
8787class TOPUPInputSpec ( FSLCommandInputSpec ):
88- in_file = File ( exists = True , mandatory = True , desc = 'name of 4D file with images' , argstr = '--imain %s' )
89- encoding_file = File ( exists = True , mandatory = True , desc = 'name of text file with PE directions/times' , argstr = '--datain %s' )
90- out_base = File ( desc = 'base-name of output files (spline coefficients (Hz) and movement parameters)' , argstr = '--out %s' )
91- out_field = File ( argstr = '--fout %s' , desc = 'name of image file with field (Hz)' )
92- out_corrected = File ( argstr = '--iout %s' , desc = 'name of 4D image file with unwarped images' )
93- out_logfile = File ( argstr = '--logout %s' , desc = 'name of log-file' )
94- warp_res = traits .Float ( 10.0 , argstr = '--warpres %f' , desc = '(approximate) resolution (in mm) of warp basis for the different sub-sampling levels' )
95- subsamp = traits .Int ( 1 , argstr = '--subsamp %d' , desc = 'sub-sampling scheme, default 1' )
96- fwhm = traits .Float ( 8.0 , argstr = '--fwhm %f' , desc = 'FWHM (in mm) of gaussian smoothing kernel' )
97- config = traits .String ('b02b0.cnf' , desc = 'Name of config file specifying command line arguments' , argstr = '--config %s' , usedefault = True )
98- max_iter = traits .Int ( 5 , argstr = '--miter %d' , desc = 'max # of non-linear iterations' )
88+ in_file = File ( exists = True , mandatory = True , desc = 'name of 4D file with images' , argstr = '--imain= %s' )
89+ encoding_file = File ( exists = True , mandatory = True , desc = 'name of text file with PE directions/times' , argstr = '--datain= %s' )
90+ out_base = File ( desc = 'base-name of output files (spline coefficients (Hz) and movement parameters)' , argstr = '--out= %s' )
91+ out_field = File ( argstr = '--fout= %s' , desc = 'name of image file with field (Hz)' )
92+ out_corrected = File ( argstr = '--iout= %s' , desc = 'name of 4D image file with unwarped images' )
93+ out_logfile = File ( argstr = '--logout= %s' , desc = 'name of log-file' )
94+ warp_res = traits .Float ( 10.0 , argstr = '--warpres= %f' , desc = '(approximate) resolution (in mm) of warp basis for the different sub-sampling levels' )
95+ subsamp = traits .Int ( 1 , argstr = '--subsamp= %d' , desc = 'sub-sampling scheme, default 1' )
96+ fwhm = traits .Float ( 8.0 , argstr = '--fwhm= %f' , desc = 'FWHM (in mm) of gaussian smoothing kernel' )
97+ config = traits .String ('b02b0.cnf' , desc = 'Name of config file specifying command line arguments' , argstr = '--config= %s' , usedefault = True )
98+ max_iter = traits .Int ( 5 , argstr = '--miter= %d' , desc = 'max # of non-linear iterations' )
9999 # @oesteban: I don't know how to implement these 3 parameters, AFAIK there's no documentation.
100100 #lambda Weight of regularisation, default depending on --ssqlambda and --regmod switches. See user documetation.
101101 #ssqlambda If set (=1), lambda is weighted by current ssq, default 1
102102 #regmod Model for regularisation of warp-field [membrane_energy bending_energy], default bending_energy
103- estmov = traits .Enum ( 1 , 0 , desc = 'estimate movements if set' , argstr = '--estmov %d' )
104- minmet = traits .Enum ( 0 , 1 , desc = 'Minimisation method 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient' , argstr = '--minmet %d' )
105- splineorder = traits .Int ( 3 , argstr = '--splineorder %d' , desc = 'order of spline, 2->Qadratic spline, 3->Cubic spline' )
106- numprec = traits .Enum ( 'double' , 'float' , argstr = '--numprec %s' , desc = 'Precision for representing Hessian, double or float.' )
107- interp = traits .Enum ( 'spline' , 'linear' , argstr = '--interp %s' , desc = 'Image interpolation model, linear or spline.' )
108- scale = traits .Enum ( 0 , 1 , argstr = '--scale %d' , desc = 'If set (=1), the images are individually scaled to a common mean' )
109- regrid = traits .Enum ( 1 , 0 , argstr = '--regrid %d' , desc = 'If set (=1), the calculations are done in a different grid' )
103+ estmov = traits .Enum ( 1 , 0 , desc = 'estimate movements if set' , argstr = '--estmov= %d' )
104+ minmet = traits .Enum ( 0 , 1 , desc = 'Minimisation method 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient' , argstr = '--minmet= %d' )
105+ splineorder = traits .Int ( 3 , argstr = '--splineorder= %d' , desc = 'order of spline, 2->Qadratic spline, 3->Cubic spline' )
106+ numprec = traits .Enum ( 'double' , 'float' , argstr = '--numprec= %s' , desc = 'Precision for representing Hessian, double or float.' )
107+ interp = traits .Enum ( 'spline' , 'linear' , argstr = '--interp= %s' , desc = 'Image interpolation model, linear or spline.' )
108+ scale = traits .Enum ( 0 , 1 , argstr = '--scale= %d' , desc = 'If set (=1), the images are individually scaled to a common mean' )
109+ regrid = traits .Enum ( 1 , 0 , argstr = '--regrid= %d' , desc = 'If set (=1), the calculations are done in a different grid' )
110110
111111class TOPUPOutputSpec ( TraitedSpec ):
112112 out_fieldcoef = File ( exists = True , desc = 'file containing the field coefficients' )
@@ -173,9 +173,9 @@ class ApplyTOPUPInputSpec( FSLCommandInputSpec ):
173173 in_files = InputMultiPath (File (exists = True ), mandatory = True , desc = 'name of 4D file with images' , argstr = '%s' )
174174 encoding_file = File ( exists = True , mandatory = True , desc = 'name of text file with PE directions/times' , argstr = '--datain=%s' )
175175 in_index = traits .List ( argstr = '%s' , mandatory = True , desc = 'comma separated list of indicies into --datain of the input image (to be corrected)' )
176- in_topup = File ( mandatory = True , desc = 'basename of field/movements (from topup)' , argstr = '-t =%s' )
176+ in_topup = File ( mandatory = True , desc = 'basename of field/movements (from topup)' , argstr = '--topup =%s' )
177177
178- out_base = File ( desc = 'basename for output (warped) image' , argstr = '-o =%s' )
178+ out_base = File ( desc = 'basename for output (warped) image' , argstr = '--out =%s' )
179179 method = traits .Enum ( ('jac' ,'lsr' ), argstr = '-m=%s' , desc = 'use jacobian modulation (jac) or least-squares resampling (lsr)' )
180180 interp = traits .Enum ( ('trilinear' ,'spline' ), argstr = '-n=%s' , desc = 'interpolation method' )
181181 datatype = traits .Enum ( ('char' , 'short' , 'int' , 'float' , 'double' ), argstr = '-d=%s' , desc = 'force output data type' )
@@ -202,7 +202,7 @@ class ApplyTOPUP( FSLCommand ):
202202 >>> res = applytopup.run() # doctest: +SKIP
203203
204204 """
205- _cmd = 'topup '
205+ _cmd = 'applytopup '
206206 input_spec = ApplyTOPUPInputSpec
207207 output_spec = ApplyTOPUPOutputSpec
208208
@@ -217,7 +217,7 @@ def _format_arg(self, name, spec, value):
217217
218218 formated = formated + "%s" % value [0 ]
219219 for fname in value [1 :]:
220- formated = formated + ",%s" % value
220+ formated = formated + ",%s" % fname
221221 return formated
222222
223223 def _parse_inputs ( self , skip = None ):
@@ -226,7 +226,7 @@ def _parse_inputs( self, skip=None ):
226226
227227 if not isdefined (self .inputs .out_base ):
228228 self .inputs .out_base = os .path .abspath ( './nipype_applytopup' )
229- return super (TOPUP , self )._parse_inputs (skip = skip )
229+ return super (ApplyTOPUP , self )._parse_inputs (skip = skip )
230230
231231
232232 def _list_outputs (self ):
0 commit comments