@@ -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,46 @@ 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 init_ds_fs_segs_wf , init_ds_surface_metrics_wf
425
+ from smriprep .workflows .surfaces import init_surface_derivatives_wf
426
+
427
+ ds_fs_segs_wf = init_ds_fs_segs_wf (bids_root = bids_root , output_dir = fmriprep_dir )
428
+ surface_derivatives_wf = init_surface_derivatives_wf ()
429
+ ds_surfaces_wf = init_ds_surfaces_wf (output_dir = fmriprep_dir , surfaces = ['inflated' ])
430
+ ds_curv_wf = init_ds_surface_metrics_wf (
431
+ bids_root = bids_root ,
432
+ output_dir = fmriprep_dir ,
433
+ metrics = ['curv' ],
434
+ name = 'ds_curv_wf' ,
435
+ )
436
+
437
+ workflow .connect ([
438
+ (anat_fit_wf , surface_derivatives_wf , [
439
+ ('outputnode.t1w_preproc' , 'inputnode.reference' ),
440
+ ('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
441
+ ('outputnode.subject_id' , 'inputnode.subject_id' ),
442
+ ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm' ),
443
+ ]),
444
+ (anat_fit_wf , ds_surfaces_wf , [
445
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
446
+ ]),
447
+ (surface_derivatives_wf , ds_surfaces_wf , [
448
+ ('outputnode.inflated' , 'inputnode.inflated' ),
449
+ ]),
450
+ (anat_fit_wf , ds_curv_wf , [
451
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
452
+ ]),
453
+ (surface_derivatives_wf , ds_curv_wf , [('outputnode.curv' , 'inputnode.curv' )]),
454
+ (anat_fit_wf , ds_fs_segs_wf , [
455
+ ('outputnode.t1w_valid_list' , 'inputnode.source_files' ),
456
+ ]),
457
+ (surface_derivatives_wf , ds_fs_segs_wf , [
458
+ ('outputnode.out_aseg' , 'inputnode.anat_fs_aseg' ),
459
+ ('outputnode.out_aparc' , 'inputnode.anat_fs_aparc' ),
460
+ ]),
461
+ ]) # fmt:skip
462
+
422
463
# Thread MNI152NLin6Asym standard outputs to CIFTI subworkflow, skipping
423
464
# the iterator, which targets only output spaces.
424
465
# This can lead to duplication in the working directory if people actually
0 commit comments