@@ -198,6 +198,13 @@ def init_bold_wf(
198
198
"fmap_mask" ,
199
199
"fmap_id" ,
200
200
"sdc_method" ,
201
+ # Volumetric templates
202
+ "anat2std_xfm" ,
203
+ "std_space" ,
204
+ "std_resolution" ,
205
+ "std_cohort" ,
206
+ "std_t1w" ,
207
+ "std_mask" ,
201
208
],
202
209
),
203
210
name = "inputnode" ,
@@ -381,6 +388,59 @@ def init_bold_wf(
381
388
(bold_anat_wf , ds_bold_t1_wf , [('outputnode.bold_file' , 'inputnode.bold' )]),
382
389
]) # fmt:skip
383
390
391
+ if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
392
+ # Missing:
393
+ # * Clipping BOLD after resampling
394
+ # * Resampling parcellations
395
+ bold_std_wf = init_bold_volumetric_resample_wf (
396
+ metadata = all_metadata [0 ],
397
+ fieldmap_id = fieldmap_id if not multiecho else None ,
398
+ omp_nthreads = omp_nthreads ,
399
+ name = 'bold_std_wf' ,
400
+ )
401
+ ds_bold_std_wf = init_ds_volumes_wf (
402
+ bids_root = str (config .execution .bids_dir ),
403
+ output_dir = fmriprep_dir ,
404
+ multiecho = multiecho ,
405
+ metadata = all_metadata [0 ],
406
+ name = 'ds_bold_std_wf' ,
407
+ )
408
+ ds_bold_std_wf .inputs .inputnode .source_files = bold_series
409
+
410
+ workflow .connect ([
411
+ (inputnode , bold_std_wf , [
412
+ ("std_t1w" , "inputnode.target_ref_file" ),
413
+ ("std_mask" , "inputnode.target_mask" ),
414
+ ("anat2std_xfm" , "inputnode.anat2std_xfm" ),
415
+ ("fmap_ref" , "inputnode.fmap_ref" ),
416
+ ("fmap_coeff" , "inputnode.fmap_coeff" ),
417
+ ("fmap_id" , "inputnode.fmap_id" ),
418
+ ]),
419
+ (bold_fit_wf , bold_std_wf , [
420
+ ("outputnode.coreg_boldref" , "inputnode.bold_ref_file" ),
421
+ ("outputnode.boldref2fmap_xfm" , "inputnode.boldref2fmap_xfm" ),
422
+ ("outputnode.boldref2anat_xfm" , "inputnode.boldref2anat_xfm" ),
423
+ ]),
424
+ (bold_native_wf , bold_std_wf , [
425
+ ("outputnode.bold_minimal" , "inputnode.bold_file" ),
426
+ ("outputnode.motion_xfm" , "inputnode.motion_xfm" ),
427
+ ]),
428
+ (inputnode , ds_bold_std_wf , [
429
+ ('std_t1w' , 'inputnode.ref_file' ),
430
+ ('anat2std_xfm' , 'inputnode.anat2std_xfm' ),
431
+ ('std_space' , 'inputnode.space' ),
432
+ ('std_resolution' , 'inputnode.resolution' ),
433
+ ('std_cohort' , 'inputnode.cohort' ),
434
+ ]),
435
+ (bold_fit_wf , ds_bold_std_wf , [
436
+ ('outputnode.bold_mask' , 'inputnode.bold_mask' ),
437
+ ('outputnode.coreg_boldref' , 'inputnode.bold_ref' ),
438
+ ('outputnode.boldref2anat_xfm' , 'inputnode.boldref2anat_xfm' ),
439
+ ]),
440
+ (bold_native_wf , ds_bold_std_wf , [('outputnode.t2star_map' , 'inputnode.t2star' )]),
441
+ (bold_std_wf , ds_bold_std_wf , [('outputnode.bold_file' , 'inputnode.bold' )]),
442
+ ]) # fmt:skip
443
+
384
444
# Fill-in datasinks of reportlets seen so far
385
445
for node in workflow .list_node_names ():
386
446
if node .split ("." )[- 1 ].startswith ("ds_report" ):
@@ -629,90 +689,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
629
689
)
630
690
bold_confounds_wf .get_node ("inputnode" ).inputs .t1_transform_flags = [False ]
631
691
632
- if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
633
- # Apply transforms in 1 shot
634
- bold_std_trans_wf = init_bold_std_trans_wf (
635
- freesurfer = freesurfer ,
636
- mem_gb = mem_gb ["resampled" ],
637
- omp_nthreads = omp_nthreads ,
638
- spaces = spaces ,
639
- multiecho = multiecho ,
640
- name = "bold_std_trans_wf" ,
641
- use_compression = not config .execution .low_mem ,
642
- )
643
- bold_std_trans_wf .inputs .inputnode .fieldwarp = "identity"
644
-
645
- # fmt:off
646
- workflow .connect ([
647
- (inputnode , bold_std_trans_wf , [
648
- ("template" , "inputnode.templates" ),
649
- ("anat2std_xfm" , "inputnode.anat2std_xfm" ),
650
- ("bold_file" , "inputnode.name_source" ),
651
- ("t1w_aseg" , "inputnode.bold_aseg" ),
652
- ("t1w_aparc" , "inputnode.bold_aparc" ),
653
- ]),
654
- (bold_final , bold_std_trans_wf , [
655
- ("mask" , "inputnode.bold_mask" ),
656
- ("t2star" , "inputnode.t2star" ),
657
- ]),
658
- (bold_reg_wf , bold_std_trans_wf , [
659
- ("outputnode.itk_bold_to_t1" , "inputnode.itk_bold_to_t1" ),
660
- ]),
661
- (bold_std_trans_wf , outputnode , [
662
- ("outputnode.bold_std" , "bold_std" ),
663
- ("outputnode.bold_std_ref" , "bold_std_ref" ),
664
- ("outputnode.bold_mask_std" , "bold_mask_std" ),
665
- ]),
666
- ])
667
- # fmt:on
668
-
669
- if freesurfer :
670
- # fmt:off
671
- workflow .connect ([
672
- (bold_std_trans_wf , func_derivatives_wf , [
673
- ("outputnode.bold_aseg_std" , "inputnode.bold_aseg_std" ),
674
- ("outputnode.bold_aparc_std" , "inputnode.bold_aparc_std" ),
675
- ]),
676
- (bold_std_trans_wf , outputnode , [
677
- ("outputnode.bold_aseg_std" , "bold_aseg_std" ),
678
- ("outputnode.bold_aparc_std" , "bold_aparc_std" ),
679
- ]),
680
- ])
681
- # fmt:on
682
-
683
- if not multiecho :
684
- # fmt:off
685
- workflow .connect ([
686
- (bold_split , bold_std_trans_wf , [("out_files" , "inputnode.bold_split" )]),
687
- (bold_hmc_wf , bold_std_trans_wf , [
688
- ("outputnode.xforms" , "inputnode.hmc_xforms" ),
689
- ]),
690
- ])
691
- # fmt:on
692
- else :
693
- # fmt:off
694
- workflow .connect ([
695
- (split_opt_comb , bold_std_trans_wf , [("out_files" , "inputnode.bold_split" )]),
696
- (bold_std_trans_wf , outputnode , [("outputnode.t2star_std" , "t2star_std" )]),
697
- ])
698
- # fmt:on
699
-
700
- # Already applied in bold_bold_trans_wf, which inputs to bold_t2s_wf
701
- bold_std_trans_wf .inputs .inputnode .hmc_xforms = "identity"
702
-
703
- # fmt:off
704
- # func_derivatives_wf internally parametrizes over snapshotted spaces.
705
- workflow .connect ([
706
- (bold_std_trans_wf , func_derivatives_wf , [
707
- ("outputnode.template" , "inputnode.template" ),
708
- ("outputnode.spatial_reference" , "inputnode.spatial_reference" ),
709
- ("outputnode.bold_std_ref" , "inputnode.bold_std_ref" ),
710
- ("outputnode.bold_std" , "inputnode.bold_std" ),
711
- ("outputnode.bold_mask_std" , "inputnode.bold_mask_std" ),
712
- ]),
713
- ])
714
- # fmt:on
715
-
716
692
# SURFACES ##################################################################################
717
693
# Freesurfer
718
694
if freesurfer and freesurfer_spaces :
0 commit comments