@@ -1322,13 +1322,16 @@ def init_anat_ribbon_wf(name='anat_ribbon_wf'):
1322
1322
1323
1323
def init_resample_surfaces_wf (
1324
1324
surfaces : list [str ],
1325
+ template : str = 'fsLR' ,
1326
+ cohort : str | None = None ,
1327
+ space : str | None = 'fsLR' ,
1325
1328
density : str | None = None ,
1326
1329
grayord_density : str | None = None ,
1327
- space : str = 'fsLR' ,
1328
1330
name : str = 'resample_surfaces_wf' ,
1329
1331
):
1330
1332
"""
1331
- Resample subject surfaces surface to specified space and density.
1333
+ Resample subject surfaces surface to specified template space and density,
1334
+ using a given registration space.
1332
1335
1333
1336
Workflow Graph
1334
1337
.. workflow::
@@ -1338,16 +1341,22 @@ def init_resample_surfaces_wf(
1338
1341
from smriprep.workflows.surfaces import init_resample_surfaces_wf
1339
1342
wf = init_resample_surfaces_wf(
1340
1343
surfaces=['white', 'pial', 'midthickness'],
1341
- space ='onavg',
1344
+ template ='onavg',
1342
1345
density='10k',
1343
1346
)
1344
1347
1345
1348
Parameters
1346
1349
----------
1347
1350
surfaces : :class:`list` of :class:`str`
1348
1351
Names of surfaces (e.g., ``'white'``) to resample. Both hemispheres will be resampled.
1349
- space : :class:`str`
1350
- The space to resample to, e.g., ``'onavg'``, ``'fsLR'``.
1352
+ template : :class:`str`
1353
+ The template space to resample to, e.g., ``'onavg'``, ``'fsLR'``.
1354
+ cohort : :class:`str` or :obj:`None`
1355
+ The template cohort to use, if the template provides multiple.
1356
+ space : :class:`str` or :obj:`None`
1357
+ The registration space for which there are both subject and template
1358
+ registration spheres.
1359
+ If ``None``, the template space is used.
1351
1360
density : :class:`str`
1352
1361
The density to resample to, e.g., ``'10k'``, ``'41k'``. Number of vertices per hemisphere.
1353
1362
name : :class:`str`
@@ -1357,12 +1366,12 @@ def init_resample_surfaces_wf(
1357
1366
------
1358
1367
``<surface>``
1359
1368
Left and right GIFTIs for each surface name passed to ``surfaces``.
1360
- sphere_reg_fsLR
1361
- GIFTI surface mesh corresponding to the subject's fsLR registration sphere.
1369
+ ``sphere_reg_<space>``
1370
+ GIFTI surface mesh corresponding to the subject's registration sphere to ``space`` .
1362
1371
1363
1372
Outputs
1364
1373
-------
1365
- ``<surface>``
1374
+ ``<surface>_<template> ``
1366
1375
Left and right GIFTI surface mesh corresponding to the input surface, resampled to the
1367
1376
specified space and density.
1368
1377
"""
@@ -1383,12 +1392,13 @@ def init_resample_surfaces_wf(
1383
1392
workflow = Workflow (name = name )
1384
1393
1385
1394
inputnode = pe .Node (
1386
- niu .IdentityInterface (fields = [* surfaces , 'sphere_reg_fsLR ' ]),
1395
+ niu .IdentityInterface (fields = [* surfaces , f'sphere_reg_ { space } ' ]),
1387
1396
name = 'inputnode' ,
1388
1397
)
1389
1398
1390
1399
outputnode = pe .Node (
1391
- niu .IdentityInterface (fields = [f'{ surf } _{ space } ' for surf in surfaces ]), name = 'outputnode'
1400
+ niu .IdentityInterface (fields = [f'{ surf } _{ template } ' for surf in surfaces ]),
1401
+ name = 'outputnode' ,
1392
1402
)
1393
1403
1394
1404
surface_list = pe .Node (
@@ -1405,11 +1415,12 @@ def init_resample_surfaces_wf(
1405
1415
resampler .inputs .new_sphere = [
1406
1416
str (
1407
1417
tf .get (
1408
- template = space ,
1418
+ template = template ,
1419
+ cohort = cohort ,
1420
+ space = space if space != template else None ,
1421
+ hemi = hemi ,
1409
1422
density = density ,
1410
1423
suffix = 'sphere' ,
1411
- hemi = hemi ,
1412
- space = (None if space == 'fsLR' else 'fsLR' ),
1413
1424
extension = '.surf.gii' ,
1414
1425
)
1415
1426
)
@@ -1430,12 +1441,12 @@ def init_resample_surfaces_wf(
1430
1441
for i , surf in enumerate (surfaces , start = 1 )
1431
1442
]),
1432
1443
(inputnode , resampler , [
1433
- (('sphere_reg_fsLR ' , _repeat , len (surfaces )), 'current_sphere' ),
1444
+ ((f'sphere_reg_ { space } ' , _repeat , len (surfaces )), 'current_sphere' ),
1434
1445
]),
1435
1446
(surface_list , resampler , [('out' , 'surface_in' )]),
1436
1447
(resampler , surface_groups , [('surface_out' , 'inlist' )]),
1437
1448
(surface_groups , outputnode , [
1438
- (f'out{ i } ' , f'{ surf } _{ space } ' ) for i , surf in enumerate (surfaces , start = 1 )
1449
+ (f'out{ i } ' , f'{ surf } _{ template } ' ) for i , surf in enumerate (surfaces , start = 1 )
1439
1450
]),
1440
1451
]) # fmt:skip
1441
1452
0 commit comments