Template not found error when using 'onavg' template

Hi everyone,

fMRIprep newbie here. I’ve been processing a BIDS fMRI dataset with (singularity) fMRIprep 23.2.0 with success for the template MNI152NLin2009aSym. I want to now process it using the template onavg.

I tried to run the exact same fMRIprep command only replacing the part --output-spaces MNI152NLin2009aSym with --output-spaces onavg:den-10k, following the usage found here

I’m getting the following error:

  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node registration.

Traceback:
        Traceback (most recent call last):
          File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
            runtime = self._run_interface(runtime)
          File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/interfaces/norm.py", line 182, in _run_interface
            ants_args = self._get_ants_args()
          File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/interfaces/norm.py", line 427, in _get_ants_args
            ref_template, template_spec = get_template_specs(
          File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/utils/misc.py", line 117, in get_template_specs
            raise RuntimeError(
        RuntimeError: Could not find template "onavg" with specs={'suffix': 'T1w', 'desc': None, 'atlas': None, 'resolution': None}. Please revise your template argument.
  • I downloaded the template from TemplateFlow to $HOME/.cache/templateflow and, checked the content of the tpl-onavg subfolder and everything looks fine.
  • I use SINGULARITYENV_TEMPLATEFLOW_HOME=/templateflow and the default $HOME/.cache/templateflow for storing templates.

My current assumptions are either that:

  • I may need to add another space to the --output-spaces that could be needed to compute onavg ?
  • It is possible that outputs in onavg space can’t be obtained directly from fmriprep this way ?

Any help would be greatly appreciated ! Thanks !

It looks like fMRIPrep (or sMRIPrep, or Niworkflows) assumes that onavg is a volumetric template rather than a surface template.

At least part of the problem seems to be that Niworkflows was mischaracterizing any non-Freesurfer surface spaces (e.g., onavg, dhcpAsym, dhcpSym) as volumetric until very recently (see `dim` attribute in `References` is incorrect for non-Freesurfer surfaces · Issue #882 · nipreps/niworkflows · GitHub).

I don’t know if it will fix this particular issue, but I’d recommend using fMRIPrep’s unstable image and patching in a local copy of niworkflows’ up-to-date master branch to /opt/conda/envs/fmriprep/lib/python3.11/site-packages/niworkflows within the image. Otherwise, I think you’ll need to wait until the next release.

1 Like