Existing atlas affine is different from the input file affine

Summary of what happened:

I’m trying to use XCP_D directly on fMRIPrep outputs for a series of tasks. I ran the resting-state separately to enforce a minimum time (–min-time) after censoring, and I want to run the task data as pseudo-resting state. Though the tasks are shorter, they’re still around 5min. My resting-state goes through the pipeline without trouble, but when I change nothing else except the task being ran, I run into the following issue for all four atlases I am running (see below).

I’m not sure why it’s trying to switch from MNI152NLin2009cAsym to MNI152NLin6Asym (the documentation seems to indicate that the former should be fine). And I’m even more confused why this error seems to be task specific. I’ve tried version 0.7.5 (the oldest one I had) up through 10.0.1 with similar results (after adjusting the command accordingly).

My goal is to create correlation matrices for all of my scans. It’s worth noting that in all cases, XCP_D says it completed successfully, but in the non-rest tasks there are no parcellation files or anything downstream of them (including pearson correlation files) created.

Command used (and if a helper script was used, a link to the helper script or the command generated):

docker run --rm -it \
       --user $(id -u):$(id -g) \
       -v $FMRI_DIR:/fmriprep:ro \
       -v $WORK_DIR:/work:rw \
       -v $OUT_DIR:/out:rw \
       -v /media/User/Elements/Imaging/code:/code:ro \
       -v $FS_DIR:/freesurfer:ro \
       -v /usr/local/freesurfer:/license:ro \
       pennlinc/xcp_d:latest \
       /fmriprep /out participant \
       --fs-license-file /license/license.txt \
       --bids-filter-file /code/bids_filter_task.json \
       --work-dir /work \
       --mode linc \
       --fd-thresh 0.6 \
       --min-coverage 0 \
       --min-time 30 \
       --smoothing 6 \
       --write-graph \
       --debug all \
       --n_cpus 8 \
       --mem-gb 15 \
       --input-type fmriprep \
       --atlases Tian Glasser 4S356Parcels Gordon \
       --clean-workdir \
       --file-format nifti \
       --participant-label 1072 \
       -vvv

Version:

10.0.1

Environment (Docker, Singularity / Apptainer, custom installation):

Docker (docker pull pennlinc/xcp_d:latest)

Data formatted according to a validatable standard? Please provide the output of the validator:

BIDS, but I don’t have SliceTiming defintions or events.tsv files. All other validator passes.

Relevant log outputs (up to 20 lines):

Subnode 3 failed
Error: Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/interfaces/bids.py", line 284, in _run_interface
    raise ValueError(
ValueError: Existing '4S356Parcels' atlas affine (/out/atlases/atlas-4S356Parcels/atlas-4S356Parcels_space-MNI152NLin2009cAsym_dseg.nii.gz) is different from the input file affine (/work/xcp_d_0_10_wf/sub_1072_wf/load_atlases_wf/warp_atlases_to_bold_space/mapflow/_warp_atlases_to_bold_space3/atlas-4S356Parcels_space-MNI152NLin6Asym_res-01_dseg_trans.nii.gz).

...

Traceback:
        Traceback (most recent call last):
          File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
            runtime = self._run_interface(runtime)
          File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/interfaces/bids.py", line 284, in _run_interface
            raise ValueError(
        ValueError: Existing '4S356Parcels' atlas affine (/out/atlases/atlas-4S356Parcels/atlas-4S356Parcels_space-MNI152NLin2009cAsym_dseg.nii.gz) is different from the input file affine (/work/xcp_d_0_10_wf/sub_1072_wf/load_atlases_wf/warp_atlases_to_bold_space/mapflow/_warp_atlases_to_bold_space3/atlas-4S356Parcels_space-MNI152NLin6Asym_res-01_dseg_trans.nii.gz).

Screenshots / relevant information:

What I’ve tried

  1. Updating to the latest version.
  2. Running a single participant with each (reasonable) argument removed.
  3. Confirming the command works for task-rest but not other tasks.
  4. Searching for similar issues - I see this error message coming up in February but it wasn’t specific like mine is and I could not find a solution or workaround for it.

Computer information

  • Linux (Ubuntu 22.04)

Can you share the command you used to run fMRIPrep?

Of course, thank you for your reply. I used fmriprep version 23.2.1, pulled from Docker (nipreps/fmriprep).

fmriprep-docker "${WDIR}/" \
	 "${WDIR}/derivatives/fmriprep/" \
	 participant \
	 -w /home/User/Research/Imaging/fmriprep/ \
	 --bids-filter-file "${WDIR}/code/bids_filter_file.json" \
	 --resource-monitor \
	 --ignore slicetiming \
	 --n_cpus 16 \
	 --track-carbon \
	 --fs-license-file /usr/local/freesurfer/license.txt \
	 --participant-label 1001

I think this error can occur when there are different resolutions in the same dataset and you have native-resolution fMRIPrep derivatives. Since you tried running a single participant, I wonder if maybe you have different resolutions within the same subject? Even small ones (1.78 mm vs. 1.80) would cause a problem. Is that possible in your dataset?

You are right, I ran a quick script to check and all subjects have a resolution of (2.25, 2.25, 2.4) mm in rest and (2.29, 2.29, 2.3) mm in the other 5 tasks. But I don’t run the rest data at the same time as the task (pseudo-rest) data. When I run a subject and a single task, why would this cause a problem?

Thanks!

The atlases written out when you process the resting-state data will have 2.25x2.25x2.4 mm voxels. If you then run XCP-D on the other task data, it should grab the atlases with that resolution and apply them to 2.29x2.29x2.3 data, which would raise this error. Can you check your preprocessed data’s resolution against the resolution of the atlases?

If that isn’t the problem, then it might be a less obvious issue.

Thank you, I was assuming XCP_D would be grabbing the atlas with the correct resolution, or adjusting it accordingly. The resolutions are:

  • Task: rest

    • Raw: (2.25, 2.25, 2.4) mm
    • fMRIPrep: (2.25, 2.25, 2.4) mm
  • Task: pseudo-rest

    • Raw: (2.29, 2.29, 2.3) mm
    • fMRIPrep: (2.29, 2.29, 2.3) mm
  • Atlases

    • atlas-4S356Parcels_space-MNI152NLin2009cAsym_dseg: (2.25, 2.25, 2.4) mm
    • atlas-Glasser_space-MNI152NLin2009cAsym_dseg: (2.25, 2.25, 2.4) mm
    • atlas-Gordon_space-MNI152NLin2009cAsym_dseg: (2.25, 2.25, 2.4) mm
    • atlas-HCP_space-MNI152NLin2009cAsym_dseg: (2.25, 2.25, 2.4) mm
    • atlas-Tian_space-MNI152NLin2009cAsym_dseg: (2.25, 2.25, 2.4) mm

I’ll try deleting the old atlases and rerunning the pipeline to see if it pulls the correct resolutions in the meantime.

Edit Update: Deleting the old atlases fixed the issue, thank you for your help!