@@ -44,21 +44,7 @@ def init_dwi_preproc_wf(
44
44
from collections import namedtuple
45
45
from dmriprep.workflows.dwi import init_dwi_preproc_wf
46
46
BIDSLayout = namedtuple('BIDSLayout', ['root'])
47
- wf = init_dwi_preproc_wf(
48
- layout=BIDSLayout('.'),
49
- output_dir='.',
50
- subject_id='dmripreptest',
51
- dwi_file='/madeup/path/sub-01_dwi.nii.gz',
52
- metadata={},
53
- b0_thresh=5,
54
- output_resolution=(1, 1, 1),
55
- bet_dwi=0.3,
56
- bet_mag=0.3,
57
- acqp_file='',
58
- omp_nthreads=1,
59
- ignore=[],
60
- synb0_dir=''
61
- )
47
+ wf = init_dwi_preproc_wf(layout=BIDSLayout('.'), output_dir='.', subject_id='dmripreptest', dwi_file='/madeup/path/sub-01_dwi.nii.gz', metadata={'PhaseEncodingDirection': 'j-', 'TotalReadoutTime': 0.05}, b0_thresh=5, output_resolution=(1, 1, 1), bet_dwi=0.3, bet_mag=0.3, acqp_file='', omp_nthreads=1, ignore=['fieldmaps'], synb0_dir='')
62
48
63
49
"""
64
50
@@ -314,7 +300,6 @@ def get_b0_mask_fn(b0_file):
314
300
('bvec_file' , 'in_bvec' )]),
315
301
(bet_dwi0 , ecc , [('mask_file' , 'in_mask' )]),
316
302
(gen_idx , ecc , [('out_file' , 'in_index' )]),
317
- (acqp , ecc , [('out_file' , 'in_acqp' )]),
318
303
(ecc , denoise_eddy , [('out_corrected' , 'in_file' )]),
319
304
(ecc , bias_correct , [('out_corrected' , 'in_file' ),
320
305
('out_rotated_bvecs' , 'in_bvec' )]),
@@ -327,13 +312,21 @@ def get_b0_mask_fn(b0_file):
327
312
(inputnode , eddy_quad , [('bval_file' , 'bval_file' )]),
328
313
(b0mask_node , eddy_quad , [('mask_file' , 'mask_file' )]),
329
314
(gen_idx , eddy_quad , [('out_file' , 'idx_file' )]),
330
- (acqp , eddy_quad , [('out_file' , 'param_file' )]),
331
315
(inputnode , tensor_wf , [('bval_file' , 'inputnode.bval_file' )]),
332
316
(b0mask_node , tensor_wf , [('mask_file' , 'inputnode.mask_file' )]),
333
317
(ecc , tensor_wf , [('out_corrected' , 'inputnode.dwi_file' ),
334
318
('out_rotated_bvecs' , 'inputnode.bvec_file' )])
335
319
])
336
320
321
+ if acqp_file :
322
+ ecc .inputs .in_acqp = acqp_file
323
+ eddy_quad .inputs .param_file = acqp_file
324
+ else :
325
+ dwi_wf .connect ([
326
+ (acqp , ecc , [('out_file' , 'in_acqp' )]),
327
+ (acqp , eddy_quad , [('out_file' , 'param_file' )])
328
+ ])
329
+
337
330
# # If synb0 is meant to be used
338
331
# if synb0_dir:
339
332
# dwi_wf.connect(
@@ -360,63 +353,35 @@ def get_b0_mask_fn(b0_file):
360
353
fmap = fmaps [0 ]
361
354
# Else If epi files detected
362
355
if fmap ['suffix' ] == 'epi' :
363
- dwi_wf .connect (
364
- [
365
- (
366
- sdc_wf ,
367
- ecc ,
368
- [
369
- ('outputnode.out_topup' , 'in_topup_fieldcoef' ),
370
- #('outputnode.out_enc_file', 'in_acqp'),
371
- ('outputnode.out_movpar' , 'in_topup_movpar' ),
372
- ],
373
- ),
374
- # (
375
- # sdc_wf,
376
- # eddy_quad,
377
- # [('outputnode.out_enc_file', 'param_file')],
378
- # ),
379
- ]
380
- )
356
+ dwi_wf .connect ([
357
+ (sdc_wf , ecc , [('outputnode.out_topup' , 'in_topup_fieldcoef' ),
358
+ ('outputnode.out_movpar' , 'in_topup_movpar' )])
359
+ ])
381
360
# Otherwise (fieldmaps)
382
361
else :
383
362
dwi_wf .connect ([
384
363
(bet_dwi0 , sdc_wf , [('out_file' , 'inputnode.b0_stripped' )]),
385
- (sdc_wf , ecc , [('outputnode.out_fmap' , 'field' )]),
386
- #(acqp, ecc, [('out_file', 'in_acqp')]),
387
- # (acqp, eddy_quad, [('out_file', 'param_file')]),
388
- ]
389
- )
364
+ (sdc_wf , ecc , [('outputnode.out_fmap' , 'field' )])
365
+ ])
390
366
391
- dwi_wf .connect (
392
- [
393
- (ecc , outputnode , [('out_corrected' , 'out_dwi' )]),
394
- (inputnode , outputnode , [('bval_file' , 'out_bval' )]),
395
- (ecc , outputnode , [('out_rotated_bvecs' , 'out_bvec' )]),
396
- (gen_idx , outputnode , [('out_file' , 'index' )]),
397
- (acqp , outputnode , [('out_file' , 'acq_params' )]),
398
- (b0mask_node , outputnode , [('mask_file' , 'out_mask' )]),
399
- (avg_b0_0 , outputnode , [('out_file' , 'out_b0_pre' )]),
400
- (bet_dwi0 , outputnode , [('mask_file' , 'out_b0_mask_pre' )]),
401
- (
402
- eddy_quad ,
403
- outputnode ,
404
- [('qc_json' , 'out_eddy_quad_json' ), ('qc_pdf' , 'out_eddy_quad_pdf' )],
405
- ),
406
- (
407
- tensor_wf ,
408
- outputnode ,
409
- [
410
- ('outputnode.FA_file' , 'out_dtifit_FA' ),
411
- ('outputnode.MD_file' , 'out_dtifit_MD' ),
412
- ('outputnode.AD_file' , 'out_dtifit_AD' ),
413
- ('outputnode.RD_file' , 'out_dtifit_RD' ),
414
- ('outputnode.V1_file' , 'out_dtifit_V1' ),
415
- ('outputnode.sse_file' , 'out_dtifit_sse' ),
416
- ],
417
- ),
418
- ]
419
- )
367
+ dwi_wf .connect ([
368
+ (ecc , outputnode , [('out_corrected' , 'out_dwi' )]),
369
+ (inputnode , outputnode , [('bval_file' , 'out_bval' )]),
370
+ (ecc , outputnode , [('out_rotated_bvecs' , 'out_bvec' )]),
371
+ (gen_idx , outputnode , [('out_file' , 'index' )]),
372
+ (acqp , outputnode , [('out_file' , 'acq_params' )]),
373
+ (b0mask_node , outputnode , [('mask_file' , 'out_mask' )]),
374
+ (avg_b0_0 , outputnode , [('out_file' , 'out_b0_pre' )]),
375
+ (bet_dwi0 , outputnode , [('mask_file' , 'out_b0_mask_pre' )]),
376
+ (eddy_quad , outputnode , [('qc_json' , 'out_eddy_quad_json' ),
377
+ ('qc_pdf' , 'out_eddy_quad_pdf' )]),
378
+ (tensor_wf , outputnode , [('outputnode.FA_file' , 'out_dtifit_FA' ),
379
+ ('outputnode.MD_file' , 'out_dtifit_MD' ),
380
+ ('outputnode.AD_file' , 'out_dtifit_AD' ),
381
+ ('outputnode.RD_file' , 'out_dtifit_RD' ),
382
+ ('outputnode.V1_file' , 'out_dtifit_V1' ),
383
+ ('outputnode.sse_file' , 'out_dtifit_sse' )])
384
+ ])
420
385
421
386
return dwi_wf
422
387
0 commit comments