69
69
init_bold_surf_wf ,
70
70
)
71
71
from .stc import init_bold_stc_wf
72
- from .t2s import init_bold_t2s_wf
72
+ from .t2s import init_bold_t2s_wf , init_t2s_reporting_wf
73
73
74
74
75
75
def init_func_preproc_wf (bold_file , has_fieldmap = False , existing_derivatives = None ):
@@ -346,10 +346,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
346
346
outputnode = pe .Node (
347
347
niu .IdentityInterface (
348
348
fields = [
349
+ "anat2bold_xfm" ,
349
350
"bold_anat" ,
350
351
"bold_anat_ref" ,
351
- "bold2anat_xfm" ,
352
- "anat2bold_xfm" ,
353
352
"bold_mask_anat" ,
354
353
"bold_aseg_anat" ,
355
354
"bold_aparc_anat" ,
@@ -363,6 +362,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
363
362
"bold_mask_native" ,
364
363
"bold_echos_native" ,
365
364
"bold_cifti" ,
365
+ "bold2anat_xfm" ,
366
366
"cifti_variant" ,
367
367
"cifti_metadata" ,
368
368
"cifti_density" ,
@@ -372,6 +372,10 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
372
372
"melodic_mix" ,
373
373
"nonaggr_denoised_file" ,
374
374
"confounds_metadata" ,
375
+ "t2star_bold" ,
376
+ "t2star_t1" ,
377
+ "t2star_std" ,
378
+ "hmc_xforms" ,
375
379
]
376
380
),
377
381
name = "outputnode" ,
@@ -433,6 +437,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
433
437
('bold_anat_ref' , 'inputnode.bold_t1_ref' ),
434
438
('bold2anat_xfm' , 'inputnode.bold2anat_xfm' ),
435
439
('anat2bold_xfm' , 'inputnode.anat2bold_xfm' ),
440
+ ('hmc_xforms' , 'inputnode.hmc_xforms' ),
436
441
('bold_aseg_anat' , 'inputnode.bold_aseg_t1' ),
437
442
('bold_aparc_anat' , 'inputnode.bold_aparc_t1' ),
438
443
('bold_mask_anat' , 'inputnode.bold_mask_t1' ),
@@ -449,6 +454,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
449
454
('cifti_variant' , 'inputnode.cifti_variant' ),
450
455
('cifti_metadata' , 'inputnode.cifti_metadata' ),
451
456
('cifti_density' , 'inputnode.cifti_density' ),
457
+ ('t2star_bold' , 'inputnode.t2star_bold' ),
458
+ ('t2star_t1' , 'inputnode.t2star_t1' ),
459
+ ('t2star_std' , 'inputnode.t2star_std' ),
452
460
('confounds_metadata' , 'inputnode.confounds_metadata' ),
453
461
('acompcor_masks' , 'inputnode.acompcor_masks' ),
454
462
('tcompcor_mask' , 'inputnode.tcompcor_mask' ),
@@ -547,8 +555,31 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
547
555
name = "bold_t2smap_wf" ,
548
556
)
549
557
558
+ t2s_reporting_wf = init_t2s_reporting_wf ()
559
+
560
+ ds_report_t2scomp = pe .Node (
561
+ DerivativesDataSink (
562
+ desc = "t2scomp" ,
563
+ datatype = "figures" ,
564
+ dismiss_entities = ("echo" ,),
565
+ ),
566
+ name = "ds_report_t2scomp" ,
567
+ run_without_submitting = True ,
568
+ )
569
+
570
+ ds_report_t2star_hist = pe .Node (
571
+ DerivativesDataSink (
572
+ desc = "t2starhist" ,
573
+ datatype = "figures" ,
574
+ dismiss_entities = ("echo" ,),
575
+ ),
576
+ name = "ds_report_t2star_hist" ,
577
+ run_without_submitting = True ,
578
+ )
579
+
550
580
bold_final = pe .Node (
551
- niu .IdentityInterface (fields = ["bold" , "boldref" , "mask" , "bold_echos" ]), name = "bold_final"
581
+ niu .IdentityInterface (fields = ["bold" , "boldref" , "mask" , "bold_echos" , "t2star" ]),
582
+ name = "bold_final" ,
552
583
)
553
584
554
585
# Mask input BOLD reference image
@@ -580,6 +611,9 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
580
611
('bold_ref' , 'inputnode.raw_ref_image' )]),
581
612
(validate_bolds , bold_hmc_wf , [
582
613
(("out_file" , pop_file ), 'inputnode.bold_file' )]),
614
+ (bold_hmc_wf , outputnode , [
615
+ ("outputnode.xforms" , "hmc_xforms" ),
616
+ ]),
583
617
# Native-space BOLD files
584
618
(final_boldref_wf , final_boldref_mask , [('outputnode.epi_ref_file' , 'in_file' )]),
585
619
(final_boldref_wf , bold_final , [('outputnode.epi_ref_file' , 'boldref' )]),
@@ -589,6 +623,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
589
623
('boldref' , 'bold_native_ref' ),
590
624
('mask' , 'bold_mask_native' ),
591
625
('bold_echos' , 'bold_echos_native' ),
626
+ ('t2star' , 't2star_bold' ),
592
627
]),
593
628
# EPI-T1 registration workflow
594
629
(inputnode , bold_reg_wf , [
@@ -668,15 +703,22 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
668
703
workflow .connect ([
669
704
# update name source for optimal combination
670
705
(inputnode , func_derivatives_wf , [
671
- (('bold_file' , combine_meepi_source ), 'inputnode.source_file' )]),
672
- (join_echos , bold_t2s_wf , [
673
- ('bold_files' , 'inputnode.bold_file' )]),
674
- (bold_t2s_wf , split_opt_comb , [
675
- ('outputnode.bold' , 'in_file' )]),
676
- (split_opt_comb , bold_t1_trans_wf , [
677
- ("out_files" , "inputnode.bold_split" )]),
706
+ (("bold_file" , combine_meepi_source ), "inputnode.source_file" ),
707
+ ]),
708
+ (join_echos , bold_t2s_wf , [("bold_files" , "inputnode.bold_file" )]),
678
709
(join_echos , bold_final , [("bold_files" , "bold_echos" )]),
679
- (bold_t2s_wf , bold_final , [("outputnode.bold" , "bold" )]),
710
+ (bold_t2s_wf , split_opt_comb , [("outputnode.bold" , "in_file" )]),
711
+ (split_opt_comb , bold_t1_trans_wf , [("out_files" , "inputnode.bold_split" )]),
712
+ (bold_t2s_wf , bold_final , [("outputnode.bold" , "bold" ),
713
+ ("outputnode.t2star_map" , "t2star" )]),
714
+ (inputnode , t2s_reporting_wf , [("anat_dseg" , "inputnode.label_file" )]),
715
+ (bold_reg_wf , t2s_reporting_wf , [
716
+ ("outputnode.itk_t1_to_bold" , "inputnode.label_bold_xform" )
717
+ ]),
718
+ (bold_final , t2s_reporting_wf , [("t2star" , "inputnode.t2star_file" ),
719
+ ("boldref" , "inputnode.boldref" )]),
720
+ (t2s_reporting_wf , ds_report_t2scomp , [('outputnode.t2s_comp_report' , 'in_file' )]),
721
+ (t2s_reporting_wf , ds_report_t2star_hist , [("outputnode.t2star_hist" , "in_file" )]),
680
722
])
681
723
# fmt:on
682
724
@@ -704,6 +746,23 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
704
746
])
705
747
# fmt:on
706
748
749
+ if multiecho :
750
+ t2star_to_t1w = pe .Node (
751
+ ApplyTransforms (interpolation = "LanczosWindowedSinc" , float = True ),
752
+ name = "t2star_to_t1w" ,
753
+ mem_gb = 0.1 ,
754
+ )
755
+ # fmt:off
756
+ workflow .connect ([
757
+ (bold_reg_wf , t2star_to_t1w , [("outputnode.itk_bold_to_t1" , "transforms" )]),
758
+ (bold_t1_trans_wf , t2star_to_t1w , [
759
+ ("outputnode.bold_mask_t1" , "reference_image" )
760
+ ]),
761
+ (bold_final , t2star_to_t1w , [("t2star" , "input_image" )]),
762
+ (t2star_to_t1w , outputnode , [("output_image" , "t2star_t1" )]),
763
+ ])
764
+ # fmt:on
765
+
707
766
if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
708
767
# Apply transforms in 1 shot
709
768
# Only use uncompressed output if AROMA is to be run
@@ -712,6 +771,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
712
771
mem_gb = mem_gb ["resampled" ],
713
772
omp_nthreads = omp_nthreads ,
714
773
spaces = spaces ,
774
+ multiecho = multiecho ,
715
775
name = "bold_std_trans_wf" ,
716
776
use_compression = not config .execution .low_mem ,
717
777
)
@@ -727,6 +787,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
727
787
('anat_aparc' , 'inputnode.bold_aparc' )]),
728
788
(bold_final , bold_std_trans_wf , [
729
789
('mask' , 'inputnode.bold_mask' ),
790
+ ('t2star' , 'inputnode.t2star' ),
730
791
]),
731
792
(bold_reg_wf , bold_std_trans_wf , [
732
793
('outputnode.itk_bold_to_t1' , 'inputnode.itk_bold_to_t1' )]),
@@ -761,8 +822,8 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
761
822
else :
762
823
# fmt:off
763
824
workflow .connect ([
764
- (split_opt_comb , bold_std_trans_wf , [
765
- ( 'out_files' , 'inputnode.bold_split' )])
825
+ (split_opt_comb , bold_std_trans_wf , [( 'out_files' , 'inputnode.bold_split' )]),
826
+ ( bold_std_trans_wf , outputnode , [( "outputnode.t2star_std" , "t2star_std" )]),
766
827
])
767
828
# fmt:on
768
829
0 commit comments