@@ -345,7 +345,6 @@ def init_concat_registrations_wf(
345345 further use in downstream nodes.
346346
347347 """
348- from nibabies .interfaces .download import RetrievePoochFiles
349348 from nibabies .interfaces .patches import CompositeTransformUtil
350349
351350 ntpls = len (templates )
@@ -405,9 +404,9 @@ def init_concat_registrations_wf(
405404 ]
406405 outputnode = pe .Node (niu .IdentityInterface (fields = out_fields ), name = 'outputnode' )
407406
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 ' ,
411410 iterfield = ['target' ],
412411 run_without_submitting = True ,
413412 )
@@ -460,10 +459,10 @@ def init_concat_registrations_wf(
460459 # Transform concatenation
461460 (inputnode , dis_anat2int , [('anat2int_xfm' , 'in_file' )]),
462461 (inputnode , dis_int2anat , [('int2anat_xfm' , 'in_file' )]),
463- (inputnode , intermed_xfms , [('intermediate' , 'intermediate' ),
462+ (inputnode , fetch_tf_xfms , [('intermediate' , 'intermediate' ),
464463 ('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' )]),
467466 (dis_anat2int , order_anat2std , [
468467 ('affine_transform' , 'in1' ),
469468 ('displacement_field' , 'in2' ),
@@ -499,3 +498,28 @@ def init_concat_registrations_wf(
499498 ]) # fmt:skip
500499
501500 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