2626
2727from ..base import (traits , TraitedSpec , InputMultiPath , File ,
2828 isdefined )
29- from .base import FSLCommand , FSLCommandInputSpec
29+ from .base import FSLCommand , FSLCommandInputSpec , Info
3030
3131
3232class PrepareFieldmapInputSpec (FSLCommandInputSpec ):
@@ -140,6 +140,13 @@ class TOPUPInputSpec(FSLCommandInputSpec):
140140 out_field = File (argstr = '--fout=%s' , hash_files = False ,
141141 name_source = ['in_file' ], name_template = '%s_field' ,
142142 desc = 'name of image file with field (Hz)' )
143+ out_warp_prefix = traits .Str ("warpfield" , argstr = '--dfout=%s' , hash_files = False ,
144+ desc = 'prefix for the warpfield images (in mm)' ,
145+ usedefault = True )
146+ out_jac_prefix = traits .Str ("jac" , argstr = '--jacout=%s' ,
147+ hash_files = False ,
148+ desc = 'prefix for the warpfield images' ,
149+ usedefault = True )
143150 out_corrected = File (argstr = '--iout=%s' , hash_files = False ,
144151 name_source = ['in_file' ], name_template = '%s_corrected' ,
145152 desc = 'name of 4D image file with unwarped images' )
@@ -212,6 +219,8 @@ class TOPUPOutputSpec(TraitedSpec):
212219 out_movpar = File (exists = True , desc = 'movpar.txt output file' )
213220 out_enc_file = File (desc = 'encoding directions file output for applytopup' )
214221 out_field = File (desc = 'name of image file with field (Hz)' )
222+ out_warps = traits .List (File (exists = True ), desc = 'warpfield images' )
223+ out_jacs = traits .List (File (exists = True ), desc = 'Jacobian images' )
215224 out_corrected = File (desc = 'name of 4D image file with unwarped images' )
216225 out_logfile = File (desc = 'name of log-file' )
217226
@@ -237,7 +246,8 @@ class TOPUP(FSLCommand):
237246 >>> topup.cmdline # doctest: +ELLIPSIS +ALLOW_UNICODE
238247 'topup --config=b02b0.cnf --datain=topup_encoding.txt \
239248 --imain=b0_b0rev.nii --out=b0_b0rev_base --iout=b0_b0rev_corrected.nii.gz \
240- --fout=b0_b0rev_field.nii.gz --logout=b0_b0rev_topup.log'
249+ --fout=b0_b0rev_field.nii.gz --jacout=jac --logout=b0_b0rev_topup.log \
250+ --dfout=warpfield'
241251 >>> res = topup.run() # doctest: +SKIP
242252
243253 """
@@ -270,6 +280,16 @@ def _list_outputs(self):
270280 outputs ['out_movpar' ] = self ._gen_fname (base , suffix = '_movpar' ,
271281 ext = '.txt' , cwd = base_path )
272282
283+ n_vols = nb .load (self .inputs .in_file ).shape [- 1 ]
284+ ext = Info .output_type_to_ext (self .inputs .output_type )
285+ fmt = os .path .abspath ('{prefix}_{i:02d}{ext}' ).format
286+ outputs ['out_warps' ] = [
287+ fmt (prefix = self .inputs .out_warp_prefix , i = i , ext = ext )
288+ for i in range (1 , n_vols + 1 )]
289+ outputs ['out_jacs' ] = [
290+ fmt (prefix = self .inputs .out_jac_prefix , i = i , ext = ext )
291+ for i in range (1 , n_vols + 1 )]
292+
273293 if isdefined (self .inputs .encoding_direction ):
274294 outputs ['out_enc_file' ] = self ._get_encfilename ()
275295 return outputs
@@ -423,6 +443,32 @@ class EddyInputSpec(FSLCommandInputSpec):
423443 flm = traits .Enum ('linear' , 'quadratic' , 'cubic' , argstr = '--flm=%s' ,
424444 desc = 'First level EC model' )
425445
446+ slm = traits .Enum ('none' , 'linear' , 'quadratic' , argstr = '--slm=%s' ,
447+ desc = 'Second level EC model' )
448+
449+ fep = traits .Bool (False , argstr = '--fep' ,
450+ desc = 'Fill empty planes in x- or y-directions' )
451+
452+ interp = traits .Enum ('spline' , 'trilinear' , argstr = '--interp=%s' ,
453+ desc = 'Interpolation model for estimation step' )
454+
455+ nvoxhp = traits .Int (1000 , argstr = '--nvoxhp=%s' ,
456+ desc = ('# of voxels used to estimate the '
457+ 'hyperparameters' ))
458+
459+ fudge_factor = traits .Float (10.0 , argstr = '--ff=%s' ,
460+ desc = ('Fudge factor for hyperparameter '
461+ 'error variance' ))
462+
463+ dont_sep_offs_move = traits .Bool (False , argstr = '--dont_sep_offs_move' ,
464+ desc = ('Do NOT attempt to separate '
465+ 'field offset from subject '
466+ 'movement' ))
467+
468+ dont_peas = traits .Bool (False , argstr = '--dont_peas' ,
469+ desc = "Do NOT perform a post-eddy alignment of "
470+ "shells" )
471+
426472 fwhm = traits .Float (desc = ('FWHM for conditioning filter when estimating '
427473 'the parameters' ), argstr = '--fwhm=%s' )
428474
0 commit comments