fmriprep: fmriprep output report does not properly handle multiple resting state runs that differ only in contrast

fmriprep version 20.0.2

I ran an analysis to completion (no errors) that contained a T1w anatomic image and two resting state runs taken in the same session, one before Gd contrast was injected, and one several minutes after. The subject folder was as follows:

sub-B13293
├── anat
│   ├── sub-B13293_T1w.json
│   └── sub-B13293_T1w.nii.gz
└── func
    ├── sub-B13293_task-rest_ce-Gd_bold.json
    ├── sub-B13293_task-rest_ce-Gd_bold.nii.gz
    ├── sub-B13293_task-rest_ce-none_bold.json
    └── sub-B13293_task-rest_ce-none_bold.nii.gz

As far as I can tell, both files were analyzed properly, and created all the appropriate outputs in the anat and func folders of derivatives/fmriprep /sub-B13293. The output files for ce-none and cd-Gd are different, and appear to reflect the actual input files.

sub-B13293
├── anat
│   ├── sub-B13293_desc-brain_mask.json
│   ├── sub-B13293_desc-brain_mask.nii.gz
│   ├── sub-B13293_desc-preproc_T1w.json
│   ├── sub-B13293_desc-preproc_T1w.nii.gz
│   ├── sub-B13293_dseg.nii.gz
│   ├── sub-B13293_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5
│   ├── sub-B13293_from-MNI152NLin6Asym_to-T1w_mode-image_xfm.h5
│   ├── sub-B13293_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
│   ├── sub-B13293_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5
│   ├── sub-B13293_label-CSF_probseg.nii.gz
│   ├── sub-B13293_label-GM_probseg.nii.gz
│   ├── sub-B13293_label-WM_probseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_desc-brain_mask.json
│   ├── sub-B13293_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_desc-preproc_T1w.json
│   ├── sub-B13293_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_dseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin6Asym_desc-brain_mask.json
│   ├── sub-B13293_space-MNI152NLin6Asym_desc-brain_mask.nii.gz
│   ├── sub-B13293_space-MNI152NLin6Asym_desc-preproc_T1w.json
│   ├── sub-B13293_space-MNI152NLin6Asym_desc-preproc_T1w.nii.gz
│   ├── sub-B13293_space-MNI152NLin6Asym_dseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz
│   ├── sub-B13293_space-MNI152NLin6Asym_label-GM_probseg.nii.gz
│   └── sub-B13293_space-MNI152NLin6Asym_label-WM_probseg.nii.gz
├── figures
│   ├── sub-B13293_desc-reconall_T1w.svg
│   ├── sub-B13293_dseg.svg
│   ├── sub-B13293_space-MNI152NLin2009cAsym_T1w.svg
│   ├── sub-B13293_space-MNI152NLin6Asym_T1w.svg
│   ├── sub-B13293_task-rest_desc-aroma_bold.svg
│   ├── sub-B13293_task-rest_desc-bbregister_bold.svg
│   ├── sub-B13293_task-rest_desc-carpetplot_bold.svg
│   ├── sub-B13293_task-rest_desc-compcorvar_bold.svg
│   ├── sub-B13293_task-rest_desc-confoundcorr_bold.svg
│   ├── sub-B13293_task-rest_desc-flirtbbr_bold.svg
│   ├── sub-B13293_task-rest_desc-rois_bold.svg
│   └── sub-B13293_task-rest_desc-sdc_bold.svg
├── func
│   ├── sub-B13293_task-rest_ce-Gd_AROMAnoiseICs.csv
│   ├── sub-B13293_task-rest_ce-Gd_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_desc-MELODIC_mixing.tsv
│   ├── sub-B13293_task-rest_ce-Gd_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-Gd_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_desc-confounds_regressors.json
│   ├── sub-B13293_task-rest_ce-Gd_desc-confounds_regressors.tsv
│   ├── sub-B13293_task-rest_ce-Gd_desc-preproc_bold.json
│   ├── sub-B13293_task-rest_ce-Gd_desc-preproc_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_res-2_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_res-2_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_res-2_desc-preproc_bold.json
│   ├── sub-B13293_task-rest_ce-Gd_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-T1w_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-T1w_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-Gd_space-T1w_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-Gd_space-T1w_desc-preproc_bold.json
│   ├── sub-B13293_task-rest_ce-Gd_space-T1w_desc-preproc_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-none_AROMAnoiseICs.csv
│   ├── sub-B13293_task-rest_ce-none_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-none_desc-MELODIC_mixing.tsv
│   ├── sub-B13293_task-rest_ce-none_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-none_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-none_desc-confounds_regressors.json
│   ├── sub-B13293_task-rest_ce-none_desc-confounds_regressors.tsv
│   ├── sub-B13293_task-rest_ce-none_desc-preproc_bold.json
│   ├── sub-B13293_task-rest_ce-none_desc-preproc_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_res-2_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_res-2_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_res-2_desc-preproc_bold.json
│   ├── sub-B13293_task-rest_ce-none_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-T1w_boldref.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-T1w_desc-brain_mask.json
│   ├── sub-B13293_task-rest_ce-none_space-T1w_desc-brain_mask.nii.gz
│   ├── sub-B13293_task-rest_ce-none_space-T1w_desc-preproc_bold.json
│   └── sub-B13293_task-rest_ce-none_space-T1w_desc-preproc_bold.nii.gz
└── log

However as you can see in the figures folder, only one set of functional figures was produced - sub-B13293_task-rest_desc*. This matches the html output file - it says there are two input task-rest files, and shows two sets of images for the registration, confounds, and aroma analysis - but they are identical. I’ve done this with datsets that have multiple _task-rest_run_X files, and those are handled properly - the report shows them as unique files. But somewhere in the generation of the report and figures, it seems to throw away the “ce” BIDS entity and treat the files the same.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (15 by maintainers)

Most upvoted comments

I agree. I’ll submit a separate PR after James’ patch is applied just to satisfy my OCD.

That did the trick! Thank you!

In the end, what was the missing bit?

BTW, while you were in there, did you fix it for direction and echo as well? It looked like those were not handled either.

I tried running your branch, and it complains:

Status: Downloaded newer image for poldracklab/fmriprep:20.0.4
RUNNING: docker run --rm -it -e DOCKER_VERSION_8395080871=19.03.8 -v /Users/frederic/code/niworkflows_jdkent/niworkflows:/usr/local/miniconda/lib/python3.7/site-packages/niworkflows:ro -v /Applications/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /Users/frederic/Dropbox_PHC/MR_data/ucb_data/prepostgad:/data:ro -v /Users/frederic/Dropbox_PHC/MR_data/ucb_data/prepostgad/derivatives:/out -v /Users/frederic/Documents/MR_data/workdirs/prepostgad:/scratch poldracklab/fmriprep:20.0.4 /data /out participant --participant_label=B13293 --mem_mb=24000 --nthreads=8 --omp-nthreads=8 --use-syn-sdc --use-aroma --fs-no-reconall -w /scratch --output-spaces MNI152NLin6Asym:res-2 anat func:res-native
Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>
    sys.exit(main())
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 296, in main
    opts = get_parser().parse_args()
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 42, in get_parser
    from niworkflows.utils.spaces import Reference, SpatialReferences, OutputReferencesAction
ModuleNotFoundError: No module named 'niworkflows.utils.spaces'
fMRIPrep: Please report errors to https://github.com/poldracklab/fmriprep/issues

It does run my version, however, which I updated with your fix (I have no idea why). Unfortunately, that didn’t seem to fix things either. I’ve deleted everything (all work directories and derivative directories) and I’m trying again to see if maybe there was something cached that was causing the issue…