nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
634 stars 293 forks source link

SDC report svg on SBRef pepolar scheme alternates between SBRef and BOLD. #2891

Open bpinsard opened 1 year ago

bpinsard commented 1 year ago

What happened?

Running fMRIPrep with Pepolar SDC based on SBRefs with multi-echo data. The figure in the reports seems to alternate between different contrasts or echoes, maybe one is optimally combined, or one is SBRef, making it difficult to properly assess SDC results as it is combined with different levels of signal drop. It is likely only a report error.

SVG will properly render on GH so here are separate screenshots: image image

Looking in the workdir to find out which file is used to generated the figure, here are the paths listed in the report.rst

What command did you use?

Not relevant.

What version of fMRIPrep are you running?

22.0.2

How are you running fMRIPrep?

Singularity

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

No response

Additional information / screenshots

No response

bpinsard commented 1 year ago

In fact it is not limited to multi-echo, happens for single-echo, it is more specific to using the SBRef (which I hacked using the temporary patch https://github.com/nipreps/fmriprep/issues/2889 ). I can see that one contrast is the SBRef while the other is BOLD.

* after : .../workdir/fmriprep_22_0_wf/single_subject_emotion_wf/func_preproc_ses_001_task_emotion_run_01_part_mag_wf/final_boldref_wf/enhance_and_skullstrip_bold_wf/n4_correct/vol0000_unwarped_merged_average_corrected.nii.gz
* before : .../workdir/fmriprep_22_0_wf/single_subject_emotion_wf/func_preproc_ses_001_task_emotion_run_01_part_mag_wf/initial_boldref_wf/enhance_and_skullstrip_bold_wf/n4_correct/sub-emotion_ses-001_task-emotion_run-01_part-mag_sbref_valid_merged_squeezed_corrected.nii.gz

We can see above that one originates from vol0000 while the second one is from the sbref file.

I hope that it is only in the report rather than a problem in how SBRefs are passed to SDCFlows.

bpinsard commented 1 year ago

Changed the title as it is not multi-echo specific, but it still shows more prominently with multi-echo as it seems that it is mingled with echoes or combined differences.

bpinsard commented 1 year ago

concat_blips references both SBRefs so that's correct on the SDC estimation part.

jaganjimmy commented 1 year ago

I noticed this when using fMRIprep 22.1.1 as well - by the way, my data is NOT multi-echo.

Digging through the work directory it seems like it isn't just an issue in the report generation alone. When SBRef is available, it seems like somewhere along the way after SDC correction the image it uses as BOLD reference image is an SDC corrected bold image instead of using the SDC corrected SBRef image.

This is evident from the file name of the "moving image" specified for both parts of the coregistration step (see code pasted below obtained from the respective commands.txt files). And so, in practical terms due to this bug the pipeline is NOT using the SBRef image at all for coregistration.

mri_coreg --s sub-RTAA190 --dof 6 --ftol 1.000000e-04 --linmintol 1.000000e-02 --threads 8 --lta /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/mri_coreg/registration.lta --sep 4 --mov /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/mri_coreg/vol0000_unwarped_merged_valid_average_corrected.nii.gz --sd /fs/ess/PAS1815/RTAA/Preprocessed_fmriprep/sourcedata/freesurfer

bbregister --t2 --6 --init-reg /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/mri_coreg/registration.lta --lta /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/bbregister/vol0000_unwarped_merged_valid_average_corrected_bbreg_sub-RTAA190.lta --reg /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/bbregister/vol0000_unwarped_merged_valid_average_corrected_bbreg_sub-RTAA190.dat --o /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/bbregister/vol0000_unwarped_merged_valid_average_corrected_bbreg.nii.gz --mov /fs/scratch/PAS1815/fmriprep_work_skullstrip_fmap_mag/fmriprep_22_1_wf/single_subject_RTAA190_wf/func_preproc_task_NPUThreat_run_1_wf/bold_reg_wf/bbreg_wf/bbregister/vol0000_unwarped_merged_valid_average_corrected.nii.gz --s sub-RTAA190