@@ -127,6 +127,8 @@ def init_bold_reg_wf(
127127 Affine transform from T1 space to BOLD space (ITK format)
128128 fallback
129129 Boolean indicating whether BBR was rejected (mri_coreg registration returned)
130+ flip_info
131+ Information regarding whether a left-right flip was detected
130132
131133 See Also
132134 --------
@@ -153,7 +155,9 @@ def init_bold_reg_wf(
153155 )
154156
155157 outputnode = pe .Node (
156- niu .IdentityInterface (fields = ['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' ]),
158+ niu .IdentityInterface (
159+ fields = ['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' , 'flip_info' ]
160+ ),
157161 name = 'outputnode' ,
158162 )
159163
@@ -187,6 +191,7 @@ def init_bold_reg_wf(
187191 ('outputnode.itk_bold_to_t1' , 'itk_bold_to_t1' ),
188192 ('outputnode.itk_t1_to_bold' , 'itk_t1_to_bold' ),
189193 ('outputnode.fallback' , 'fallback' ),
194+ ('outputnode.flip_info' , 'flip_info' ),
190195 ]),
191196 ]) # fmt:skip
192197
@@ -267,6 +272,8 @@ def init_bbreg_wf(
267272 Affine transform from T1 space to BOLD space (ITK format)
268273 fallback
269274 Boolean indicating whether BBR was rejected (mri_coreg registration returned)
275+ flip_info
276+ Information regarding whether a left-right flip was detected
270277
271278 """
272279 from nipype .interfaces .freesurfer import BBRegister
@@ -275,6 +282,7 @@ def init_bbreg_wf(
275282 from niworkflows .interfaces .nitransforms import ConcatenateXFMs
276283
277284 from fmriprep .interfaces .patches import FreeSurferSource , MRICoreg
285+ from fmriprep .interfaces .reports import CheckFlip
278286
279287 workflow = Workflow (name = name )
280288 workflow .__desc__ = """\
@@ -309,7 +317,7 @@ def init_bbreg_wf(
309317 name = 'inputnode' ,
310318 )
311319 outputnode = pe .Node (
312- niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' ]),
320+ niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' , 'flip_info' ]),
313321 name = 'outputnode' ,
314322 )
315323
@@ -358,6 +366,9 @@ def init_bbreg_wf(
358366 name = 'bbregister' ,
359367 mem_gb = 12 ,
360368 )
369+
370+ check_flip = pe .Node (CheckFlip (), name = 'check_flip' )
371+
361372 transforms = pe .Node (niu .Merge (2 ), run_without_submitting = True , name = 'transforms' )
362373 # In cases where Merge(2) only has `in1` or `in2` defined
363374 # output list will just contain a single element
@@ -411,7 +422,10 @@ def init_bbreg_wf(
411422 ('subject_id' , 'subject_id' )]),
412423 (inputnode , lr_flip ), [('in_file' , 'in_file' )],
413424 (lr_flip , bbregister_flipped ), [('out_file' , 'source_file' )],
425+ (bbregister , check_flip ), [('min_cost_file' , 'cost_original' )],
426+ (bbregister_flipped , check_flip ), [('min_cost_file' , 'cost_flipped' )],
414427 (bbregister , transforms , [('out_lta_file' , 'in1' )]),
428+ (check_flip , outputnode , [('flip_info' , 'flip_info' )]),
415429 ]) # fmt:skip
416430
417431 # Short-circuit workflow building, use boundary-based registration
0 commit comments