@@ -1469,7 +1469,7 @@ def init_resample_surfaces_wf(
1469
1469
``<surface>``
1470
1470
Left and right GIFTI surface mesh corresponding to the input surface, resampled to fsLR
1471
1471
"""
1472
- import templateflow .api as tf
1472
+ # import templateflow.api as tf
1473
1473
from niworkflows .engine .workflows import LiterateWorkflow as Workflow
1474
1474
1475
1475
workflow = Workflow (name = name )
@@ -1485,51 +1485,21 @@ def init_resample_surfaces_wf(
1485
1485
niu .IdentityInterface (fields = [f'{ surf } _fsLR' for surf in surfaces ]), name = 'outputnode'
1486
1486
)
1487
1487
1488
- surface_list = pe .Node (
1489
- niu .Merge (len (surfaces ), ravel_inputs = True ),
1490
- name = 'surface_list' ,
1491
- run_without_submitting = True ,
1492
- )
1493
-
1494
- resampler = pe .MapNode (
1495
- SurfaceResample (method = 'BARYCENTRIC' ),
1496
- iterfield = ['surface_in' , 'current_sphere' , 'new_sphere' ],
1497
- name = 'resampler' ,
1488
+ resample_surfaces_wb_wf = init_resample_surfaces_wb_wf (
1489
+ surfaces = surfaces ,
1490
+ space = 'fsLR' ,
1491
+ density = fslr_density ,
1492
+ name = 'resample_surfaces_fslr_wb_wf' ,
1498
1493
)
1499
- resampler .inputs .new_sphere = [
1500
- str (
1501
- tf .get (
1502
- template = 'fsLR' ,
1503
- density = fslr_density ,
1504
- suffix = 'sphere' ,
1505
- hemi = hemi ,
1506
- space = None ,
1507
- extension = '.surf.gii' ,
1508
- )
1509
- )
1510
- # Order matters. Iterate over surfaces, then hemis to get L R L R L R
1511
- for _surf in surfaces
1512
- for hemi in ['L' , 'R' ]
1513
- ]
1514
-
1515
- surface_groups = pe .Node (
1516
- niu .Split (splits = [2 ] * len (surfaces )),
1517
- name = 'surface_groups' ,
1518
- run_without_submitting = True ,
1519
- )
1520
-
1521
1494
workflow .connect ([
1522
- (inputnode , surface_list , [
1523
- ((surf , _sorted_by_basename ), f'in{ i } ' )
1524
- for i , surf in enumerate (surfaces , start = 1 )
1495
+ (inputnode , resample_surfaces_wb_wf , [
1496
+ (surf , 'inputnode.' + surf ) for surf in surfaces
1525
1497
]),
1526
- (inputnode , resampler , [
1527
- (( 'sphere_reg_fsLR' , _repeat , len ( surfaces )), 'current_sphere ' ),
1498
+ (inputnode , resample_surfaces_wb_wf , [
1499
+ ('sphere_reg_fsLR' , 'inputnode.sphere_reg_fsLR ' ),
1528
1500
]),
1529
- (surface_list , resampler , [('out' , 'surface_in' )]),
1530
- (resampler , surface_groups , [('surface_out' , 'inlist' )]),
1531
- (surface_groups , outputnode , [
1532
- (f'out{ i } ' , f'{ surf } _fsLR' ) for i , surf in enumerate (surfaces , start = 1 )
1501
+ (resample_surfaces_wb_wf , outputnode , [
1502
+ (f'outputnode.{ surf } _resampled' , f'{ surf } _fsLR' ) for surf in surfaces
1533
1503
]),
1534
1504
]) # fmt:skip
1535
1505
0 commit comments