@@ -790,7 +790,8 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
790790 ]
791791 pipeline_blocks += anat_init_blocks
792792
793- pipeline_blocks += [freesurfer_preproc ]
793+ if not rpool .check_rpool ('freesurfer-subject-dir' ):
794+ pipeline_blocks += [freesurfer_preproc ]
794795
795796 if not rpool .check_rpool ('desc-preproc_T1w' ):
796797
@@ -805,7 +806,7 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
805806 ]
806807 acpc_blocks .append (
807808 [brain_mask_acpc_freesurfer_fsl_tight ,
808- brain_mask_acpc_freesurfer_fsl_loose ]
809+ brain_mask_acpc_freesurfer_fsl_loose ]
809810 )
810811 else :
811812 acpc_blocks = [
@@ -845,8 +846,9 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
845846 anat_blocks = anat_preproc_blocks + acpc_blocks
846847
847848 pipeline_blocks += anat_blocks
848-
849- pipeline_blocks += [freesurfer_abcd_preproc ]
849+
850+ if not rpool .check_rpool ('freesurfer-subject-dir' ):
851+ pipeline_blocks += [freesurfer_abcd_preproc ]
850852
851853 # Anatomical T1 brain masking
852854 if not rpool .check_rpool ('space-T1w_desc-brain_mask' ) or \
@@ -947,9 +949,11 @@ def build_T1w_registration_stack(rpool, cfg, pipeline_blocks=None):
947949 if not rpool .check_rpool ('from-T1w_to-template_mode-image_xfm' ):
948950 reg_blocks = [
949951 [register_ANTs_anat_to_template , register_FSL_anat_to_template ],
950- overwrite_transform_anat_to_template ,
951- correct_restore_brain_intensity_abcd # ABCD-options pipeline
952+ overwrite_transform_anat_to_template
952953 ]
954+
955+ if not rpool .check_rpool ('desc-restore-brain_T1w' ):
956+ reg_blocks .append (correct_restore_brain_intensity_abcd )
953957
954958 if cfg .voxel_mirrored_homotopic_connectivity ['run' ]:
955959 if not rpool .check_rpool ('from-T1w_to-symtemplate_mode-image_xfm' ):
@@ -970,7 +974,6 @@ def build_segmentation_stack(rpool, cfg, pipeline_blocks=None):
970974 seg_blocks = [
971975 [tissue_seg_fsl_fast ,
972976 tissue_seg_ants_prior ]
973- #tissue_seg_freesurfer
974977 ]
975978 if 'T1_Template' in cfg .segmentation ['tissue_segmentation' ][
976979 'Template_Based' ]['template_for_segmentation' ]:
@@ -1046,10 +1049,7 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
10461049 pipeline_blocks = build_segmentation_stack (rpool , cfg , pipeline_blocks )
10471050
10481051 # Functional Preprocessing, including motion correction and BOLD masking
1049- if cfg .functional_preproc ['run' ] and \
1050- (not rpool .check_rpool ('desc-brain_bold' ) or
1051- not rpool .check_rpool ('space-bold_desc-brain_mask' ) or
1052- not rpool .check_rpool ('movement-parameters' )):
1052+ if cfg .functional_preproc ['run' ]:
10531053 func_init_blocks = [
10541054 func_scaling ,
10551055 func_truncate
@@ -1059,16 +1059,21 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
10591059 func_slice_time ,
10601060 func_reorient
10611061 ]
1062+
1063+ if not rpool .check_rpool ('desc-mean_bold' ):
1064+ func_preproc_blocks .append (func_mean )
1065+
1066+ func_mask_blocks = []
1067+ if not rpool .check_rpool ('space-bold_desc-brain_mask' ):
1068+ func_mask_blocks = [
1069+ [bold_mask_afni , bold_mask_fsl , bold_mask_fsl_afni ,
1070+ bold_mask_anatomical_refined , bold_mask_anatomical_based ,
1071+ bold_mask_anatomical_resampled , bold_mask_ccs ],
1072+ bold_masking ]
1073+
10621074 func_prep_blocks = [
1063- [bold_mask_afni , bold_mask_fsl , bold_mask_fsl_afni ,
1064- bold_mask_anatomical_refined , bold_mask_anatomical_based ,
1065- bold_mask_anatomical_resampled ,
1066- bold_mask_ccs ],
1067- bold_masking ,
10681075 calc_motion_stats ,
1069- func_mean ,
1070- func_normalize #,
1071- #func_mask_normalize
1076+ func_normalize
10721077 ]
10731078
10741079 # Distortion/Susceptibility Correction
@@ -1084,24 +1089,31 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
10841089 distcor_blocks = [distcor_blocks ]
10851090 func_prep_blocks += distcor_blocks
10861091
1087- if cfg ['functional_preproc' ]['motion_estimates_and_correction' ][
1088- 'motion_estimates' ]['calculate_motion_first' ]:
1089- func_motion_blocks = [
1090- get_motion_ref ,
1091- func_motion_estimates ,
1092- motion_estimate_filter
1093- ]
1094- func_blocks = func_init_blocks + func_motion_blocks + \
1095- func_preproc_blocks + [func_motion_correct_only ] + \
1096- func_prep_blocks
1092+ func_motion_blocks = []
1093+ if not rpool .check_rpool ('movement-parameters' ):
1094+ if cfg ['functional_preproc' ]['motion_estimates_and_correction' ][
1095+ 'motion_estimates' ]['calculate_motion_first' ]:
1096+ func_motion_blocks = [
1097+ get_motion_ref ,
1098+ func_motion_estimates ,
1099+ motion_estimate_filter
1100+ ]
1101+ func_blocks = func_init_blocks + func_motion_blocks + \
1102+ func_preproc_blocks + [func_motion_correct_only ] + \
1103+ func_mask_blocks + func_prep_blocks
1104+ else :
1105+ func_motion_blocks = [
1106+ get_motion_ref ,
1107+ func_motion_correct ,
1108+ motion_estimate_filter
1109+ ]
1110+ func_blocks = func_init_blocks + func_preproc_blocks + \
1111+ func_motion_blocks + func_mask_blocks + \
1112+ func_prep_blocks
10971113 else :
1098- func_motion_blocks = [
1099- get_motion_ref ,
1100- func_motion_correct ,
1101- motion_estimate_filter
1102- ]
11031114 func_blocks = func_init_blocks + func_preproc_blocks + \
1104- func_motion_blocks + func_prep_blocks
1115+ func_motion_blocks + func_mask_blocks + \
1116+ func_prep_blocks
11051117
11061118 pipeline_blocks += func_blocks
11071119
0 commit comments