@@ -342,7 +342,7 @@ def init_ds_mask_wf(
342
342
Inputs
343
343
------
344
344
source_files
345
- List of input T1w images
345
+ List of input anat images
346
346
mask_file
347
347
Mask to save
348
348
@@ -370,7 +370,7 @@ def init_ds_mask_wf(
370
370
suffix = 'mask' ,
371
371
compress = True ,
372
372
),
373
- name = 'ds_t1w_mask ' ,
373
+ name = 'ds_anat_mask ' ,
374
374
run_without_submitting = True ,
375
375
)
376
376
if mask_type == 'brain' :
@@ -391,7 +391,7 @@ def init_ds_mask_wf(
391
391
return workflow
392
392
393
393
394
- def init_ds_dseg_wf (* , output_dir , name = 'ds_dseg_wf' ):
394
+ def init_ds_dseg_wf (* , output_dir : str , name : str = 'ds_dseg_wf' ):
395
395
"""
396
396
Save discrete segmentations
397
397
@@ -405,23 +405,23 @@ def init_ds_dseg_wf(*, output_dir, name='ds_dseg_wf'):
405
405
Inputs
406
406
------
407
407
source_files
408
- List of input T1w images
409
- t1w_dseg
410
- Segmentation in T1w space
408
+ List of input anatomical images
409
+ anat_dseg
410
+ Segmentation in anatomical space
411
411
412
412
Outputs
413
413
-------
414
- t1w_dseg
414
+ anat_dseg
415
415
The location in the output directory of the discrete segmentation
416
416
417
417
"""
418
418
workflow = Workflow (name = name )
419
419
420
420
inputnode = pe .Node (
421
- niu .IdentityInterface (fields = ['source_files' , 't1w_dseg ' ]),
421
+ niu .IdentityInterface (fields = ['source_files' , 'anat_dseg ' ]),
422
422
name = 'inputnode' ,
423
423
)
424
- outputnode = pe .Node (niu .IdentityInterface (fields = ['t1w_dseg ' ]), name = 'outputnode' )
424
+ outputnode = pe .Node (niu .IdentityInterface (fields = ['anat_dseg ' ]), name = 'outputnode' )
425
425
426
426
ds_t1w_dseg = pe .Node (
427
427
DerivativesDataSink (
@@ -430,22 +430,27 @@ def init_ds_dseg_wf(*, output_dir, name='ds_dseg_wf'):
430
430
compress = True ,
431
431
dismiss_entities = ['desc' ],
432
432
),
433
- name = 'ds_t1w_dseg ' ,
433
+ name = 'ds_anat_dseg ' ,
434
434
run_without_submitting = True ,
435
435
)
436
436
437
437
# fmt:off
438
438
workflow .connect ([
439
- (inputnode , ds_t1w_dseg , [('t1w_dseg ' , 'in_file' ),
439
+ (inputnode , ds_t1w_dseg , [('anat_dseg ' , 'in_file' ),
440
440
('source_files' , 'source_file' )]),
441
- (ds_t1w_dseg , outputnode , [('out_file' , 't1w_dseg ' )]),
441
+ (ds_t1w_dseg , outputnode , [('out_file' , 'anat_dseg ' )]),
442
442
])
443
443
# fmt:on
444
444
445
445
return workflow
446
446
447
447
448
- def init_ds_tpms_wf (* , output_dir , name = 'ds_tpms_wf' , tpm_labels = BIDS_TISSUE_ORDER ):
448
+ def init_ds_tpms_wf (
449
+ * ,
450
+ output_dir : str ,
451
+ name : str = 'ds_tpms_wf' ,
452
+ tpm_labels : tuple = BIDS_TISSUE_ORDER ,
453
+ ):
449
454
"""
450
455
Save tissue probability maps
451
456
@@ -461,23 +466,23 @@ def init_ds_tpms_wf(*, output_dir, name='ds_tpms_wf', tpm_labels=BIDS_TISSUE_ORD
461
466
Inputs
462
467
------
463
468
source_files
464
- List of input T1w images
465
- t1w_tpms
466
- Tissue probability maps in T1w space
469
+ List of input anatomical images
470
+ anat_tpms
471
+ Tissue probability maps in anatomical space
467
472
468
473
Outputs
469
474
-------
470
- t1w_tpms
475
+ anat_tpms
471
476
The location in the output directory of the tissue probability maps
472
477
473
478
"""
474
479
workflow = Workflow (name = name )
475
480
476
481
inputnode = pe .Node (
477
- niu .IdentityInterface (fields = ['source_files' , 't1w_tpms ' ]),
482
+ niu .IdentityInterface (fields = ['source_files' , 'anat_tpms ' ]),
478
483
name = 'inputnode' ,
479
484
)
480
- outputnode = pe .Node (niu .IdentityInterface (fields = ['t1w_tpms ' ]), name = 'outputnode' )
485
+ outputnode = pe .Node (niu .IdentityInterface (fields = ['anat_tpms ' ]), name = 'outputnode' )
481
486
482
487
ds_t1w_tpms = pe .Node (
483
488
DerivativesDataSink (
@@ -486,16 +491,16 @@ def init_ds_tpms_wf(*, output_dir, name='ds_tpms_wf', tpm_labels=BIDS_TISSUE_ORD
486
491
compress = True ,
487
492
dismiss_entities = ['desc' ],
488
493
),
489
- name = 'ds_t1w_tpms ' ,
494
+ name = 'ds_anat_tpms ' ,
490
495
run_without_submitting = True ,
491
496
)
492
497
ds_t1w_tpms .inputs .label = tpm_labels
493
498
494
499
# fmt:off
495
500
workflow .connect ([
496
- (inputnode , ds_t1w_tpms , [('t1w_tpms ' , 'in_file' ),
501
+ (inputnode , ds_t1w_tpms , [('anat_tpms ' , 'in_file' ),
497
502
('source_files' , 'source_file' )]),
498
- (ds_t1w_tpms , outputnode , [('out_file' , 't1w_tpms ' )]),
503
+ (ds_t1w_tpms , outputnode , [('out_file' , 'anat_tpms ' )]),
499
504
])
500
505
# fmt:on
501
506
@@ -504,8 +509,9 @@ def init_ds_tpms_wf(*, output_dir, name='ds_tpms_wf', tpm_labels=BIDS_TISSUE_ORD
504
509
505
510
def init_ds_template_registration_wf (
506
511
* ,
507
- output_dir ,
508
- name = 'ds_template_registration_wf' ,
512
+ output_dir : str ,
513
+ image_type : ty .Literal ['T1w' , 'T2w' ] = 'T1w' ,
514
+ name : str = 'ds_template_registration_wf' ,
509
515
):
510
516
"""
511
517
Save template registration transforms
@@ -514,6 +520,8 @@ def init_ds_template_registration_wf(
514
520
----------
515
521
output_dir : :obj:`str`
516
522
Directory in which to save derivatives
523
+ image_type : :obj:`str`
524
+ Anatomical image type (T1w, T2w, etc)
517
525
name : :obj:`str`
518
526
Workflow name (default: anat_derivatives_wf)
519
527
@@ -522,7 +530,7 @@ def init_ds_template_registration_wf(
522
530
template
523
531
Template space and specifications
524
532
source_files
525
- List of input T1w images
533
+ List of input anatomical images
526
534
anat2std_xfm
527
535
Nonlinear spatial transform to resample imaging data given in anatomical space
528
536
into standard space.
@@ -541,44 +549,44 @@ def init_ds_template_registration_wf(
541
549
name = 'outputnode' ,
542
550
)
543
551
544
- ds_std2t1w_xfm = pe .MapNode (
552
+ ds_std2anat_xfm = pe .MapNode (
545
553
DerivativesDataSink (
546
554
base_directory = output_dir ,
547
- to = 'T1w' ,
555
+ to = image_type ,
548
556
mode = 'image' ,
549
557
suffix = 'xfm' ,
550
558
dismiss_entities = ['desc' ],
551
559
),
552
560
iterfield = ('in_file' , 'from' ),
553
- name = 'ds_std2t1w_xfm ' ,
561
+ name = 'ds_std2anat_xfm ' ,
554
562
run_without_submitting = True ,
555
563
)
556
564
557
- ds_t1w2std_xfm = pe .MapNode (
565
+ ds_anat2std_xfm = pe .MapNode (
558
566
DerivativesDataSink (
559
567
base_directory = output_dir ,
560
568
mode = 'image' ,
561
569
suffix = 'xfm' ,
562
570
dismiss_entities = ['desc' ],
563
- ** {'from' : 'T1w' },
571
+ ** {'from' : image_type },
564
572
),
565
573
iterfield = ('in_file' , 'to' ),
566
- name = 'ds_t1w2std_xfm ' ,
574
+ name = 'ds_anat2std_xfm ' ,
567
575
run_without_submitting = True ,
568
576
)
569
577
570
578
# fmt:off
571
579
workflow .connect ([
572
- (inputnode , ds_t1w2std_xfm , [
580
+ (inputnode , ds_anat2std_xfm , [
573
581
('anat2std_xfm' , 'in_file' ),
574
582
(('template' , _combine_cohort ), 'to' ),
575
583
('source_files' , 'source_file' )]),
576
- (inputnode , ds_std2t1w_xfm , [
584
+ (inputnode , ds_std2anat_xfm , [
577
585
('std2anat_xfm' , 'in_file' ),
578
586
(('template' , _combine_cohort ), 'from' ),
579
587
('source_files' , 'source_file' )]),
580
- (ds_t1w2std_xfm , outputnode , [('out_file' , 'anat2std_xfm' )]),
581
- (ds_std2t1w_xfm , outputnode , [('out_file' , 'std2anat_xfm' )]),
588
+ (ds_anat2std_xfm , outputnode , [('out_file' , 'anat2std_xfm' )]),
589
+ (ds_std2anat_xfm , outputnode , [('out_file' , 'std2anat_xfm' )]),
582
590
])
583
591
# fmt:on
584
592
@@ -587,8 +595,8 @@ def init_ds_template_registration_wf(
587
595
588
596
def init_ds_fs_registration_wf (
589
597
* ,
590
- output_dir ,
591
- name = 'ds_fs_registration_wf' ,
598
+ output_dir : str ,
599
+ name : str = 'ds_fs_registration_wf' ,
592
600
):
593
601
"""
594
602
Save rigid registration between subject anatomical template and FreeSurfer T1.mgz
0 commit comments