diff --git a/fmriprep/config.py b/fmriprep/config.py index 6ba0ae1c..cc0363a0 100644 --- a/fmriprep/config.py +++ b/fmriprep/config.py @@ -818,8 +818,31 @@ def init_spaces(checkpoint=True): 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})) + + 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,)) + 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 diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index e37692f0..6f7f429a 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -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