Skip to content

Commit 72e0a43

Browse files
authored
Merge pull request #2121 from mgxd/fix/fsldmriwf
Fix: restructure of FSL dmri pipeline to avoid always rerunning
2 parents 4e5d8ec + 7a6e21a commit 72e0a43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/workflows/dmri/fsl/artifacts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def all_fsl_pipeline(name='fsl_all_correct',
232232
outputnode = pe.Node(niu.IdentityInterface(
233233
fields=['out_file', 'out_mask', 'out_bvec']), name='outputnode')
234234

235-
def _gen_index(in_file):
235+
def gen_index(in_file):
236236
import numpy as np
237237
import nibabel as nb
238238
import os
@@ -242,6 +242,9 @@ def _gen_index(in_file):
242242
np.savetxt(out_file, np.ones((vols,)).T)
243243
return out_file
244244

245+
gen_idx = pe.Node(niu.Function(
246+
input_names=['in_file'], output_names=['out_file'],
247+
function=gen_index), name='gen_index')
245248
avg_b0_0 = pe.Node(niu.Function(
246249
input_names=['in_dwi', 'in_bval'], output_names=['out_file'],
247250
function=b0_average), name='b0_avg_pre')
@@ -272,10 +275,11 @@ def _gen_index(in_file):
272275
('topup.out_fieldcoef', 'in_topup_fieldcoef'),
273276
('topup.out_movpar', 'in_topup_movpar')]),
274277
(bet_dwi0, ecc, [('mask_file', 'in_mask')]),
278+
(inputnode, gen_idx, [('in_file', 'in_file')]),
275279
(inputnode, ecc, [('in_file', 'in_file'),
276-
(('in_file', _gen_index), 'in_index'),
277280
('in_bval', 'in_bval'),
278281
('in_bvec', 'in_bvec')]),
282+
(gen_idx, ecc, [('out_file', 'in_index')]),
279283
(inputnode, rot_bvec, [('in_bvec', 'in_bvec')]),
280284
(ecc, rot_bvec, [('out_parameter', 'eddy_params')]),
281285
(ecc, avg_b0_1, [('out_corrected', 'in_dwi')]),

0 commit comments

Comments
 (0)