Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Support flexible CIFTI combinations #3340

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,31 @@
cifti_output = workflow.cifti_output
if cifti_output:
# CIFTI grayordinates to corresponding FSL-MNI resolutions.
vol_res = '2' if cifti_output == '91k' else '1'
spaces.add(Reference('MNI152NLin6Asym', {'res': vol_res}))
res = '2' if cifti_output == '91k' else '1'
den = '32k' if cifti_output == '91k' else '59k'
spaces.add(Reference('fsLR', {'den': den, 'volspace': 'MNI152NLin6Asym', 'volres': res}))

Check warning on line 823 in fmriprep/config.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/config.py#L821-L823

Added lines #L821 - L823 were not covered by tests

if spaces.get_spaces(cifti=(True,)):
# Figure out the surface spaces and volume spaces we need
cifti_spaces = spaces.get_standard(cifti=(True,)) + spaces.get_nonstandard(cifti=(True,))

Check warning on line 827 in fmriprep/config.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/config.py#L827

Added line #L827 was not covered by tests
for cifti_space in cifti_spaces:
# The surface space
spaces.add(
Reference(
cifti_space.space,
{k: v for k, v in cifti_space.spec.items() if not k.startswith('vol')},
),
)
# The volume space
spaces.add(
Reference(
cifti_space.spec['volspace'],
{
k: v for k, v in cifti_space.spec.items()
if (k.startswith('vol') and k != 'volspace')
},
),
)

# Make the SpatialReferences object available
workflow.spaces = spaces
2 changes: 1 addition & 1 deletion fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def init_bold_wf(
name='carpetplot_wf',
)

if config.workflow.cifti_output:
if spaces.get_spaces(cifti=(True,)):
workflow.connect(
bold_grayords_wf, 'outputnode.cifti_bold', carpetplot_wf, 'inputnode.cifti_bold',
) # fmt:skip
Expand Down
Loading