61
61
from .fit .registration import init_register_template_wf
62
62
from .outputs import (
63
63
init_anat_reports_wf ,
64
- init_anat_second_derivatives_wf ,
65
64
init_ds_anat_volumes_wf ,
66
65
init_ds_dseg_wf ,
67
66
init_ds_fs_registration_wf ,
67
+ init_ds_fs_segs_wf ,
68
68
init_ds_grayord_metrics_wf ,
69
69
init_ds_mask_wf ,
70
70
init_ds_surface_metrics_wf ,
@@ -287,7 +287,6 @@ def init_anat_preproc_wf(
287
287
ds_std_volumes_wf = init_ds_anat_volumes_wf (
288
288
bids_root = bids_root ,
289
289
output_dir = output_dir ,
290
- name = 'ds_std_volumes_wf' ,
291
290
)
292
291
293
292
workflow .connect ([
@@ -320,10 +319,10 @@ def init_anat_preproc_wf(
320
319
]),
321
320
(anat_fit_wf , ds_std_volumes_wf , [
322
321
('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
323
- ('outputnode.t1w_preproc' , 'inputnode.t1w_preproc ' ),
324
- ('outputnode.t1w_mask' , 'inputnode.t1w_mask ' ),
325
- ('outputnode.t1w_dseg' , 'inputnode.t1w_dseg ' ),
326
- ('outputnode.t1w_tpms' , 'inputnode.t1w_tpms ' ),
322
+ ('outputnode.t1w_preproc' , 'inputnode.anat_preproc ' ),
323
+ ('outputnode.t1w_mask' , 'inputnode.anat_mask ' ),
324
+ ('outputnode.t1w_dseg' , 'inputnode.anat_dseg ' ),
325
+ ('outputnode.t1w_tpms' , 'inputnode.anat_tpms ' ),
327
326
]),
328
327
(template_iterator_wf , ds_std_volumes_wf , [
329
328
('outputnode.std_t1w' , 'inputnode.ref_file' ),
@@ -335,17 +334,12 @@ def init_anat_preproc_wf(
335
334
]) # fmt:skip
336
335
337
336
if freesurfer :
338
- anat_second_derivatives_wf = init_anat_second_derivatives_wf (
337
+ ds_fs_segs_wf = init_ds_fs_segs_wf (
339
338
bids_root = bids_root ,
340
339
output_dir = output_dir ,
341
- cifti_output = cifti_output ,
342
- )
343
- surface_derivatives_wf = init_surface_derivatives_wf (
344
- cifti_output = cifti_output ,
345
- )
346
- ds_surfaces_wf = init_ds_surfaces_wf (
347
- bids_root = bids_root , output_dir = output_dir , surfaces = ['inflated' ]
348
340
)
341
+ surface_derivatives_wf = init_surface_derivatives_wf ()
342
+ ds_surfaces_wf = init_ds_surfaces_wf (output_dir = output_dir , surfaces = ['inflated' ])
349
343
ds_curv_wf = init_ds_surface_metrics_wf (
350
344
bids_root = bids_root , output_dir = output_dir , metrics = ['curv' ], name = 'ds_curv_wf'
351
345
)
@@ -355,7 +349,7 @@ def init_anat_preproc_wf(
355
349
('outputnode.t1w_preproc' , 'inputnode.reference' ),
356
350
('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
357
351
('outputnode.subject_id' , 'inputnode.subject_id' ),
358
- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2t1w_xfm ' ),
352
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm ' ),
359
353
]),
360
354
(anat_fit_wf , ds_surfaces_wf , [
361
355
('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
@@ -369,12 +363,12 @@ def init_anat_preproc_wf(
369
363
(surface_derivatives_wf , ds_curv_wf , [
370
364
('outputnode.curv' , 'inputnode.curv' ),
371
365
]),
372
- (anat_fit_wf , anat_second_derivatives_wf , [
366
+ (anat_fit_wf , ds_fs_segs_wf , [
373
367
('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
374
368
]),
375
- (surface_derivatives_wf , anat_second_derivatives_wf , [
376
- ('outputnode.out_aseg' , 'inputnode.t1w_fs_aseg ' ),
377
- ('outputnode.out_aparc' , 'inputnode.t1w_fs_aparc ' ),
369
+ (surface_derivatives_wf , ds_fs_segs_wf , [
370
+ ('outputnode.out_aseg' , 'inputnode.anat_fs_aseg ' ),
371
+ ('outputnode.out_aparc' , 'inputnode.anat_fs_aparc ' ),
378
372
]),
379
373
(surface_derivatives_wf , outputnode , [
380
374
('outputnode.out_aseg' , 't1w_aseg' ),
@@ -765,10 +759,12 @@ def init_anat_fit_wf(
765
759
longitudinal = longitudinal ,
766
760
omp_nthreads = omp_nthreads ,
767
761
num_files = num_t1w ,
768
- contrast = 'T1w' ,
762
+ image_type = 'T1w' ,
769
763
name = 'anat_template_wf' ,
770
764
)
771
- ds_template_wf = init_ds_template_wf (output_dir = output_dir , num_t1w = num_t1w )
765
+ ds_template_wf = init_ds_template_wf (
766
+ output_dir = output_dir , num_anat = num_t1w , image_type = 'T1w'
767
+ )
772
768
773
769
# fmt:off
774
770
workflow .connect ([
@@ -781,11 +777,11 @@ def init_anat_fit_wf(
781
777
('outputnode.out_report' , 'inputnode.t1w_conform_report' ),
782
778
]),
783
779
(anat_template_wf , ds_template_wf , [
784
- ('outputnode.anat_realign_xfm' , 'inputnode.t1w_ref_xfms ' ),
780
+ ('outputnode.anat_realign_xfm' , 'inputnode.anat_ref_xfms ' ),
785
781
]),
786
782
(sourcefile_buffer , ds_template_wf , [('source_files' , 'inputnode.source_files' )]),
787
- (t1w_buffer , ds_template_wf , [('t1w_preproc' , 'inputnode.t1w_preproc ' )]),
788
- (ds_template_wf , outputnode , [('outputnode.t1w_preproc ' , 't1w_preproc' )]),
783
+ (t1w_buffer , ds_template_wf , [('t1w_preproc' , 'inputnode.anat_preproc ' )]),
784
+ (ds_template_wf , outputnode , [('outputnode.anat_preproc ' , 't1w_preproc' )]),
789
785
])
790
786
# fmt:on
791
787
else :
@@ -954,16 +950,16 @@ def init_anat_fit_wf(
954
950
workflow .connect ([
955
951
(fast , lut_t1w_dseg , [('partial_volume_map' , 'in_dseg' )]),
956
952
(sourcefile_buffer , ds_dseg_wf , [('source_files' , 'inputnode.source_files' )]),
957
- (lut_t1w_dseg , ds_dseg_wf , [('out' , 'inputnode.t1w_dseg ' )]),
958
- (ds_dseg_wf , seg_buffer , [('outputnode.t1w_dseg ' , 't1w_dseg' )]),
953
+ (lut_t1w_dseg , ds_dseg_wf , [('out' , 'inputnode.anat_dseg ' )]),
954
+ (ds_dseg_wf , seg_buffer , [('outputnode.anat_dseg ' , 't1w_dseg' )]),
959
955
])
960
956
if not have_tpms :
961
957
ds_tpms_wf = init_ds_tpms_wf (output_dir = output_dir )
962
958
workflow .connect ([
963
959
(fast , fast2bids , [('partial_volume_files' , 'inlist' )]),
964
960
(sourcefile_buffer , ds_tpms_wf , [('source_files' , 'inputnode.source_files' )]),
965
- (fast2bids , ds_tpms_wf , [('out' , 'inputnode.t1w_tpms ' )]),
966
- (ds_tpms_wf , seg_buffer , [('outputnode.t1w_tpms ' , 't1w_tpms' )]),
961
+ (fast2bids , ds_tpms_wf , [('out' , 'inputnode.anat_tpms ' )]),
962
+ (ds_tpms_wf , seg_buffer , [('outputnode.anat_tpms ' , 't1w_tpms' )]),
967
963
])
968
964
# fmt:on
969
965
else :
@@ -998,7 +994,9 @@ def init_anat_fit_wf(
998
994
omp_nthreads = omp_nthreads ,
999
995
templates = templates ,
1000
996
)
1001
- ds_template_registration_wf = init_ds_template_registration_wf (output_dir = output_dir )
997
+ ds_template_registration_wf = init_ds_template_registration_wf (
998
+ output_dir = output_dir , image_type = 'T1w'
999
+ )
1002
1000
1003
1001
# fmt:off
1004
1002
workflow .connect ([
@@ -1081,17 +1079,17 @@ def init_anat_fit_wf(
1081
1079
1082
1080
fsnative_xfms = precomputed .get ('transforms' , {}).get ('fsnative' )
1083
1081
if not fsnative_xfms :
1084
- ds_fs_registration_wf = init_ds_fs_registration_wf (output_dir = output_dir )
1082
+ ds_fs_registration_wf = init_ds_fs_registration_wf (output_dir = output_dir , image_type = 'T1w' )
1085
1083
# fmt:off
1086
1084
workflow .connect ([
1087
1085
(sourcefile_buffer , ds_fs_registration_wf , [
1088
1086
('source_files' , 'inputnode.source_files' ),
1089
1087
]),
1090
1088
(surface_recon_wf , ds_fs_registration_wf , [
1091
- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2t1w_xfm ' ),
1089
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm ' ),
1092
1090
]),
1093
1091
(ds_fs_registration_wf , outputnode , [
1094
- ('outputnode.fsnative2t1w_xfm ' , 'fsnative2t1w_xfm' ),
1092
+ ('outputnode.fsnative2anat_xfm ' , 'fsnative2t1w_xfm' ),
1095
1093
]),
1096
1094
])
1097
1095
# fmt:on
@@ -1114,7 +1112,7 @@ def init_anat_fit_wf(
1114
1112
(surface_recon_wf , refinement_wf , [
1115
1113
('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
1116
1114
('outputnode.subject_id' , 'inputnode.subject_id' ),
1117
- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2t1w_xfm ' ),
1115
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm ' ),
1118
1116
]),
1119
1117
(t1w_buffer , refinement_wf , [
1120
1118
('t1w_preproc' , 'inputnode.reference_image' ),
@@ -1135,7 +1133,7 @@ def init_anat_fit_wf(
1135
1133
longitudinal = longitudinal ,
1136
1134
omp_nthreads = omp_nthreads ,
1137
1135
num_files = len (t2w ),
1138
- contrast = 'T2w' ,
1136
+ image_type = 'T2w' ,
1139
1137
name = 't2w_template_wf' ,
1140
1138
)
1141
1139
bbreg = pe .Node (
@@ -1216,15 +1214,13 @@ def init_anat_fit_wf(
1216
1214
LOGGER .info (f'ANAT Stage 8: Creating GIFTI surfaces for { surfs + spheres } ' )
1217
1215
if surfs :
1218
1216
gifti_surfaces_wf = init_gifti_surfaces_wf (surfaces = surfs )
1219
- ds_surfaces_wf = init_ds_surfaces_wf (
1220
- bids_root = bids_root , output_dir = output_dir , surfaces = surfs
1221
- )
1217
+ ds_surfaces_wf = init_ds_surfaces_wf (output_dir = output_dir , surfaces = surfs )
1222
1218
# fmt:off
1223
1219
workflow .connect ([
1224
1220
(surface_recon_wf , gifti_surfaces_wf , [
1225
1221
('outputnode.subject_id' , 'inputnode.subject_id' ),
1226
1222
('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
1227
- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2t1w_xfm ' ),
1223
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm ' ),
1228
1224
]),
1229
1225
(gifti_surfaces_wf , surfaces_buffer , [
1230
1226
(f'outputnode.{ surf } ' , surf ) for surf in surfs
@@ -1240,7 +1236,7 @@ def init_anat_fit_wf(
1240
1236
surfaces = spheres , to_scanner = False , name = 'gifti_spheres_wf'
1241
1237
)
1242
1238
ds_spheres_wf = init_ds_surfaces_wf (
1243
- bids_root = bids_root , output_dir = output_dir , surfaces = spheres , name = 'ds_spheres_wf'
1239
+ output_dir = output_dir , surfaces = spheres , name = 'ds_spheres_wf'
1244
1240
)
1245
1241
# fmt:off
1246
1242
workflow .connect ([
@@ -1316,7 +1312,6 @@ def init_anat_fit_wf(
1316
1312
LOGGER .info ('ANAT Stage 9: Creating fsLR registration sphere' )
1317
1313
fsLR_reg_wf = init_fsLR_reg_wf ()
1318
1314
ds_fsLR_reg_wf = init_ds_surfaces_wf (
1319
- bids_root = bids_root ,
1320
1315
output_dir = output_dir ,
1321
1316
surfaces = ['sphere_reg_fsLR' ],
1322
1317
name = 'ds_fsLR_reg_wf' ,
@@ -1341,7 +1336,6 @@ def init_anat_fit_wf(
1341
1336
LOGGER .info ('ANAT Stage 10: Creating MSM-Sulc registration sphere' )
1342
1337
msm_sulc_wf = init_msm_sulc_wf (sloppy = sloppy )
1343
1338
ds_msmsulc_wf = init_ds_surfaces_wf (
1344
- bids_root = bids_root ,
1345
1339
output_dir = output_dir ,
1346
1340
surfaces = ['sphere_reg_msm' ],
1347
1341
name = 'ds_msmsulc_wf' ,
@@ -1375,7 +1369,7 @@ def init_anat_template_wf(
1375
1369
longitudinal : bool ,
1376
1370
omp_nthreads : int ,
1377
1371
num_files : int ,
1378
- contrast : str ,
1372
+ image_type : ty . Literal [ 'T1w' , 'T2w' ] ,
1379
1373
name : str = 'anat_template_wf' ,
1380
1374
):
1381
1375
"""
@@ -1388,7 +1382,7 @@ def init_anat_template_wf(
1388
1382
1389
1383
from smriprep.workflows.anatomical import init_anat_template_wf
1390
1384
wf = init_anat_template_wf(
1391
- longitudinal=False, omp_nthreads=1, num_files=1, contrast ="T1w"
1385
+ longitudinal=False, omp_nthreads=1, num_files=1, image_type ="T1w"
1392
1386
)
1393
1387
1394
1388
Parameters
@@ -1400,8 +1394,8 @@ def init_anat_template_wf(
1400
1394
Maximum number of threads an individual process may use
1401
1395
num_files : :obj:`int`
1402
1396
Number of images
1403
- contrast : :obj:`str`
1404
- Name of contrast, for reporting purposes, e.g., T1w, T2w, PDw
1397
+ image_type : :obj:`str`
1398
+ MR image type ( T1w, T2w, etc.)
1405
1399
name : :obj:`str`, optional
1406
1400
Workflow name (default: anat_template_wf)
1407
1401
@@ -1427,8 +1421,8 @@ def init_anat_template_wf(
1427
1421
if num_files > 1 :
1428
1422
fs_ver = fs .Info ().looseversion () or '(version unknown)'
1429
1423
workflow .__desc__ = f"""\
1430
- An anatomical { contrast } -reference map was computed after registration of
1431
- { num_files } { contrast } images (after INU-correction) using
1424
+ An anatomical { image_type } -reference map was computed after registration of
1425
+ { num_files } { image } images (after INU-correction) using
1432
1426
`mri_robust_template` [FreeSurfer { fs_ver } , @fs_template].
1433
1427
"""
1434
1428
0 commit comments