fmriprep icon indicating copy to clipboard operation
fmriprep copied to clipboard

Issue: Data Orientation Bug in Preprocessed Functional Data 'preproc_bold'

Open caroleguedj opened this issue 1 year ago • 4 comments

What happened?

I have encountered a data orientation bug affecting the preprocessed functional data in multiple participants. The issue is particularly unusual because:

  • The .html reports do not show any anomalies; everything appears normal.
  • No errors or warnings are flagged during processing.
  • The masks and anatomical data are correctly oriented. I have been using fMRIPrep for several years without facing this issue previously. This is the first time I have encountered a data orientation problem in the functional outputs. An other point is that the fieldmaps seems to be ignore even though I do mention the 'IntendedFor' param in their .json .

What command did you use?

docker context use rootless
bids_root_dir="my_path"
subjects=("001")

for subj in "${subjects[@]}"; do
  echo "Processing subject $subj"
  docker run --rm -it -v $bids_root_dir/sourcedata:/data:ro \
    -v $bids_root_dir/derivatives:/out \
    -v $FREESURFER_HOME:/freesurfer nipreps/fmriprep:latest \
    /data /out participant \
    --participant-label $subj \
    --fs-license-file /freesurfer/license.txt \
    --md-only-boilerplate \
    --output-spaces MNIPediatricAsym:cohort-2:res-native \
    --stop-on-first-crash \
    --fd-spike-threshold 2 \
    --dvars-spike-threshold 6 \
	--fs-no-reconall \
    -w /scratch
done

What version of fMRIPrep are you running?

fMRIPrep-24.1.0rc0

How are you running fMRIPrep?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

For bids, if I use the command-line BIDS validator I have no error, if I use the website BIDS validator, I have the error below and some warnings about sidecars.
ERROR: REPETITION_TIME_AND_ACQUISITION_DURATION_MUTUALLY_EXCLUSIVE

Additional information / screenshots

No response

caroleguedj avatar Oct 22 '24 07:10 caroleguedj

Thanks for the report! Could you share logs and/or screenshots of the errors you're seeing?

effigies avatar Oct 22 '24 12:10 effigies

@effigies I think this is probably the result of the nitransforms 24.0.0 bug that affected fMRIPrep 24.1.0rc0.

tsalo avatar Oct 22 '24 12:10 tsalo

Seems plausible. @caroleguedj Please upgrade to the latest release and see if you get the same result.

effigies avatar Oct 22 '24 13:10 effigies

Many thanks, updating fmriprep with the version 24.1.1. solved the issue!! However, it still ignore the field maps in the preprocessing.

caroleguedj avatar Oct 22 '24 14:10 caroleguedj

Can you share the file layout for a subject, and the contents of a fieldmap's JSON sidecar that's failing to be applied?

effigies avatar Oct 22 '24 14:10 effigies

Below the file layout for a subject:

sub-001
└── ses-t0
    ├── anat
    │   ├── sub-001_ses-t0_run-01_T1w.json
    │   ├── sub-001_ses-t0_run-01_T1w.nii.gz
    │   ├── sub-001_ses-t0_run-02_T1w.json
    │   └── sub-001_ses-t0_run-02_T1w.nii.gz
    ├── dwi
    │   ├── sub-001_ses-t0_dir-AP_dwi.bval
    │   ├── sub-001_ses-t0_dir-AP_dwi.bvec
    │   ├── sub-001_ses-t0_dir-AP_dwi.json
    │   ├── sub-001_ses-t0_dir-AP_dwi.nii.gz
    │   ├── sub-001_ses-t0_dir-PA_dwi.bval
    │   ├── sub-001_ses-t0_dir-PA_dwi.bvec
    │   ├── sub-001_ses-t0_dir-PA_dwi.json
    │   └── sub-001_ses-t0_dir-PA_dwi.nii.gz
    ├── fmap
    │   ├── sub-001_ses-t0_run-01_magnitude1.json
    │   ├── sub-001_ses-t0_run-01_magnitude1.nii.gz
    │   ├── sub-001_ses-t0_run-01_magnitude2.json
    │   ├── sub-001_ses-t0_run-01_magnitude2.nii.gz
    │   ├── sub-001_ses-t0_run-01_phasediff.json
    │   ├── sub-001_ses-t0_run-01_phasediff.nii.gz
    │   ├── sub-001_ses-t0_run-02_magnitude1.json
    │   ├── sub-001_ses-t0_run-02_magnitude1.nii.gz
    │   ├── sub-001_ses-t0_run-02_magnitude2.json
    │   ├── sub-001_ses-t0_run-02_magnitude2.nii.gz
    │   ├── sub-001_ses-t0_run-02_phasediff.json
    │   └── sub-001_ses-t0_run-02_phasediff.nii.gz
    └── func
        ├── sub-001_ses-t0_task-audioWM_run-02_bold.json
        ├── sub-001_ses-t0_task-audioWM_run-02_bold.nii.gz
        ├── sub-001_ses-t0_task-rest_run-01_bold.json
        ├── sub-001_ses-t0_task-rest_run-01_bold.nii.gz
        ├── sub-001_ses-t0_task-visuoWM_run-01_bold.json
        └── sub-001_ses-t0_task-visuoWM_run-01_bold.nii.gz

And the JSON sidecar that was added using dcm2bids:

"IntendedFor": [
        "bids::sub-001/ses-t0/func/sub-001_ses-t0_task-visuoWM_run-01_bold.nii.gz",
        "bids::sub-001/ses-t0/func/sub-001_ses-t0_task-rest_run-01_bold.nii.gz"
    ]

caroleguedj avatar Oct 22 '24 14:10 caroleguedj

Ah, the BIDS-URI support has a bug in that version. Should be fixed in the next release. In the meantime, you can revert to subject-relative paths, so:

"IntendedFor": [
        "ses-t0/func/sub-001_ses-t0_task-visuoWM_run-01_bold.nii.gz",
        "ses-t0/func/sub-001_ses-t0_task-rest_run-01_bold.nii.gz"
    ]

effigies avatar Oct 22 '24 14:10 effigies

thanks!! :-)

caroleguedj avatar Oct 22 '24 15:10 caroleguedj