@@ -791,7 +791,8 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
791791 ]
792792 pipeline_blocks += anat_init_blocks
793793
794- pipeline_blocks += [freesurfer_preproc ]
794+ if not rpool .check_rpool ('freesurfer-subject-dir' ):
795+ pipeline_blocks += [freesurfer_preproc ]
795796
796797 if not rpool .check_rpool ('desc-preproc_T1w' ):
797798
@@ -806,7 +807,7 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
806807 ]
807808 acpc_blocks .append (
808809 [brain_mask_acpc_freesurfer_fsl_tight ,
809- brain_mask_acpc_freesurfer_fsl_loose ]
810+ brain_mask_acpc_freesurfer_fsl_loose ]
810811 )
811812 else :
812813 acpc_blocks = [
@@ -846,8 +847,9 @@ def build_anat_preproc_stack(rpool, cfg, pipeline_blocks=None):
846847 anat_blocks = anat_preproc_blocks + acpc_blocks
847848
848849 pipeline_blocks += anat_blocks
849-
850- pipeline_blocks += [freesurfer_abcd_preproc ]
850+
851+ if not rpool .check_rpool ('freesurfer-subject-dir' ):
852+ pipeline_blocks += [freesurfer_abcd_preproc ]
851853
852854 # Anatomical T1 brain masking
853855 if not rpool .check_rpool ('space-T1w_desc-brain_mask' ) or \
@@ -948,9 +950,11 @@ def build_T1w_registration_stack(rpool, cfg, pipeline_blocks=None):
948950 if not rpool .check_rpool ('from-T1w_to-template_mode-image_xfm' ):
949951 reg_blocks = [
950952 [register_ANTs_anat_to_template , register_FSL_anat_to_template ],
951- overwrite_transform_anat_to_template ,
952- correct_restore_brain_intensity_abcd # ABCD-options pipeline
953+ overwrite_transform_anat_to_template
953954 ]
955+
956+ if not rpool .check_rpool ('desc-restore-brain_T1w' ):
957+ reg_blocks .append (correct_restore_brain_intensity_abcd )
954958
955959 if cfg .voxel_mirrored_homotopic_connectivity ['run' ]:
956960 if not rpool .check_rpool ('from-T1w_to-symtemplate_mode-image_xfm' ):
@@ -971,7 +975,6 @@ def build_segmentation_stack(rpool, cfg, pipeline_blocks=None):
971975 seg_blocks = [
972976 [tissue_seg_fsl_fast ,
973977 tissue_seg_ants_prior ]
974- #tissue_seg_freesurfer
975978 ]
976979 if 'T1_Template' in cfg .segmentation ['tissue_segmentation' ][
977980 'Template_Based' ]['template_for_segmentation' ]:
@@ -1076,10 +1079,7 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
10761079 pipeline_blocks = build_segmentation_stack (rpool , cfg , pipeline_blocks )
10771080
10781081 # Functional Preprocessing, including motion correction and BOLD masking
1079- if cfg .functional_preproc ['run' ] and \
1080- (not rpool .check_rpool ('desc-brain_bold' ) or
1081- not rpool .check_rpool ('space-bold_desc-brain_mask' ) or
1082- not rpool .check_rpool ('movement-parameters' )):
1082+ if cfg .functional_preproc ['run' ]:
10831083 func_init_blocks = [
10841084 func_scaling ,
10851085 func_truncate
@@ -1089,14 +1089,20 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
10891089 func_slice_time ,
10901090 func_reorient
10911091 ]
1092+
1093+ if not rpool .check_rpool ('desc-mean_bold' ):
1094+ func_preproc_blocks .append (func_mean )
1095+
1096+ func_mask_blocks = []
1097+ if not rpool .check_rpool ('space-bold_desc-brain_mask' ):
1098+ func_mask_blocks = [
1099+ [bold_mask_afni , bold_mask_fsl , bold_mask_fsl_afni ,
1100+ bold_mask_anatomical_refined , bold_mask_anatomical_based ,
1101+ bold_mask_anatomical_resampled , bold_mask_ccs ],
1102+ bold_masking ]
1103+
10921104 func_prep_blocks = [
1093- [bold_mask_afni , bold_mask_fsl , bold_mask_fsl_afni ,
1094- bold_mask_anatomical_refined , bold_mask_anatomical_based ,
1095- bold_mask_anatomical_resampled ,
1096- bold_mask_ccs ],
1097- bold_masking ,
10981105 calc_motion_stats ,
1099- func_mean ,
11001106 func_normalize
11011107 ]
11021108
@@ -1114,24 +1120,31 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
11141120 distcor_blocks = [distcor_blocks ]
11151121 func_prep_blocks += distcor_blocks
11161122
1117- if cfg ['functional_preproc' ]['motion_estimates_and_correction' ][
1118- 'motion_estimates' ]['calculate_motion_first' ]:
1119- func_motion_blocks = [
1120- get_motion_ref ,
1121- func_motion_estimates ,
1122- motion_estimate_filter
1123- ]
1124- func_blocks = func_init_blocks + func_motion_blocks + \
1125- func_preproc_blocks + [func_motion_correct_only ] + \
1126- func_prep_blocks
1123+ func_motion_blocks = []
1124+ if not rpool .check_rpool ('movement-parameters' ):
1125+ if cfg ['functional_preproc' ]['motion_estimates_and_correction' ][
1126+ 'motion_estimates' ]['calculate_motion_first' ]:
1127+ func_motion_blocks = [
1128+ get_motion_ref ,
1129+ func_motion_estimates ,
1130+ motion_estimate_filter
1131+ ]
1132+ func_blocks = func_init_blocks + func_motion_blocks + \
1133+ func_preproc_blocks + [func_motion_correct_only ] + \
1134+ func_mask_blocks + func_prep_blocks
1135+ else :
1136+ func_motion_blocks = [
1137+ get_motion_ref ,
1138+ func_motion_correct ,
1139+ motion_estimate_filter
1140+ ]
1141+ func_blocks = func_init_blocks + func_preproc_blocks + \
1142+ func_motion_blocks + func_mask_blocks + \
1143+ func_prep_blocks
11271144 else :
1128- func_motion_blocks = [
1129- get_motion_ref ,
1130- func_motion_correct ,
1131- motion_estimate_filter
1132- ]
11331145 func_blocks = func_init_blocks + func_preproc_blocks + \
1134- func_motion_blocks + func_prep_blocks
1146+ func_motion_blocks + func_mask_blocks + \
1147+ func_prep_blocks
11351148
11361149 pipeline_blocks += func_blocks
11371150
0 commit comments