Skip to content

Commit

Permalink
fix: Restore init_resample_midthickness_wf for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 13, 2024
1 parent 7f2863a commit 81e4c65
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions src/smriprep/workflows/surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,13 +1316,55 @@ def init_anat_ribbon_wf(name='anat_ribbon_wf'):
return workflow


def init_resample_midthickness_wf(
grayord_density: ty.Literal['91k', '170k'],
name: str = 'resample_midthickness_wf',
):
"""
Resample subject midthickness surface to specified density.
Workflow Graph
.. workflow::
:graph2use: colored
:simple_form: yes
from smriprep.workflows.surfaces import init_resample_midthickness_wf
wf = init_resample_midthickness_wf(grayord_density='91k')
Parameters
----------
grayord_density : :class:`str`
Either `91k` or `170k`, representing the total of vertices or *grayordinates*.
name : :class:`str`
Unique name for the subworkflow (default: ``"resample_midthickness_wf"``)
Inputs
------
midthickness
Left and right GIFTIs for midthickness surface
sphere_reg_fsLR
GIFTI surface mesh corresponding to the subject's fsLR registration sphere
Outputs
-------
midthickness
Left and right GIFTI surface mesh corresponding to the midthickness surface,
resampled to fsLR
"""
return init_resample_surfaces_wf(
surfaces=['midthickness'],
grayord_density=grayord_density,
name=name,
)


def init_resample_surfaces_wf(
surfaces: list[str],
grayord_density: ty.Literal['91k', '170k'],
name: str = 'resample_surfaces_wf',
):
"""
Resample subject surfaces surface to specified density.
Resample subject surfaces to specified density.
Workflow Graph
.. workflow::
Expand Down Expand Up @@ -1353,7 +1395,7 @@ def init_resample_surfaces_wf(
Outputs
-------
``<surface>``
``<surface>_fsLR``
Left and right GIFTI surface mesh corresponding to the input surface, resampled to fsLR
"""
import templateflow.api as tf
Expand All @@ -1368,8 +1410,13 @@ def init_resample_surfaces_wf(
name='inputnode',
)

# XXX Retain `surface` output without fsLR to avoid breaking init_resample_midthickness_wf
# Remove "+ surfaces" once that's removed.
outputnode = pe.Node(
niu.IdentityInterface(fields=[f'{surf}_fsLR' for surf in surfaces]), name='outputnode'
niu.IdentityInterface(
fields=[f'{surf}_fsLR' for surf in surfaces] + surfaces,
),
name='outputnode',
)

surface_list = pe.Node(
Expand Down Expand Up @@ -1418,6 +1465,10 @@ def init_resample_surfaces_wf(
(surface_groups, outputnode, [
(f'out{i}', f'{surf}_fsLR') for i, surf in enumerate(surfaces, start=1)
]),
# XXX Retain `surface` output without fsLR to avoid breaking init_resample_midthickness_wf
(surface_groups, outputnode, [
(f'out{i}', surf) for i, surf in enumerate(surfaces, start=1)
]),
]) # fmt:skip

return workflow
Expand Down

0 comments on commit 81e4c65

Please sign in to comment.