@@ -423,7 +423,7 @@ def init_ds_dseg_wf(*, output_dir: str, name: str = 'ds_dseg_wf'):
423
423
)
424
424
outputnode = pe .Node (niu .IdentityInterface (fields = ['anat_dseg' ]), name = 'outputnode' )
425
425
426
- ds_t1w_dseg = pe .Node (
426
+ ds_anat_dseg = pe .Node (
427
427
DerivativesDataSink (
428
428
base_directory = output_dir ,
429
429
suffix = 'dseg' ,
@@ -436,9 +436,9 @@ def init_ds_dseg_wf(*, output_dir: str, name: str = 'ds_dseg_wf'):
436
436
437
437
# fmt:off
438
438
workflow .connect ([
439
- (inputnode , ds_t1w_dseg , [('anat_dseg' , 'in_file' ),
439
+ (inputnode , ds_anat_dseg , [('anat_dseg' , 'in_file' ),
440
440
('source_files' , 'source_file' )]),
441
- (ds_t1w_dseg , outputnode , [('out_file' , 'anat_dseg' )]),
441
+ (ds_anat_dseg , outputnode , [('out_file' , 'anat_dseg' )]),
442
442
])
443
443
# fmt:on
444
444
@@ -484,7 +484,7 @@ def init_ds_tpms_wf(
484
484
)
485
485
outputnode = pe .Node (niu .IdentityInterface (fields = ['anat_tpms' ]), name = 'outputnode' )
486
486
487
- ds_t1w_tpms = pe .Node (
487
+ ds_anat_tpms = pe .Node (
488
488
DerivativesDataSink (
489
489
base_directory = output_dir ,
490
490
suffix = 'probseg' ,
@@ -494,13 +494,13 @@ def init_ds_tpms_wf(
494
494
name = 'ds_anat_tpms' ,
495
495
run_without_submitting = True ,
496
496
)
497
- ds_t1w_tpms .inputs .label = tpm_labels
497
+ ds_anat_tpms .inputs .label = tpm_labels
498
498
499
499
# fmt:off
500
500
workflow .connect ([
501
- (inputnode , ds_t1w_tpms , [('anat_tpms' , 'in_file' ),
501
+ (inputnode , ds_anat_tpms , [('anat_tpms' , 'in_file' ),
502
502
('source_files' , 'source_file' )]),
503
- (ds_t1w_tpms , outputnode , [('out_file' , 'anat_tpms' )]),
503
+ (ds_anat_tpms , outputnode , [('out_file' , 'anat_tpms' )]),
504
504
])
505
505
# fmt:on
506
506
@@ -596,10 +596,12 @@ def init_ds_template_registration_wf(
596
596
def init_ds_fs_registration_wf (
597
597
* ,
598
598
output_dir : str ,
599
+ image_type : ty .Literal ['T1w' , 'T2w' ] = 'T1w' ,
599
600
name : str = 'ds_fs_registration_wf' ,
600
601
):
601
602
"""
602
- Save rigid registration between subject anatomical template and FreeSurfer T1.mgz
603
+ Save rigid registration between subject anatomical template and either
604
+ FreeSurfer T1.mgz or T2.mgz
603
605
604
606
Parameters
605
607
----------
@@ -611,70 +613,70 @@ def init_ds_fs_registration_wf(
611
613
Inputs
612
614
------
613
615
source_files
614
- List of input T1w images
615
- fsnative2t1w_xfm
616
+ List of input anatomical images
617
+ fsnative2anat_xfm
616
618
LTA-style affine matrix translating from FreeSurfer-conformed
617
- subject space to T1w
619
+ subject space to T1/T2
618
620
619
621
Outputs
620
622
-------
621
- t1w2fsnative_xfm
622
- LTA-style affine matrix translating from T1w to
623
+ anat2fsnative_xfm
624
+ LTA-style affine matrix translating from T1/T2 to
623
625
FreeSurfer-conformed subject space
624
- fsnative2t1w_xfm
626
+ fsnative2anat_xfm
625
627
LTA-style affine matrix translating from FreeSurfer-conformed
626
628
subject space to T1w
627
629
628
630
"""
629
631
workflow = Workflow (name = name )
630
632
631
633
inputnode = pe .Node (
632
- niu .IdentityInterface (fields = ['source_files' , 'fsnative2t1w_xfm ' ]),
634
+ niu .IdentityInterface (fields = ['source_files' , 'fsnative2anat_xfm ' ]),
633
635
name = 'inputnode' ,
634
636
)
635
637
outputnode = pe .Node (
636
- niu .IdentityInterface (fields = ['fsnative2t1w_xfm ' , 't1w2fsnative_xfm ' ]),
638
+ niu .IdentityInterface (fields = ['fsnative2anat_xfm ' , 'anat2fsnative_xfm ' ]),
637
639
name = 'outputnode' ,
638
640
)
639
641
640
642
from niworkflows .interfaces .nitransforms import ConcatenateXFMs
641
643
642
644
# FS native space transforms
643
645
lta2itk = pe .Node (ConcatenateXFMs (inverse = True ), name = 'lta2itk' , run_without_submitting = True )
644
- ds_t1w_fsnative = pe .Node (
646
+ ds_anat_fsnative = pe .Node (
645
647
DerivativesDataSink (
646
648
base_directory = output_dir ,
647
649
mode = 'image' ,
648
650
to = 'fsnative' ,
649
651
suffix = 'xfm' ,
650
652
extension = 'txt' ,
651
- ** {'from' : 'T1w' },
653
+ ** {'from' : image_type },
652
654
),
653
- name = 'ds_t1w_fsnative ' ,
655
+ name = 'ds_anat_fsnative ' ,
654
656
run_without_submitting = True ,
655
657
)
656
- ds_fsnative_t1w = pe .Node (
658
+ ds_fsnative_anat = pe .Node (
657
659
DerivativesDataSink (
658
660
base_directory = output_dir ,
659
661
mode = 'image' ,
660
- to = 'T1w' ,
662
+ to = image_type ,
661
663
suffix = 'xfm' ,
662
664
extension = 'txt' ,
663
665
** {'from' : 'fsnative' },
664
666
),
665
- name = 'ds_fsnative_t1w ' ,
667
+ name = 'ds_fsnative_anat ' ,
666
668
run_without_submitting = True ,
667
669
)
668
670
669
671
# fmt:off
670
672
workflow .connect ([
671
- (inputnode , lta2itk , [('fsnative2t1w_xfm ' , 'in_xfms' )]),
672
- (inputnode , ds_t1w_fsnative , [('source_files' , 'source_file' )]),
673
- (lta2itk , ds_t1w_fsnative , [('out_inv' , 'in_file' )]),
674
- (inputnode , ds_fsnative_t1w , [('source_files' , 'source_file' )]),
675
- (lta2itk , ds_fsnative_t1w , [('out_xfm' , 'in_file' )]),
676
- (ds_fsnative_t1w , outputnode , [('out_file' , 'fsnative2t1w_xfm ' )]),
677
- (ds_t1w_fsnative , outputnode , [('out_file' , 't1w2fsnative_xfm ' )]),
673
+ (inputnode , lta2itk , [('fsnative2anat_xfm ' , 'in_xfms' )]),
674
+ (inputnode , ds_anat_fsnative , [('source_files' , 'source_file' )]),
675
+ (lta2itk , ds_anat_fsnative , [('out_inv' , 'in_file' )]),
676
+ (inputnode , ds_fsnative_anat , [('source_files' , 'source_file' )]),
677
+ (lta2itk , ds_fsnative_anat , [('out_xfm' , 'in_file' )]),
678
+ (ds_fsnative_anat , outputnode , [('out_file' , 'fsnative2anat_xfm ' )]),
679
+ (ds_anat_fsnative , outputnode , [('out_file' , 'anat2fsnative_xfm ' )]),
678
680
])
679
681
# fmt:on
680
682
return workflow
@@ -704,7 +706,7 @@ def init_ds_surfaces_wf(
704
706
Inputs
705
707
------
706
708
source_files
707
- List of input T1w images
709
+ List of input anatomical images
708
710
``<surface>``
709
711
Left and right GIFTIs for each surface passed to ``surfaces``
710
712
0 commit comments