@@ -128,6 +128,8 @@ def init_bold_reg_wf(
128
128
Affine transform from T1 space to BOLD space (ITK format)
129
129
fallback
130
130
Boolean indicating whether BBR was rejected (mri_coreg registration returned)
131
+ metadata
132
+ Output metadata from the registration workflow
131
133
132
134
See Also
133
135
--------
@@ -154,7 +156,7 @@ def init_bold_reg_wf(
154
156
)
155
157
156
158
outputnode = pe .Node (
157
- niu .IdentityInterface (fields = ['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' ]),
159
+ niu .IdentityInterface (fields = ['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' , 'metadata' ]),
158
160
name = 'outputnode' ,
159
161
)
160
162
@@ -188,6 +190,7 @@ def init_bold_reg_wf(
188
190
('outputnode.itk_bold_to_t1' , 'itk_bold_to_t1' ),
189
191
('outputnode.itk_t1_to_bold' , 'itk_t1_to_bold' ),
190
192
('outputnode.fallback' , 'fallback' ),
193
+ ('outputnode.metadata' , 'metadata' ),
191
194
]),
192
195
]) # fmt:skip
193
196
@@ -268,6 +271,8 @@ def init_bbreg_wf(
268
271
Affine transform from T1 space to BOLD space (ITK format)
269
272
fallback
270
273
Boolean indicating whether BBR was rejected (mri_coreg registration returned)
274
+ metadata
275
+ Output metadata from the registration workflow
271
276
272
277
"""
273
278
from nipype .interfaces .freesurfer import BBRegister
@@ -309,7 +314,7 @@ def init_bbreg_wf(
309
314
name = 'inputnode' ,
310
315
)
311
316
outputnode = pe .Node (
312
- niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' ]),
317
+ niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' , 'metadata' ]),
313
318
name = 'outputnode' ,
314
319
)
315
320
@@ -357,6 +362,9 @@ def init_bbreg_wf(
357
362
merge_ltas = pe .Node (niu .Merge (2 ), name = 'merge_ltas' , run_without_submitting = True )
358
363
concat_xfm = pe .Node (ConcatenateXFMs (inverse = True ), name = 'concat_xfm' )
359
364
365
+ metadata = pe .Node (niu .Merge (2 ), run_without_submitting = True , name = 'metadata' )
366
+ select_meta = pe .Node (niu .Select (index = 0 ), run_without_submitting = True , name = 'select_meta' )
367
+
360
368
workflow .connect ([
361
369
(inputnode , merge_ltas , [('fsnative2t1w_xfm' , 'in2' )]),
362
370
# Wire up the co-registration alternatives
@@ -365,10 +373,18 @@ def init_bbreg_wf(
365
373
(merge_ltas , concat_xfm , [('out' , 'in_xfms' )]),
366
374
(concat_xfm , outputnode , [('out_xfm' , 'itk_bold_to_t1' )]),
367
375
(concat_xfm , outputnode , [('out_inv' , 'itk_t1_to_bold' )]),
376
+ # Wire up the metadata alternatives
377
+ (metadata , select_meta , [('out' , 'inlist' )]),
378
+ (select_meta , outputnode , [('out' , 'metadata' )]),
368
379
]) # fmt:skip
369
380
370
381
# Do not initialize with header, use mri_coreg
371
382
if bold2anat_init != 'header' :
383
+ metadata .inputs .in2 = {
384
+ 'GeneratedBy' : [
385
+ {'Name' : 'mri_coreg' , 'Version' : mri_coreg .interface .version or '<unknown>' }
386
+ ]
387
+ }
372
388
workflow .connect ([
373
389
(inputnode , mri_coreg , [('subjects_dir' , 'subjects_dir' ),
374
390
('subject_id' , 'subject_id' ),
@@ -400,6 +416,12 @@ def init_bbreg_wf(
400
416
(bbregister , transforms , [('out_lta_file' , 'in1' )]),
401
417
]) # fmt:skip
402
418
419
+ metadata .inputs .in1 = {
420
+ 'GeneratedBy' : [
421
+ {'Name' : 'bbregister' , 'Version' : bbregister .interface .version or '<unknown>' }
422
+ ]
423
+ }
424
+
403
425
# Short-circuit workflow building, use boundary-based registration
404
426
if use_bbr is True :
405
427
outputnode .inputs .fallback = False
@@ -413,6 +435,7 @@ def init_bbreg_wf(
413
435
(transforms , compare_transforms , [('out' , 'lta_list' )]),
414
436
(compare_transforms , outputnode , [('out' , 'fallback' )]),
415
437
(compare_transforms , select_transform , [('out' , 'index' )]),
438
+ (compare_transforms , select_meta , [('out' , 'index' )]),
416
439
]) # fmt:skip
417
440
418
441
return workflow
@@ -493,6 +516,8 @@ def init_fsl_bbr_wf(
493
516
Affine transform from T1 space to BOLD space (ITK format)
494
517
fallback
495
518
Boolean indicating whether BBR was rejected (rigid FLIRT registration returned)
519
+ metadata
520
+ Output metadata from the registration workflow
496
521
497
522
"""
498
523
from nipype .interfaces .freesurfer import MRICoreg
@@ -532,7 +557,7 @@ def init_fsl_bbr_wf(
532
557
name = 'inputnode' ,
533
558
)
534
559
outputnode = pe .Node (
535
- niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' ]),
560
+ niu .IdentityInterface (['itk_bold_to_t1' , 'itk_t1_to_bold' , 'fallback' , 'metadata' ]),
536
561
name = 'outputnode' ,
537
562
)
538
563
@@ -549,6 +574,9 @@ def init_fsl_bbr_wf(
549
574
'T2w intermediate for FSL is not implemented, registering with T1w instead.'
550
575
)
551
576
577
+ metadata = pe .Node (niu .Merge (2 ), run_without_submitting = True , name = 'metadata' )
578
+ select_meta = pe .Node (niu .Select (index = 0 ), run_without_submitting = True , name = 'select_meta' )
579
+
552
580
# Mask T1w_preproc with T1w_mask to make T1w_brain
553
581
mask_t1w_brain = pe .Node (ApplyMask (), name = 'mask_t1w_brain' )
554
582
@@ -565,6 +593,12 @@ def init_fsl_bbr_wf(
565
593
mem_gb = DEFAULT_MEMORY_MIN_GB ,
566
594
)
567
595
596
+ metadata .inputs .in2 = {
597
+ 'GeneratedBy' : [
598
+ {'Name' : 'mri_coreg' , 'Version' : mri_coreg .interface .version or '<unknown>' }
599
+ ]
600
+ }
601
+
568
602
workflow .connect ([
569
603
(inputnode , mask_t1w_brain , [
570
604
('t1w_preproc' , 'in_file' ),
@@ -578,6 +612,9 @@ def init_fsl_bbr_wf(
578
612
('out_xfm' , 'itk_bold_to_t1' ),
579
613
('out_inv' , 'itk_t1_to_bold' ),
580
614
]),
615
+ # Wire up the metadata alternatives
616
+ (metadata , select_meta , [('out' , 'inlist' )]),
617
+ (select_meta , outputnode , [('out' , 'metadata' )]),
581
618
]) # fmt:skip
582
619
583
620
# Short-circuit workflow building, use rigid registration
@@ -604,6 +641,10 @@ def init_fsl_bbr_wf(
604
641
LOGGER .warning ('FSLDIR unset - using packaged BBR schedule' )
605
642
flt_bbr .inputs .schedule = data .load ('flirtsch/bbr.sch' )
606
643
644
+ metadata .inputs .in1 = {
645
+ 'GeneratedBy' : [{'Name' : 'flirt' , 'Version' : flt_bbr .interface .version or '<unknown>' }]
646
+ }
647
+
607
648
workflow .connect ([
608
649
(inputnode , wm_mask , [('t1w_dseg' , 'in_seg' )]),
609
650
(inputnode , flt_bbr , [('in_file' , 'in_file' )]),
@@ -658,6 +699,8 @@ def init_fsl_bbr_wf(
658
699
(transforms , select_transform , [('out' , 'inlist' )]),
659
700
(compare_transforms , select_transform , [('out' , 'index' )]),
660
701
(select_transform , xfm2itk , [('out' , 'in_xfm' )]),
702
+ # Select metadata
703
+ (compare_transforms , select_meta , [('out' , 'index' )]),
661
704
]) # fmt:skip
662
705
663
706
return workflow
0 commit comments