@@ -961,351 +961,12 @@ def init_func_derivatives_wf(
961
961
raw_sources = pe .Node (niu .Function (function = _bids_relative ), name = 'raw_sources' )
962
962
raw_sources .inputs .bids_root = bids_root
963
963
964
- ds_ref_t1w_xfm = pe .Node (
965
- DerivativesDataSink (
966
- base_directory = output_dir ,
967
- to = 'T1w' ,
968
- mode = 'image' ,
969
- suffix = 'xfm' ,
970
- extension = '.txt' ,
971
- dismiss_entities = ('echo' ,),
972
- ** {'from' : 'scanner' },
973
- ),
974
- name = 'ds_ref_t1w_xfm' ,
975
- run_without_submitting = True ,
976
- )
977
- ds_ref_t1w_inv_xfm = pe .Node (
978
- DerivativesDataSink (
979
- base_directory = output_dir ,
980
- to = 'scanner' ,
981
- mode = 'image' ,
982
- suffix = 'xfm' ,
983
- extension = '.txt' ,
984
- dismiss_entities = ('echo' ,),
985
- ** {'from' : 'T1w' },
986
- ),
987
- name = 'ds_t1w_tpl_inv_xfm' ,
988
- run_without_submitting = True ,
989
- )
990
964
# fmt:off
991
965
workflow .connect ([
992
966
(inputnode , raw_sources , [('all_source_files' , 'in_files' )]),
993
- (inputnode , ds_ref_t1w_xfm , [('source_file' , 'source_file' ),
994
- ('bold2anat_xfm' , 'in_file' )]),
995
- (inputnode , ds_ref_t1w_inv_xfm , [('source_file' , 'source_file' ),
996
- ('anat2bold_xfm' , 'in_file' )]),
997
- ])
998
- # fmt:on
999
-
1000
- # Output HMC and reference volume
1001
- ds_bold_hmc_xfm = pe .Node (
1002
- DerivativesDataSink (
1003
- base_directory = output_dir ,
1004
- to = 'boldref' ,
1005
- mode = 'image' ,
1006
- suffix = 'xfm' ,
1007
- extension = '.txt' ,
1008
- dismiss_entities = ('echo' ,),
1009
- ** {'from' : 'scanner' },
1010
- ),
1011
- name = 'ds_bold_hmc_xfm' ,
1012
- run_without_submitting = True ,
1013
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1014
- )
1015
-
1016
- ds_bold_native_ref = pe .Node (
1017
- DerivativesDataSink (
1018
- base_directory = output_dir , suffix = 'boldref' , compress = True , dismiss_entities = ("echo" ,)
1019
- ),
1020
- name = 'ds_bold_native_ref' ,
1021
- run_without_submitting = True ,
1022
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1023
- )
1024
-
1025
- # fmt:off
1026
- workflow .connect ([
1027
- (inputnode , ds_bold_hmc_xfm , [('source_file' , 'source_file' ),
1028
- ('hmc_xforms' , 'in_file' )]),
1029
- (inputnode , ds_bold_native_ref , [('source_file' , 'source_file' ),
1030
- ('bold_native_ref' , 'in_file' )])
1031
967
])
1032
968
# fmt:on
1033
969
1034
- # Resample to T1w space
1035
- if nonstd_spaces .intersection (('T1w' , 'anat' )):
1036
- ds_bold_t1 = pe .Node (
1037
- DerivativesDataSink (
1038
- base_directory = output_dir ,
1039
- space = 'T1w' ,
1040
- desc = 'preproc' ,
1041
- compress = True ,
1042
- SkullStripped = masked ,
1043
- TaskName = metadata .get ('TaskName' ),
1044
- ** timing_parameters ,
1045
- ),
1046
- name = 'ds_bold_t1' ,
1047
- run_without_submitting = True ,
1048
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1049
- )
1050
- ds_bold_t1_ref = pe .Node (
1051
- DerivativesDataSink (
1052
- base_directory = output_dir ,
1053
- space = 'T1w' ,
1054
- suffix = 'boldref' ,
1055
- compress = True ,
1056
- dismiss_entities = ("echo" ,),
1057
- ),
1058
- name = 'ds_bold_t1_ref' ,
1059
- run_without_submitting = True ,
1060
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1061
- )
1062
- ds_bold_mask_t1 = pe .Node (
1063
- DerivativesDataSink (
1064
- base_directory = output_dir ,
1065
- space = 'T1w' ,
1066
- desc = 'brain' ,
1067
- suffix = 'mask' ,
1068
- compress = True ,
1069
- dismiss_entities = ("echo" ,),
1070
- ),
1071
- name = 'ds_bold_mask_t1' ,
1072
- run_without_submitting = True ,
1073
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1074
- )
1075
- # fmt:off
1076
- workflow .connect ([
1077
- (inputnode , ds_bold_t1 , [('source_file' , 'source_file' ),
1078
- ('bold_t1' , 'in_file' )]),
1079
- (inputnode , ds_bold_t1_ref , [('source_file' , 'source_file' ),
1080
- ('bold_t1_ref' , 'in_file' )]),
1081
- (inputnode , ds_bold_mask_t1 , [('source_file' , 'source_file' ),
1082
- ('bold_mask_t1' , 'in_file' )]),
1083
- (raw_sources , ds_bold_mask_t1 , [('out' , 'RawSources' )]),
1084
- ])
1085
- # fmt:on
1086
- if freesurfer :
1087
- ds_bold_aseg_t1 = pe .Node (
1088
- DerivativesDataSink (
1089
- base_directory = output_dir ,
1090
- space = 'T1w' ,
1091
- desc = 'aseg' ,
1092
- suffix = 'dseg' ,
1093
- compress = True ,
1094
- dismiss_entities = ("echo" ,),
1095
- ),
1096
- name = 'ds_bold_aseg_t1' ,
1097
- run_without_submitting = True ,
1098
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1099
- )
1100
- ds_bold_aparc_t1 = pe .Node (
1101
- DerivativesDataSink (
1102
- base_directory = output_dir ,
1103
- space = 'T1w' ,
1104
- desc = 'aparcaseg' ,
1105
- suffix = 'dseg' ,
1106
- compress = True ,
1107
- dismiss_entities = ("echo" ,),
1108
- ),
1109
- name = 'ds_bold_aparc_t1' ,
1110
- run_without_submitting = True ,
1111
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1112
- )
1113
- # fmt:off
1114
- workflow .connect ([
1115
- (inputnode , ds_bold_aseg_t1 , [('source_file' , 'source_file' ),
1116
- ('bold_aseg_t1' , 'in_file' )]),
1117
- (inputnode , ds_bold_aparc_t1 , [('source_file' , 'source_file' ),
1118
- ('bold_aparc_t1' , 'in_file' )]),
1119
- ])
1120
- # fmt:on
1121
- if multiecho :
1122
- ds_t2star_t1 = pe .Node (
1123
- DerivativesDataSink (
1124
- base_directory = output_dir ,
1125
- space = 'T1w' ,
1126
- suffix = 'T2starmap' ,
1127
- compress = True ,
1128
- dismiss_entities = ("echo" ,),
1129
- ** t2star_meta ,
1130
- ),
1131
- name = 'ds_t2star_t1' ,
1132
- run_without_submitting = True ,
1133
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1134
- )
1135
- # fmt:off
1136
- workflow .connect ([
1137
- (inputnode , ds_t2star_t1 , [('source_file' , 'source_file' ),
1138
- ('t2star_t1' , 'in_file' )]),
1139
- (raw_sources , ds_t2star_t1 , [('out' , 'RawSources' )]),
1140
- ])
1141
- # fmt:on
1142
-
1143
- if getattr (spaces , '_cached' ) is None :
1144
- return workflow
1145
-
1146
- # Store resamplings in standard spaces when listed in --output-spaces
1147
- if spaces .cached .references :
1148
- from niworkflows .interfaces .space import SpaceDataSource
1149
-
1150
- spacesource = pe .Node (SpaceDataSource (), name = 'spacesource' , run_without_submitting = True )
1151
- spacesource .iterables = (
1152
- 'in_tuple' ,
1153
- [(s .fullname , s .spec ) for s in spaces .cached .get_standard (dim = (3 ,))],
1154
- )
1155
-
1156
- fields = ['template' , 'bold_std' , 'bold_std_ref' , 'bold_mask_std' ]
1157
- if multiecho :
1158
- fields .append ('t2star_std' )
1159
- select_std = pe .Node (
1160
- KeySelect (fields = fields ),
1161
- name = 'select_std' ,
1162
- run_without_submitting = True ,
1163
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1164
- )
1165
-
1166
- ds_bold_std = pe .Node (
1167
- DerivativesDataSink (
1168
- base_directory = output_dir ,
1169
- desc = 'preproc' ,
1170
- compress = True ,
1171
- SkullStripped = masked ,
1172
- TaskName = metadata .get ('TaskName' ),
1173
- ** timing_parameters ,
1174
- ),
1175
- name = 'ds_bold_std' ,
1176
- run_without_submitting = True ,
1177
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1178
- )
1179
- ds_bold_std_ref = pe .Node (
1180
- DerivativesDataSink (
1181
- base_directory = output_dir ,
1182
- suffix = 'boldref' ,
1183
- compress = True ,
1184
- dismiss_entities = ("echo" ,),
1185
- ),
1186
- name = 'ds_bold_std_ref' ,
1187
- run_without_submitting = True ,
1188
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1189
- )
1190
- ds_bold_mask_std = pe .Node (
1191
- DerivativesDataSink (
1192
- base_directory = output_dir ,
1193
- desc = 'brain' ,
1194
- suffix = 'mask' ,
1195
- compress = True ,
1196
- dismiss_entities = ("echo" ,),
1197
- ),
1198
- name = 'ds_bold_mask_std' ,
1199
- run_without_submitting = True ,
1200
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1201
- )
1202
- # fmt:off
1203
- workflow .connect ([
1204
- (inputnode , ds_bold_std , [('source_file' , 'source_file' )]),
1205
- (inputnode , ds_bold_std_ref , [('source_file' , 'source_file' )]),
1206
- (inputnode , ds_bold_mask_std , [('source_file' , 'source_file' )]),
1207
- (inputnode , select_std , [('bold_std' , 'bold_std' ),
1208
- ('bold_std_ref' , 'bold_std_ref' ),
1209
- ('bold_mask_std' , 'bold_mask_std' ),
1210
- ('t2star_std' , 't2star_std' ),
1211
- ('template' , 'template' ),
1212
- ('spatial_reference' , 'keys' )]),
1213
- (spacesource , select_std , [('uid' , 'key' )]),
1214
- (select_std , ds_bold_std , [('bold_std' , 'in_file' )]),
1215
- (spacesource , ds_bold_std , [('space' , 'space' ),
1216
- ('cohort' , 'cohort' ),
1217
- ('resolution' , 'resolution' ),
1218
- ('density' , 'density' )]),
1219
- (select_std , ds_bold_std_ref , [('bold_std_ref' , 'in_file' )]),
1220
- (spacesource , ds_bold_std_ref , [('space' , 'space' ),
1221
- ('cohort' , 'cohort' ),
1222
- ('resolution' , 'resolution' ),
1223
- ('density' , 'density' )]),
1224
- (select_std , ds_bold_mask_std , [('bold_mask_std' , 'in_file' )]),
1225
- (spacesource , ds_bold_mask_std , [('space' , 'space' ),
1226
- ('cohort' , 'cohort' ),
1227
- ('resolution' , 'resolution' ),
1228
- ('density' , 'density' )]),
1229
- (raw_sources , ds_bold_mask_std , [('out' , 'RawSources' )]),
1230
- ])
1231
- # fmt:on
1232
- if freesurfer :
1233
- select_fs_std = pe .Node (
1234
- KeySelect (fields = ['bold_aseg_std' , 'bold_aparc_std' , 'template' ]),
1235
- name = 'select_fs_std' ,
1236
- run_without_submitting = True ,
1237
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1238
- )
1239
- ds_bold_aseg_std = pe .Node (
1240
- DerivativesDataSink (
1241
- base_directory = output_dir ,
1242
- desc = 'aseg' ,
1243
- suffix = 'dseg' ,
1244
- compress = True ,
1245
- dismiss_entities = ("echo" ,),
1246
- ),
1247
- name = 'ds_bold_aseg_std' ,
1248
- run_without_submitting = True ,
1249
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1250
- )
1251
- ds_bold_aparc_std = pe .Node (
1252
- DerivativesDataSink (
1253
- base_directory = output_dir ,
1254
- desc = 'aparcaseg' ,
1255
- suffix = 'dseg' ,
1256
- compress = True ,
1257
- dismiss_entities = ("echo" ,),
1258
- ),
1259
- name = 'ds_bold_aparc_std' ,
1260
- run_without_submitting = True ,
1261
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1262
- )
1263
- # fmt:off
1264
- workflow .connect ([
1265
- (spacesource , select_fs_std , [('uid' , 'key' )]),
1266
- (inputnode , select_fs_std , [('bold_aseg_std' , 'bold_aseg_std' ),
1267
- ('bold_aparc_std' , 'bold_aparc_std' ),
1268
- ('template' , 'template' ),
1269
- ('spatial_reference' , 'keys' )]),
1270
- (select_fs_std , ds_bold_aseg_std , [('bold_aseg_std' , 'in_file' )]),
1271
- (spacesource , ds_bold_aseg_std , [('space' , 'space' ),
1272
- ('cohort' , 'cohort' ),
1273
- ('resolution' , 'resolution' ),
1274
- ('density' , 'density' )]),
1275
- (select_fs_std , ds_bold_aparc_std , [('bold_aparc_std' , 'in_file' )]),
1276
- (spacesource , ds_bold_aparc_std , [('space' , 'space' ),
1277
- ('cohort' , 'cohort' ),
1278
- ('resolution' , 'resolution' ),
1279
- ('density' , 'density' )]),
1280
- (inputnode , ds_bold_aseg_std , [('source_file' , 'source_file' )]),
1281
- (inputnode , ds_bold_aparc_std , [('source_file' , 'source_file' )])
1282
- ])
1283
- # fmt:on
1284
- if multiecho :
1285
- ds_t2star_std = pe .Node (
1286
- DerivativesDataSink (
1287
- base_directory = output_dir ,
1288
- suffix = 'T2starmap' ,
1289
- compress = True ,
1290
- dismiss_entities = ("echo" ,),
1291
- ** t2star_meta ,
1292
- ),
1293
- name = 'ds_t2star_std' ,
1294
- run_without_submitting = True ,
1295
- mem_gb = DEFAULT_MEMORY_MIN_GB ,
1296
- )
1297
- # fmt:off
1298
- workflow .connect ([
1299
- (inputnode , ds_t2star_std , [('source_file' , 'source_file' )]),
1300
- (select_std , ds_t2star_std , [('t2star_std' , 'in_file' )]),
1301
- (spacesource , ds_t2star_std , [('space' , 'space' ),
1302
- ('cohort' , 'cohort' ),
1303
- ('resolution' , 'resolution' ),
1304
- ('density' , 'density' )]),
1305
- (raw_sources , ds_t2star_std , [('out' , 'RawSources' )]),
1306
- ])
1307
- # fmt:on
1308
-
1309
970
fs_outputs = spaces .cached .get_fs_spaces ()
1310
971
if freesurfer and fs_outputs :
1311
972
from niworkflows .interfaces .surf import Path2BIDS
0 commit comments