@@ -707,6 +707,11 @@ def init_anat_fit_wf(
707707 anat2std_buffer = pe .Node (niu .Merge (2 ), name = 'anat2std_buffer' )
708708 std2anat_buffer = pe .Node (niu .Merge (2 ), name = 'std2anat_buffer' )
709709
710+ # Stage 5 results: FreeSurfer-to-anat transforms
711+ fs2anat_buffer = pe .Node (
712+ niu .IdentityInterface (fields = ['fsnative2anat_xfm' ]), name = 'fs2anat_buffer'
713+ )
714+
710715 # Stage 6 results: Refined stage 2 results; may be direct copy if no refinement
711716 refined_buffer = pe .Node (
712717 niu .IdentityInterface (fields = ['t1w_mask' , 't1w_brain' ]),
@@ -733,6 +738,7 @@ def init_anat_fit_wf(
733738 (anat2std_buffer , outputnode , [('out' , 'anat2std_xfm' )]),
734739 (std2anat_buffer , outputnode , [('out' , 'std2anat_xfm' )]),
735740 (template_buffer , outputnode , [('out' , 'template' )]),
741+ (fs2anat_buffer , outputnode , [('fsnative2anat_xfm' , 'fsnative2t1w_xfm' )]),
736742 (sourcefile_buffer , outputnode , [('source_files' , 't1w_valid_list' )]),
737743 (surfaces_buffer , outputnode , [
738744 ('white' , 'white' ),
@@ -1089,13 +1095,13 @@ def init_anat_fit_wf(
10891095 (surface_recon_wf , ds_fs_registration_wf , [
10901096 ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm' ),
10911097 ]),
1092- (ds_fs_registration_wf , outputnode , [
1093- ('outputnode.fsnative2anat_xfm' , 'fsnative2t1w_xfm ' ),
1098+ (ds_fs_registration_wf , fs2anat_buffer , [
1099+ ('outputnode.fsnative2anat_xfm' , 'fsnative2anat_xfm ' ),
10941100 ]),
10951101 ]) # fmt:skip
10961102 elif 'reverse' in fsnative_xfms :
10971103 LOGGER .info ('ANAT Found fsnative-T1w transform - skipping registration' )
1098- outputnode .inputs .fsnative2t1w_xfm = fsnative_xfms ['reverse' ]
1104+ fs2anat_buffer .inputs .fsnative2anat_xfm = fsnative_xfms ['reverse' ]
10991105 else :
11001106 raise RuntimeError (
11011107 'Found a T1w-to-fsnative transform without the reverse. Time to handle this.'
@@ -1111,12 +1117,14 @@ def init_anat_fit_wf(
11111117 (surface_recon_wf , refinement_wf , [
11121118 ('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
11131119 ('outputnode.subject_id' , 'inputnode.subject_id' ),
1114- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm' ),
11151120 ]),
11161121 (t1w_buffer , refinement_wf , [
11171122 ('t1w_preproc' , 'inputnode.reference_image' ),
11181123 ('ants_seg' , 'inputnode.ants_segs' ),
11191124 ]),
1125+ (fs2anat_buffer , refinement_wf , [
1126+ ('fsnative2anat_xfm' , 'inputnode.fsnative2anat_xfm' ),
1127+ ]),
11201128 (t1w_buffer , applyrefined , [('t1w_preproc' , 'in_file' )]),
11211129 (refinement_wf , applyrefined , [('outputnode.out_brainmask' , 'mask_file' )]),
11221130 (refinement_wf , refined_buffer , [('outputnode.out_brainmask' , 't1w_mask' )]),
@@ -1171,7 +1179,7 @@ def init_anat_fit_wf(
11711179 ('outputnode.subjects_dir' , 'subjects_dir' ),
11721180 ]),
11731181 (bbreg , coreg_xfms , [('out_lta_file' , 'in1' )]),
1174- (surface_recon_wf , coreg_xfms , [('outputnode.fsnative2t1w_xfm ' , 'in2' )]),
1182+ (fs2anat_buffer , coreg_xfms , [('fsnative2anat_xfm ' , 'in2' )]),
11751183 (coreg_xfms , t2wtot1w_xfm , [('out' , 'in_xfms' )]),
11761184 (t2w_template_wf , t2w_resample , [('outputnode.anat_ref' , 'input_image' )]),
11771185 (t1w_buffer , t2w_resample , [('t1w_preproc' , 'reference_image' )]),
@@ -1217,7 +1225,9 @@ def init_anat_fit_wf(
12171225 (surface_recon_wf , gifti_surfaces_wf , [
12181226 ('outputnode.subject_id' , 'inputnode.subject_id' ),
12191227 ('outputnode.subjects_dir' , 'inputnode.subjects_dir' ),
1220- ('outputnode.fsnative2t1w_xfm' , 'inputnode.fsnative2anat_xfm' ),
1228+ ]),
1229+ (fs2anat_buffer , gifti_surfaces_wf , [
1230+ ('fsnative2anat_xfm' , 'inputnode.fsnative2anat_xfm' ),
12211231 ]),
12221232 (sourcefile_buffer , ds_surfaces_wf , [('source_files' , 'inputnode.source_files' )]),
12231233 (gifti_surfaces_wf , ds_surfaces_wf , [
0 commit comments