FileNotFoundError: No T1w or T2w files found

Summary of what happened:

BIDS layout in XCP-D doesn’t seem to recognize the T1w scan. I haven’t run the validator since I am pretty sure it will fail: the derivatives were selectively downloaded via NDA from ABCC. But as far as I understand xcp_d can still run, and the layout validator in XCP-D is disabled either way. The download included:

  • T1w MNI152NLin2009cAsym
  • BOLD MNI152NLin2009cAsym
  • Confounds.

fMRIPrep directory tree:

|-- dataset_description.json
|-- participants.tsv
|   |-- sub-NDARINVMENCHP62
|   |   `-- ses-baselineYear1Arm1
|   |       |-- anat
|   |       |   `-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_space-MNI152NLin2009cAsym_res-2_desc-preproc_T1w.nii.gz
|   |       `-- func
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-1_desc-confounds_timeseries.tsv
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-1_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-1_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-2_desc-confounds_timeseries.tsv
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-2_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-2_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-3_desc-confounds_timeseries.tsv
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-3_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-3_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-4_desc-confounds_timeseries.tsv
|   |           |-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-4_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
|   |           `-- sub-NDARINVMENCHP62_ses-baselineYear1Arm1_task-rest_run-4_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz

Command used:

singularity exec -B $MRIS -B $HOME -B $SIMG $SIMG/xcp_d-0.9.0.simg /usr/local/miniconda/bin/xcp_d \
 $MRIS \
 $XCPD_OUT \
 participant \
 --mode abcd \
 --input-type fmriprep \
 --motion-filter-type none \
 --participant_label $sub \
 --work-dir $XCPD_work \
 -p 27P \
 -t rest \
 --file-format nifti \
 -f 0.3 \
 --lower-bpf 0.009 \
 --upper-bpf 0.08 \
 --fs-license-file $FS_LICENSE \
 --stop-on-first-crash \
 --warp-surfaces-native2std n \
 --atlases '4S456Parcels' \
 -vvv

Version:

0.9.0

Environment:

Apptainer 1.2.5-1.el8

Error traceback:

  File "/usr/local/miniconda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/miniconda/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/cli/workflow.py", line 99, in build_workflow
    retval["workflow"] = init_xcpd_wf()
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/workflows/base.py", line 78, in init_xcpd_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/workflows/base.py", line 124, in init_single_subject_wf
    subj_data = collect_data(
  File "/usr/local/miniconda/lib/python3.10/site-packages/xcp_d/utils/bids.py", line 268, in collect_data
    raise FileNotFoundError("No T1w or T2w files found.")
FileNotFoundError: No T1w or T2w files found.

Hi @victoris93,

What is $MRIS in your command? The BIDS directory or fmriprep output directory? Do any of your drives contain symlinks (eg, from datalad)?

Best,
Steven

Hi Steven,
Oops forgot about these.
MRIS=/gpfs3/well/margulies/projects/data/ABCD/fmriresults01/derivatives/fmriprep (the derivatives of fMRIPrep are here)
XCPD_OUT=/gpfs3/well/margulies/projects/data/ABCD/fmriresults01/derivatives/xcp_d (output of xcp_d)
SIMG=.../projects/ (xcp_d-0.9.0.simg is here)
There are no symlinks on /gpfs3/well/margulies/projects/data/ABCD.

Thanks!
Victoria

Did you manually build the tree output? It looks like sub-NDARINVMENCHP62 is a subfolder of participants.tsv in this tree somehow. I just want to make sure the subject folder is at the top level (i.e., directly in /gpfs3/well/margulies/projects/data/ABCD/fmriresults01/derivatives/fmriprep).

Hi @tsalo,

Previously I pasted the output of tree -L 5 as markdown, I guess not optimal. Here’s a screenshot just in case. The same command run in /gpfs3/well/margulies/projects/data/ABCD/fmriresults01/derivatives/fmriprep.

The sub number is different here, this one is the first to show on the tree. But the T1w scan is also present for the one that threw the error. All subject folders are in /fmriprep

Could reproduce it with a minimal dummy dataset on the main branch:

tmp
└── derivatives
    └── sub-01
        └── ses-01
            ├── anat
            │   └── sub-01_ses-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
            └── func
                ├── sub-01_ses-01_task-rest_run-1_desc-confounds_timeseries.tsv
                └── sub-01_ses-01_task-rest_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
from bids.layout import BIDSLayout
import xcp_d.utils.bids as xbids

derivatives_folder =  "/home/remi/github/xcp_d/tmp/derivatives"

layout = BIDSLayout(derivatives_folder, validate=False, config=["bids", "derivatives"])

subj_data = xbids.collect_data(
    layout=layout,
    input_type="fmriprep",
    participant_label="01",
    bids_filters=None,
    file_format="nifti",
)
$ /home/remi/miniconda3/bin/python /home/remi/github/xcp_d/test_fmriprep.py
Traceback (most recent call last):
  File "/home/remi/github/xcp_d/test_fmriprep.py", line 17, in <module>
    subj_data = xbids.collect_data(
                ^^^^^^^^^^^^^^^^^^^
  File "/home/remi/github/xcp_d/xcp_d/utils/bids.py", line 268, in collect_data
    raise FileNotFoundError("No T1w or T2w files found.")
FileNotFoundError: No T1w or T2w files found.
1 Like

The bare minimum set of files to make this test pass was:

tmp
└── derivatives
    └── sub-01
        └── ses-01
            ├── anat
            │   ├── sub-01_ses-01_desc-preproc_T1w.nii.gz
            │   ├── sub-01_ses-01_from-MNI152NLin2009cAsym_to-T1w_xfm.nii.gz
            │   ├── sub-01_ses-01_from-T1w_to-MNI152NLin2009cAsym_xfm.nii.gz
            │   └── sub-01_ses-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
            └── func
                ├── sub-01_ses-01_task-rest_run-1_desc-confounds_timeseries.tsv
                └── sub-01_ses-01_task-rest_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
1 Like