@@ -345,6 +345,7 @@ def init_concat_registrations_wf(
345
345
further use in downstream nodes.
346
346
347
347
"""
348
+ from nibabies .interfaces .download import RetrievePoochFiles
348
349
from nibabies .interfaces .patches import CompositeTransformUtil
349
350
350
351
ntpls = len (templates )
@@ -405,11 +406,9 @@ def init_concat_registrations_wf(
405
406
outputnode = pe .Node (niu .IdentityInterface (fields = out_fields ), name = 'outputnode' )
406
407
407
408
intermed_xfms = pe .MapNode (
408
- niu .Function (
409
- function = _load_intermediate_xfms , output_names = ['int2std_xfm' , 'std2int_xfm' ]
410
- ),
411
- name = 'intermed_xfms' ,
412
- iterfield = ['std' ],
409
+ RetrievePoochFiles (),
410
+ name = 'retrieve_xfms' ,
411
+ iterfield = ['target' ],
413
412
run_without_submitting = True ,
414
413
)
415
414
@@ -464,10 +463,10 @@ def init_concat_registrations_wf(
464
463
# Transform concatenation
465
464
(inputnode , dis_anat2int , [('anat2int_xfm' , 'in_file' )]),
466
465
(inputnode , dis_int2anat , [('int2anat_xfm' , 'in_file' )]),
467
- (inputnode , intermed_xfms , [('intermediate' , 'intermediate' )]) ,
468
- ( inputnode , intermed_xfms , [ ('template' , 'std ' )]),
469
- (intermed_xfms , dis_int2std , [('int2std_xfm ' , 'in_file' )]),
470
- (intermed_xfms , dis_std2int , [('std2int_xfm ' , 'in_file' )]),
466
+ (inputnode , intermed_xfms , [('intermediate' , 'intermediate' ),
467
+ ('template' , 'target ' )]),
468
+ (intermed_xfms , dis_int2std , [('int2tgt_xfm ' , 'in_file' )]),
469
+ (intermed_xfms , dis_std2int , [('tgt2int_xfm ' , 'in_file' )]),
471
470
(dis_anat2int , order_anat2std , [
472
471
('affine_transform' , 'in1' ),
473
472
('displacement_field' , 'in2' ),
@@ -505,40 +504,6 @@ def init_concat_registrations_wf(
505
504
return workflow
506
505
507
506
508
- def _load_intermediate_xfms (intermediate , std ):
509
- """Fetch transforms from the OSF repository (https://osf.io/y763j/)."""
510
- import json
511
- from pathlib import Path
512
-
513
- import pooch
514
-
515
- from nibabies .data import load
516
-
517
- xfms = json .loads (load ('xfm_manifest.json' ).read_text ())
518
- # MNIInfant:cohort-1 -> MNIInfant+1
519
- intmed = intermediate .replace (':cohort-' , '+' )
520
-
521
- int2std_name = f'from-{ intmed } _to-{ std } _xfm.h5'
522
- int2std_meta = xfms [int2std_name ]
523
- int2std = pooch .retrieve (
524
- url = int2std_meta ['url' ],
525
- path = Path .cwd (),
526
- known_hash = int2std_meta ['hash' ],
527
- fname = int2std_name ,
528
- )
529
-
530
- std2int_name = f'from-{ std } _to-{ intmed } _xfm.h5'
531
- std2int_meta = xfms [std2int_name ]
532
- std2int = pooch .retrieve (
533
- url = std2int_meta ['url' ],
534
- path = Path .cwd (),
535
- known_hash = std2int_meta ['hash' ],
536
- fname = std2int_name ,
537
- )
538
-
539
- return int2std , std2int
540
-
541
-
542
507
def _create_inverse_composite (in_file , out_file = 'inverse_composite.h5' ):
543
508
"""
544
509
Build a composite transform with SimpleITK.
0 commit comments