@@ -345,7 +345,6 @@ def init_concat_registrations_wf(
345
345
further use in downstream nodes.
346
346
347
347
"""
348
- from nibabies .interfaces .download import RetrievePoochFiles
349
348
from nibabies .interfaces .patches import CompositeTransformUtil
350
349
351
350
ntpls = len (templates )
@@ -405,9 +404,9 @@ def init_concat_registrations_wf(
405
404
]
406
405
outputnode = pe .Node (niu .IdentityInterface (fields = out_fields ), name = 'outputnode' )
407
406
408
- intermed_xfms = pe .MapNode (
409
- RetrievePoochFiles ( ),
410
- name = 'retrieve_xfms ' ,
407
+ fetch_tf_xfms = pe .MapNode (
408
+ niu . Function ( function = _get_intermediate_xfms , output_names = [ 'int2tgt_xfm' , 'tgt2int_xfm' ] ),
409
+ name = 'fetch_tf_xfms ' ,
411
410
iterfield = ['target' ],
412
411
run_without_submitting = True ,
413
412
)
@@ -460,10 +459,10 @@ def init_concat_registrations_wf(
460
459
# Transform concatenation
461
460
(inputnode , dis_anat2int , [('anat2int_xfm' , 'in_file' )]),
462
461
(inputnode , dis_int2anat , [('int2anat_xfm' , 'in_file' )]),
463
- (inputnode , intermed_xfms , [('intermediate' , 'intermediate' ),
462
+ (inputnode , fetch_tf_xfms , [('intermediate' , 'intermediate' ),
464
463
('template' , 'target' )]),
465
- (intermed_xfms , dis_int2std , [('int2tgt_xfm' , 'in_file' )]),
466
- (intermed_xfms , dis_std2int , [('tgt2int_xfm' , 'in_file' )]),
464
+ (fetch_tf_xfms , dis_int2std , [('int2tgt_xfm' , 'in_file' )]),
465
+ (fetch_tf_xfms , dis_std2int , [('tgt2int_xfm' , 'in_file' )]),
467
466
(dis_anat2int , order_anat2std , [
468
467
('affine_transform' , 'in1' ),
469
468
('displacement_field' , 'in2' ),
@@ -499,3 +498,28 @@ def init_concat_registrations_wf(
499
498
]) # fmt:skip
500
499
501
500
return workflow
501
+
502
+
503
+ def _get_intermediate_xfms (intermediate , target ):
504
+ import templateflow .api as tf
505
+
506
+ # Native -> MNIInfant:cohort-X (int) -> Target (std)
507
+ ispace , _ , icohort = intermediate .partition (':cohort-' )
508
+ ispaceid = f'{ ispace } +{ icohort } ' if icohort else ispace
509
+
510
+ int2std = tf .get (
511
+ target ,
512
+ suffix = 'xfm' ,
513
+ ** {'from' : ispaceid },
514
+ raise_empty = True ,
515
+ )
516
+
517
+ std2int = tf .get (
518
+ ispace ,
519
+ cohort = icohort or None ,
520
+ suffix = 'xfm' ,
521
+ ** {'from' : target },
522
+ raise_empty = True ,
523
+ )
524
+
525
+ return int2std , std2int
0 commit comments