@@ -214,6 +214,7 @@ def init_single_subject_wf(subject_id: str):
214
214
if 't2w' in config .workflow .ignore :
215
215
subject_data ['t2w' ] = []
216
216
217
+ freesurfer = config .workflow .run_reconall
217
218
anat_only = config .workflow .anat_only
218
219
# Make sure we always go through these two checks
219
220
if not anat_only and not subject_data ['bold' ]:
@@ -319,7 +320,7 @@ def init_single_subject_wf(subject_id: str):
319
320
anat_fit_wf = init_anat_fit_wf (
320
321
bids_root = bids_root ,
321
322
output_dir = fmriprep_dir ,
322
- freesurfer = config . workflow . run_reconall ,
323
+ freesurfer = freesurfer ,
323
324
hires = config .workflow .hires ,
324
325
fs_no_resume = config .workflow .fs_no_resume ,
325
326
longitudinal = config .workflow .longitudinal ,
@@ -419,6 +420,53 @@ def init_single_subject_wf(subject_id: str):
419
420
]),
420
421
]) # fmt:skip
421
422
423
+ if freesurfer :
424
+ from smriprep .workflows .outputs import (
425
+ init_ds_fs_segs_wf ,
426
+ init_ds_surface_metrics_wf ,
427
+ init_ds_surfaces_wf ,
428
+ )
429
+ from smriprep .workflows .surfaces import init_surface_derivatives_wf
430
+
431
+ ds_fs_segs_wf = init_ds_fs_segs_wf (
432
+ bids_root = bids_root ,
433
+ output_dir = fmriprep_dir ,
434
+ )
435
+ surface_derivatives_wf = init_surface_derivatives_wf ()
436
+ ds_surfaces_wf = init_ds_surfaces_wf (output_dir = fmriprep_dir , surfaces = ['inflated' ])
437
+ ds_curv_wf = init_ds_surface_metrics_wf (
438
+ bids_root = bids_root ,
439
+ output_dir = fmriprep_dir ,
440
+ metrics = ['curv' ],
441
+ name = 'ds_curv_wf' ,
442
+ )
443
+
444
+ workflow .connect ([
445
+ (anat_fit_wf , surface_derivatives_wf , [
446
+ ('outputnode.t1w_preproc' , 'inputnode.reference' ),
447
+ ('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
448
+ ('outputnode.subject_id' , 'inputnode.subject_id' ),
449
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm' ),
450
+ ]),
451
+ (anat_fit_wf , ds_surfaces_wf , [
452
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
453
+ ]),
454
+ (surface_derivatives_wf , ds_surfaces_wf , [
455
+ ('outputnode.inflated' , 'inputnode.inflated' ),
456
+ ]),
457
+ (anat_fit_wf , ds_curv_wf , [
458
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
459
+ ]),
460
+ (surface_derivatives_wf , ds_curv_wf , [('outputnode.curv' , 'inputnode.curv' )]),
461
+ (anat_fit_wf , ds_fs_segs_wf , [
462
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
463
+ ]),
464
+ (surface_derivatives_wf , ds_fs_segs_wf , [
465
+ ('outputnode.out_aseg' , 'inputnode.anat_fs_aseg' ),
466
+ ('outputnode.out_aparc' , 'inputnode.anat_fs_aparc' ),
467
+ ]),
468
+ ]) # fmt:skip
469
+
422
470
# Thread MNI152NLin6Asym standard outputs to CIFTI subworkflow, skipping
423
471
# the iterator, which targets only output spaces.
424
472
# This can lead to duplication in the working directory if people actually
0 commit comments