Skip to content

Commit cbe7b72

Browse files
committed
Improvements on TOPUP and related workflow
1 parent c0986c6 commit cbe7b72

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class TOPUPInputSpec( FSLCommandInputSpec ):
102102
in_file = File( exists=True, mandatory=True, desc='name of 4D file with images', argstr='--imain=%s' )
103103
encoding_file = File( exists=True, desc='name of text file with PE directions/times', argstr='--datain=%s' )
104104
encoding_direction = traits.Enum( 'y','x','z','x-','y-','z-', desc='encoding direction for automatic generation of encoding_file' )
105-
readout_times = traits.List( desc='readout times (dwell times by # phase-encode steps minus 1)' )
105+
readout_times = traits.List(traits.Float, desc='readout times (dwell times by # phase-encode steps minus 1)' )
106106
out_base = File( desc='base-name of output files (spline coefficients (Hz) and movement parameters)', argstr='--out=%s' )
107107
out_field = File( argstr='--fout=%s', desc='name of image file with field (Hz)' )
108108
out_corrected = File( argstr='--iout=%s', desc='name of 4D image file with unwarped images' )
@@ -166,12 +166,13 @@ def _parse_inputs( self, skip=None ):
166166
skip.append( 'readout_times' )
167167
else:
168168
encdir = 'y'
169-
enctimes = [1.0,1.0]
169+
enctimes = None
170+
170171
if isdefined( self.inputs.encoding_direction ):
171172
encdir = self.inputs.encoding_direction
172173

173174
if isdefined( self.inputs.readout_times ):
174-
enctimes = np.array( self.inputs.readout_times, dtype=float )
175+
enctimes = self.inputs.readout_times
175176

176177
self.inputs.encoding_file = self._generate_encfile( encdir, enctimes )
177178

@@ -200,12 +201,15 @@ def _list_outputs(self):
200201
outputs['out_logfile'] = Undefined
201202
return outputs
202203

203-
def _generate_encfile( self, encdir,enctime ):
204+
def _generate_encfile( self, encdir, enctime=None ):
204205
out_file = '%s_encfile.txt' % self.inputs.out_base
205206
direction = 1.0
206207
if len(encdir)==2 and encdir[1]=='-':
207208
direction = -1.0
208209

210+
if enctime is None:
211+
enctime=[ 1.0, 1.0 ]
212+
209213
file1 = [ float(val[0]==encdir[0]) * direction for val in [ 'x', 'y', 'z' ] ]
210214
file2 = [ float(val[0]==encdir[0]) * direction * -1.0 for val in [ 'x', 'y', 'z' ] ]
211215

nipype/workflows/dmri/fsl/epi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def topup_correction( name='topup_correction' ):
389389
fields=['in_file_dir',
390390
'in_file_rev',
391391
'encoding_direction',
392-
'readout_times'
392+
'readout_times',
393393
'ref_num'
394394
]), name='inputnode'
395395
)

0 commit comments

Comments
 (0)