Fmriprep: path does not exist

I have been struggling to get fmriprep to work. I have attempted numerous solutions from different forums, as well as switched from using WSL on Windows to Ubuntu. I have finally got a working command that does not produce an error concerning whether docker or fmriprep exists. With this command, I am now getting the error that the path within the fmriprep container does not exist when it does. Many of the posts I read had issues when using singularity (?).
Would any one have an idea as to what the issue could be?

Command used:
sudo docker run nipreps/fmriprep /home/afton/Downloads/Nifti_int /home/afton/Downloads participant --participant-label PIPS_01 -fs-license-file /home/afton/Downloads/FreeSurfer/license.txt

Output + Error:
/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. This includes the config_filename, ignore, force_index, and index_metadataarguments. The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via theindexer argument. warnings.warn("The ability to pass arguments to BIDSLayout that control " usage: fmriprep [-h] [--version] [--skip_bids_validation] [--participant-label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [-t TASK_ID] [--echo-idx ECHO_IDX] [--bids-filter-file FILE] [--anat-derivatives PATH] [--bids-database-dir PATH] [--nprocs NPROCS] [--omp-nthreads OMP_NTHREADS] [--mem MEMORY_GB] [--low-mem] [--use-plugin FILE] [--anat-only] [--boilerplate_only] [--md-only-boilerplate] [--error-on-aroma-warnings] [-v] [--ignore {fieldmaps,slicetiming,sbref,t2w,flair} [{fieldmaps,slicetiming,sbref,t2w,flair} ...]] [--longitudinal] [--output-spaces [OUTPUT_SPACES [OUTPUT_SPACES ...]]] [--bold2t1w-init {register,header}] [--bold2t1w-dof {6,9,12}] [--force-bbr] [--force-no-bbr] [--medial-surface-nan] [--dummy-scans DUMMY_SCANS] [--random-seed _RANDOM_SEED] [--use-aroma] [--aroma-melodic-dimensionality AROMA_MELODIC_DIM] [--return-all-components] [--fd-spike-threshold REGRESSORS_FD_TH] [--dvars-spike-threshold REGRESSORS_DVARS_TH] [--skull-strip-template SKULL_STRIP_TEMPLATE] [--skull-strip-fixed-seed] [--skull-strip-t1w {auto,skip,force}] [--fmap-bspline] [--fmap-no-demean] [--use-syn-sdc] [--force-syn] [--fs-license-file FILE] [--fs-subjects-dir PATH] [--no-submm-recon] [--cifti-output [{91k,170k}] | --fs-no-reconall] [--output-layout {bids,legacy}] [-w WORK_DIR] [--clean-workdir] [--resource-monitor] [--reports-only] [--config-file FILE] [--write-graph] [--stop-on-first-crash] [--notrack] [--debug {compcor,all} [{compcor,all} ...]] [--sloppy] bids_dir output_dir {participant} fmriprep: error: Path does not exist: </home/afton/Downloads/Nifti_int>.

In your terminal, what is the output of ls /home/afton/Downloads/Nifti_int ?

It is a folder that contains my Nifti files.

This argument should be a directory containing BIDS-validated dataset, have you run the BIDS-validator on it or have otherwise organized the data to be BIDS compliant?

1 Like

That is, is it organized like as described here (look at the right side of the picture on the webpage)?

I now have the BIDS format in which my directory is:
/home/afton/Downloads/BIDS/sub-01/ and the contents are 3 folders organized as anat, fmap, func.

When I run the command:
sudo docker run nipreps/fmriprep /home/afton/Downloads/BIDS/sub-01/ /home/afton/Downloads/fmriprep-preproc/ --participant-label PIPS_01 -fs-license-file /home/afton/Downloads/FreeSurfer/license.txt

I still get the same error that the path does not exist.
fmriprep: error: Path does not exist: </home/afton/Downloads/BIDS/sub-01/>.

I would guess it is something in how I have my files named that the BIDS schema does not agree with?

This is the config file I used to generate it.
{ "descriptions": [ { "dataType": "anat", "modalityLabel": "T1w", "customLabels": "T1w", "criteria": { "SeriesDescription": "T1w_MPR", "SidecarFilename": "007*" } }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "fm-dir-AP-int", "criteria": { "SidecarFilename": "015*" }, "intendedFor": 3 }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "fm-dir-PA-int", "criteria": { "SidecarFilename": "016*" }, "intendedFor": 3 }, { "dataType": "func", "modalityLabel": "sbref", "customLabels": "task-int", "criteria": { "SidecarFilename": "017*" }, "sidecarChanges": { "TaskName": "interaction" } }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "fm-dir-AP-obs", "criteria": { "SidecarFilename": "011*" }, "intendedFor": 6 }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "fm-dir-PA-obs", "criteria": { "SidecarFilename": "012*" }, "intendedFor": 6 }, { "dataType": "func", "modalityLabel": "sbref", "customLabels": "task-obs", "criteria": { "SidecarFilename": "013*" }, "sidecarChanges": { "TaskName": "observation" } } ] }

When I check the BIDS specification, it just says that the sub-* is required and the rest optional. So, I am not sure where I am going wrong.

It looks like you’re using dcm2bids for your BIDS conversion, based on the configuration file you posted.

There are a few dcm2bids tutorials to get you familiarized with this specific tool if you want: #1, #2.

Regarding your configuration file specifically, there seem to be a few issues:

1). You have task-obs and "TaskName": "observation"; the task names need to be the same.

2). For your epi acquisitions, you have "customLabels": "fm-dir-PA-int", but this is incorrect syntax, and should look something more like "customLabels": "dir-PA"

3). If your functional sbref/bold acquisitions have multiple runs, you would want to adjust your custom labels a bit, something like "customLabels": "task-obs_run-1"

Also, just as a sanity check, can you just paste the outputs of ls /home/afton/Download/BIDS/ so we can see if it looks BIDS-compliant and to make sure the directory exists? Also, fmriprep should be run on the overall BIDS folder, not the individual subject folder, which sub-01 appears to be. Also, there appears to be a mismatch between the name sub-01 and PIP_01 (also sub names should have dashes, not underscores).

I reworked my folder slightly when I realized I needed the additional .txt/.json files.
Here is the bids directory I am currently working in.

Command:
afton@ubuntu:~/Documents$ ls dcm2bids/bids_dataset
Output:
dataset_description.json participants.json participants.tsv README sub-01 sub-02 sub-03

In this case your input folder to fmriprep should be dcm2bids/bids_dataset and the participant label should be sub-01. It may also help to show us what is in sub-01 to see if the earlier problems have been resolved, or outputting the result of the BIDS validator.

1 Like

Many thanks for the resources! I have went through the dcm2bids tutorial, which was very helpful in executing the commands but not so much with the config file. I had a sample config file from a colleague, which is where I assume I misunderstood the naming.

I have a couple questions concerning the issues you mentioned:

  1. I have the customLabels as 'task-int' and the TaskName as 'interaction' (the same goes for observation). Why does the name need to be the same if the TaskName is wrapped by sidecarChanges?
    ** This was a piece of the config file I mimicked from the colleague, so I am ignorant to the difference in the label of sidecar and of the custom name.

  2. Yes, I thought this might be an issue but was unsure. As I have two separate tasks (from a single sessions/run), I have two sets of field maps that match based on their scanning specs. If "fm-dir-PA-int" is not a suitable syntax, what would be a way that I could distinguish the fieldmaps of each of my tasks.

  3. Is adding in the run necessary? Technically, I have two tasks taken in a single run/session.

Command:
afton@ubuntu:~/Documents$ ls dcm2bids/bids_dataset/sub-01/*
Output:
dcm2bids/bids_dataset/sub-01/anat: sub-01_T1w_T1w.json sub-01_T1w_T1w.nii.gz

dcm2bids/bids_dataset/sub-01/fmap: sub-01_fm-dir-AP-int_epi.json sub-01_fm-dir-AP-obs_epi.json sub-01_fm-dir-PA-int_epi.json sub-01_fm-dir-PA-obs_epi.json sub-01_fm-dir-AP-int_epi.nii.gz sub-01_fm-dir-AP-obs_epi.nii.gz sub-01_fm-dir-PA-int_epi.nii.gz sub-01_fm-dir-PA-obs_epi.nii.gz

dcm2bids/bids_dataset/sub-01/func: sub-01_task-int_sbref.json sub-01_task-int_sbref.nii.gz sub-01_task-obs_sbref.json sub-01_task-obs_sbref.nii.gz

Ah ok. I had thought the participant-label was the output label. If it is being run over the entire data set, should it be some kind of list of participant names?

I was reading in the fmriprep documentation that this is possible, but I was unclear whether this space separated participants list was a .txt or .json.

Looks like we still have some naming problems. Please change them so that they follow the naming conventions specified here.

anat should contain sub-01_T1w.json/nii.gz
fmap should contain sub-01_dir-AP/PA_epi.json/nii.gz. Since you did two runs of fmap, there should be _run-01_ or 02 after the dir part. In the JSONs for the fieldmaps, you should add an IntendedFor field to associate the fieldmap to the BOLD file.
func your sbrefs look fine, but I don’t see any BOLD files.

1 Like

A couple of questions:
For anat: makes sense
For fmaps: and if the order of the runs change for each participant? Is this something to be changed each time in the config file as well?
For func: I used sbref as I ran a single band sequence… perhaps I misunderstood its purpose and instead should specify the modality as BOLD?

I have the customLabels as 'task-int' and the TaskName as 'interaction' (the same goes for observation). Why does the name need to be the same if the TaskName is wrapped by sidecarChanges ?

I can’t say with 100% certainty, but my hunch is that the task label (_task-) and and TaskName need to be the same, otherwise BIDS may think they are two separate tasks and note the incongruity.

  1. Yes, I thought this might be an issue but was unsure. As I have two separate tasks (from a single sessions/run), I have two sets of field maps that match based on their scanning specs. If "fm-dir-PA-int" is not a suitable syntax, what would be a way that I could distinguish the fieldmaps of each of my tasks.

The field maps labelling can look like this:

sub-01_dir-PA_run-1_epi.nii.gz
sub-01_dir-PA_run-1_epi.json
sub-01_dir-AP_run-1_epi.nii.gz
sub-01_dir-AP_run-1_epi.json
sub-01_dir-PA_run-2_epi.nii.gz
sub-01_dir-PA_run-2_epi.json
sub-01_dir-AP_run-2_epi.nii.gz
sub-01_dir-AP_run-2_epi.json

To account for the order of runs changing, that’s what the IntendedFor field does. It tells fMRIPrep that for this particular subject, run-1 goes to task-X and run-2 goes to task-Y. To make the IntendedFor field, add the following to your fieldmap json files, as appropriate.

IntendedFor: ['func/sub-XX_task-Y_run-ZZ_bold.nii.gz',ADD MORE FILES HERE AS NEEDED]

SBREF is a small image used as a reference in some of the preprocessing steps. Your BOLD files should be the larger nifti that contains the actual fmri runs.

1 Like

@Steven @dlevitas Many thanks to you both for your time and insights!! I greatly appreciate it!

So I have renamed my files accordingly and (I think) they should be fitting to the BIDS format. I have also ran this through an online BIDS validator that gave no errors (only a few minor warnings). However, I am still getting the same error that the path does not exist. Here is the contents of my one subject in my bids folder:

afton@ubuntu:~/Documents/dcm2bids/bids_dataset/sub-01$ ls *
anat: sub-01_T1w.json sub-01_T1w.nii.gz

fmap: sub-01_dir-AP_run-1_epi.json sub-01_dir-AP_run-2_epi.json sub-01_dir-PA_run-1_epi.json sub-01_dir-PA_run-2_epi.json sub-01_dir-AP_run-1_epi.nii.gz sub-01_dir-AP_run-2_epi.nii.gz sub-01_dir-PA_run-1_epi.nii.gz sub-01_dir-PA_run-2_epi.nii.gz

func: sub-01_task-int_bold.json sub-01_task-int_events.tsv sub-01_task-obs_bold.nii.gz sub-01_task-int_bold.nii.gz sub-01_task-obs_bold.json sub-01_task-obs_events.tsv

I have also included the event files necessary for the task analysis and fixed the errors within them that were brought up by the online BIDS validator. Is there anything else you see that could be causing the fmriprep: path does not exist error?

Great to hear that BIDS validator is only throwing some warnings! Something I should have suggested much earlier in regards to the path error, is that you can try to mount your data drive to Docker. I use Singularity so I don’t know how it’s done in Docker, but from what I’ve found online, try adding this to your command. This is assuming that everything you need is in /home/afton

sudo docker -v /home/afton run (REST OF COMMAND SHOULD BE THE SAME)