@@ -46,12 +46,17 @@ def all_fmb_pipeline(name='hmc_sdc_ecc', fugue_params=dict(smooth3d=2.0)):
4646 outputnode = pe .Node (niu .IdentityInterface (
4747 fields = ['out_file' , 'out_mask' , 'out_bvec' ]), name = 'outputnode' )
4848
49+ list_b0 = pe .Node (niu .Function (
50+ input_names = ['in_bval' ], output_names = ['out_idx' ],
51+ function = b0_indices ), name = 'B0indices' )
52+
4953 avg_b0_0 = pe .Node (niu .Function (
50- input_names = ['in_dwi ' , 'in_bval ' ], output_names = ['out_file' ],
51- function = b0_average ), name = 'b0_avg_pre' )
54+ input_names = ['in_file ' , 'index ' ], output_names = ['out_file' ],
55+ function = time_avg ), name = 'b0_avg_pre' )
5256 avg_b0_1 = pe .Node (niu .Function (
53- input_names = ['in_dwi' , 'in_bval' ], output_names = ['out_file' ],
54- function = b0_average ), name = 'b0_avg_post' )
57+ input_names = ['in_file' , 'index' ], output_names = ['out_file' ],
58+ function = time_avg ), name = 'b0_avg_post' )
59+
5560 bet_dwi0 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
5661 name = 'bet_dwi_pre' )
5762 bet_dwi1 = pe .Node (fsl .BET (frac = 0.3 , mask = True , robust = True ),
@@ -67,24 +72,25 @@ def all_fmb_pipeline(name='hmc_sdc_ecc', fugue_params=dict(smooth3d=2.0)):
6772 (inputnode , hmc , [('in_file' , 'inputnode.in_file' ),
6873 ('in_bvec' , 'inputnode.in_bvec' ),
6974 ('in_bval' , 'inputnode.in_bval' )]),
70- (inputnode , avg_b0_0 , [('in_file' , 'in_dwi' ),
71- ('in_bval' , 'in_bval' )]),
75+ (inputnode , list_b0 , [('in_bval' , 'in_bval' )]),
76+ (inputnode , avg_b0_0 , [('in_file' , 'in_file' )]),
77+ (list_b0 , avg_b0_0 , [('out_idx' , 'index' )]),
7278 (avg_b0_0 , bet_dwi0 , [('out_file' , 'in_file' )]),
7379 (bet_dwi0 , hmc , [('mask_file' , 'inputnode.in_mask' )]),
7480 (hmc , sdc , [
7581 ('outputnode.out_file' , 'inputnode.in_file' )]),
7682 (bet_dwi0 , sdc , [('mask_file' , 'inputnode.in_mask' )]),
77- (inputnode , sdc , [('in_bval' , 'inputnode.in_bval' ),
78- ('bmap_pha' , 'inputnode.bmap_pha' ),
83+ (inputnode , sdc , [('bmap_pha' , 'inputnode.bmap_pha' ),
7984 ('bmap_mag' , 'inputnode.bmap_mag' ),
8085 ('epi_param' , 'inputnode.settings' )]),
86+ (list_b0 , sdc , [('out_idx' , 'inputnode.in_ref' )]),
8187 (hmc , ecc , [
8288 ('outputnode.out_xfms' , 'inputnode.in_xfms' )]),
8389 (inputnode , ecc , [('in_file' , 'inputnode.in_file' ),
8490 ('in_bval' , 'inputnode.in_bval' )]),
8591 (bet_dwi0 , ecc , [('mask_file' , 'inputnode.in_mask' )]),
86- (ecc , avg_b0_1 , [('outputnode.out_file' , 'in_dwi ' )]),
87- (inputnode , avg_b0_1 , [('in_bval ' , 'in_bval ' )]),
92+ (ecc , avg_b0_1 , [('outputnode.out_file' , 'in_file ' )]),
93+ (list_b0 , avg_b0_1 , [('out_idx ' , 'index ' )]),
8894 (avg_b0_1 , bet_dwi1 , [('out_file' , 'in_file' )]),
8995 (inputnode , unwarp , [('in_file' , 'inputnode.in_dwi' )]),
9096 (hmc , unwarp , [('outputnode.out_xfms' , 'inputnode.in_hmc' )]),
@@ -529,7 +535,7 @@ def sdc_fmb(name='fmb_correction', interp='Linear',
529535 >>> from nipype.workflows.dmri.fsl.artifacts import sdc_fmb
530536 >>> fmb = sdc_fmb()
531537 >>> fmb.inputs.inputnode.in_file = 'diffusion.nii'
532- >>> fmb.inputs.inputnode.in_bval = 'diffusion.bval'
538+ >>> fmb.inputs.inputnode.in_ref = range(0, 30, 6)
533539 >>> fmb.inputs.inputnode.in_mask = 'mask.nii'
534540 >>> fmb.inputs.inputnode.bmap_mag = 'magnitude.nii'
535541 >>> fmb.inputs.inputnode.bmap_pha = 'phase.nii'
@@ -555,7 +561,7 @@ def sdc_fmb(name='fmb_correction', interp='Linear',
555561 'acc_factor' : 2 , 'enc_dir' : u'AP' }
556562
557563 inputnode = pe .Node (niu .IdentityInterface (
558- fields = ['in_file' , 'in_bval ' , 'in_mask' , 'bmap_pha' , 'bmap_mag' ,
564+ fields = ['in_file' , 'in_ref ' , 'in_mask' , 'bmap_pha' , 'bmap_mag' ,
559565 'settings' ]), name = 'inputnode' )
560566
561567 outputnode = pe .Node (niu .IdentityInterface (
@@ -580,9 +586,9 @@ def sdc_fmb(name='fmb_correction', interp='Linear',
580586 input_names = ['in_file' , 'delta_te' ], output_names = ['out_file' ],
581587 function = rads2radsec ), name = 'ToRadSec' )
582588
583- avg_b0 = pe .Node (niu .Function (
584- input_names = ['in_dwi ' , 'in_bval ' ], output_names = ['out_file' ],
585- function = b0_average ), name = 'b0_avg ' )
589+ baseline = pe .Node (niu .Function (
590+ input_names = ['in_file ' , 'index ' ], output_names = ['out_file' ],
591+ function = time_avg ), name = 'Baseline ' )
586592
587593 fmm2b0 = pe .Node (ants .Registration (output_warped_image = True ),
588594 name = "FMm_to_B0" )
@@ -639,8 +645,8 @@ def sdc_fmb(name='fmb_correction', interp='Linear',
639645 ('acc_factor' , 'acc_factor' )]),
640646 (inputnode , pha2rads , [('bmap_pha' , 'in_file' )]),
641647 (inputnode , firstmag , [('bmap_mag' , 'in_file' )]),
642- (inputnode , avg_b0 , [('in_file' , 'in_dwi ' ),
643- ('in_bval ' , 'in_bval ' )]),
648+ (inputnode , baseline , [('in_file' , 'in_file ' ),
649+ ('in_ref ' , 'index ' )]),
644650 (firstmag , n4 , [('roi_file' , 'input_image' )]),
645651 (n4 , bet , [('output_image' , 'in_file' )]),
646652 (bet , dilate , [('mask_file' , 'in_file' )]),
@@ -650,12 +656,12 @@ def sdc_fmb(name='fmb_correction', interp='Linear',
650656 (r_params , rad2rsec , [('delta_te' , 'delta_te' )]),
651657 (prelude , rad2rsec , [('unwrapped_phase_file' , 'in_file' )]),
652658
653- (avg_b0 , fmm2b0 , [('out_file' , 'fixed_image' )]),
659+ (baseline , fmm2b0 , [('out_file' , 'fixed_image' )]),
654660 (n4 , fmm2b0 , [('output_image' , 'moving_image' )]),
655661 (inputnode , fmm2b0 , [('in_mask' , 'fixed_image_mask' )]),
656662 (dilate , fmm2b0 , [('out_file' , 'moving_image_mask' )]),
657663
658- (avg_b0 , applyxfm , [('out_file' , 'reference_image' )]),
664+ (baseline , applyxfm , [('out_file' , 'reference_image' )]),
659665 (rad2rsec , applyxfm , [('out_file' , 'input_image' )]),
660666 (fmm2b0 , applyxfm , [
661667 ('forward_transforms' , 'transforms' ),
0 commit comments