I’m running the latest version of fMRIprep (22.1.1), and I’m using 2 magnitude images + phase difference for distortion correction. The results are completely wrong and the corrected images are much worst than the distorted images,
Command used (and if a helper script was used, a link to the helper script or the command generated):
Have you tried using the most recent LTS version (20.2.7 at this time)?
Have you confirmed that the phase encoding directions are correct for your fieldmap and BOLD files?
Have you confirmed that fMRIPrep is using your fieldmaps and not doing the SYN-based fieldmapless method? You did not share your command, so I don’t know if you enabled it or not.
I can see in the json files that the phase encoding direction for the two magnitude images and the phase difference is i, however for the functional image is j-, is that correct? I never used this method before.
The command line is: singularity run -C -B /EBC:/EBC,$PWD:/opt/templateflow /EBC/home/mblesa/fmriprep-22.1.1.simg $PWD/BIDs_data $PWD/derivatives participant --participant-label ${NAME} -w $PWD --nthreads 16 --fd-spike-threshold 2 --dvars-spike-threshold 3 --omp-nthreads 16 --fs-license-file /EBC/local/infantFS/freesurfer/license.txt --output-space MNI152NLin2009cAsym:res-2 T1w --stop-on-first-crash --skip_bids_validation > $PWD/derivatives/log_fMRIprep_sub-${NAME}.txt
Or replacing 22.1.1 by 20.2.7.
No errors for the 22.1.1
Yes, I tried two different subjects and it was the same.
If you are using the same command for both versions that also means you are using the same working directory for the two versions which is not recommended.
Please try the LTS version again, specifying a new working directory, and make sure that fmripre will not try to use premade Freesurfer outputs (unless you are sure that they came from the appropriate Freesurfer version, which for LTS is 6.0).
I tried this and when using version 22.1.1 everything works, but the distortion correction fails. When using version 20.0.7 the recon-all step fails and says out of space. I don’t know what’s going on as I used the same command.
Thanks for the reply, I tried adding all the flags (--ignore fieldmaps --use-syn-sdc --force-syn) and it was an error:
Node Name: fmriprep_22_1_wf.single_subject_8043_wf.func_preproc_ses_01_task_restpixar1_wf.output_select
File: /EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/derivatives/sub-8043/log/20230216-161922_54cf993a-d7d2-4483-ada2-203a8cfef3aa/crash-20230216-213210-s1474782-output_select-cd53050a-3d23-41bd-8f2f-10ad61a68662.txt
Working Directory: /EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/func_preproc_ses_01_task_restpixar1_wf/output_select
Inputs:
fmap: ['/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/unwarp/clipped_plumb_field.nii.gz']
fmap_coeff: [['/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/bs_filter/fmap_syn0Warp_Hz_trans_coeff000.nii.gz', '/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/bs_filter/fmap_syn0Warp_Hz_trans_coeff001.nii.gz']]
fmap_mask: ['/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/zooms_bmask/sub-8043_ses-01_T1w_corrected_xform_rbrainmask_trans_uint8_trans.nii.gz']
fmap_ref: ['/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/unwarp/clipped_plumb_unwarped.nii.gz']
key: auto_00000
keys: ['auto_00001']
sdc_method: ['FLB ("fieldmap-less", SyN-based)']
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers
self.procs[jobid].run(updatehash=updatehash)
File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
result = self._run_interface(execute=True)
File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
return self._run_command(execute)
File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node output_select.
Traceback:
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 401, in run
outputs = self.aggregate_outputs(runtime)
File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 430, in aggregate_outputs
predicted_outputs = self._list_outputs() # Predictions from _list_outputs
File "/opt/conda/lib/python3.9/site-packages/niworkflows/interfaces/utility.py", line 217, in _list_outputs
index = self.inputs.keys.index(self.inputs.key)
ValueError: 'auto_00000' is not in list
I followed the steps in here. When I executed the first time the autorecon command, the license was not found, then I put it in the correct place and still crashes. See the full log attached. Any clue?
I am a bit confused because I thought the error you were referencing was in 20.2.7 (LTS), but the log says you were using fmriprep 22.1.1. What happens in 20.2.7?
Probably that was my mistake explaining what I did:
Hi,
Thanks for the reply, I tried adding all the flags (–ignore fieldmaps --use-syn-sdc --force-syn) and it was an error:
Node Name: fmriprep_22_1_wf.single_subject_8043_wf.func_preproc_ses_01_task_restpixar1_wf.output_select
File: /EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/derivatives/sub-8043/log/20230216-161922_54cf993a-d7d2-4483-ada2-203a8cfef3aa/crash-20230216-213210-s1474782-output_select-cd53050a-3d23-41bd-8f2f-10ad61a68662.txt
Working Directory: /EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/func_preproc_ses_01_task_restpixar1_wf/output_select
Inputs:
fmap: [’/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/unwarp/clipped_plumb_field.nii.gz’]
fmap_coeff: [[’/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/bs_filter/fmap_syn0Warp_Hz_trans_coeff000.nii.gz’, ‘/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/bs_filter/fmap_syn0Warp_Hz_trans_coeff001.nii.gz’]]
fmap_mask: [’/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/zooms_bmask/sub-8043_ses-01_T1w_corrected_xform_rbrainmask_trans_uint8_trans.nii.gz’]
fmap_ref: [’/EBC/home/mblesa/5_YEARS_ANALYSIS/TEST/fmriprep_22_1_wf/single_subject_8043_wf/fmap_preproc_wf/wf_auto_00001/unwarp/clipped_plumb_unwarped.nii.gz’]
key: auto_00000
keys: [‘auto_00001’]
sdc_method: [‘FLB (“fieldmap-less”, SyN-based)’]
Traceback (most recent call last):
File “/opt/conda/lib/python3.9/site-packages/nipype/pipeline/plugins/multiproc.py”, line 344, in _send_procs_to_workers
self.procs[jobid].run(updatehash=updatehash)
File “/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py”, line 527, in run
result = self._run_interface(execute=True)
File “/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py”, line 645, in _run_interface
return self._run_command(execute)
File “/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py”, line 771, in _run_command
raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node output_select.
Traceback:
Traceback (most recent call last):
File “/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py”, line 401, in run
outputs = self.aggregate_outputs(runtime)
File “/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py”, line 430, in aggregate_outputs
predicted_outputs = self._list_outputs() # Predictions from _list_outputs
File “/opt/conda/lib/python3.9/site-packages/niworkflows/interfaces/utility.py”, line 217, in _list_outputs
index = self.inputs.keys.index(self.inputs.key)
ValueError: ‘auto_00000’ is not in list
Best regards,
Manuel
here I’m indeed using the 22.1.1 when I was trying to follow the advice of @jsein trying to use --ignore fieldmaps --use-syn-sdc --force-syn.
In here:
I’m using the 20.2.7 to try to solve why freesurfer isn’t working. I hope this helps.
If i run versions 20.0.7 or the 21.0.4 I found the same problem. The surface reconstruction fails:
CV of field change: 0.000927078
evaluate_field: posixio.c:210: px_pgin: Assertion `*posp == ((off_t)(-1)) || *posp == lseek(nciop->fd, 0, 1)' failed.
nu_evaluate: crashed while running evaluate_field (termination status=134)
nu_correct: crashed while running nu_evaluate (termination status=65280)
ERROR: nu_correct
Linux EBC33 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
recon-all -s sub-8043 exited with ERRORS at Thu Feb 23 15:23:12 GMT 2023
For more details, see the log file /EBC/home/mblesa/5_YEARS_ANALYSIS/derivatives2/sourcedata/freesurfer/sub-8043/scripts/recon-all.log
To report a problem, see http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
Standard error:
Return code: 1
However, when I run the command with sudo, everything works as expected. This is what I run:
I posted this previously but without the proper permissions on the links. I’m hoping someone has some insight!
I have encountered fmriprep distortion correction issues, most recently with fmriprep 23.1.4. See fmriprepSDC.pdf 1 for some nice pictures and details of the commands.
Additionally, the MRI protocols for both the good dataset and the bad dataset have been uploaded with the fmriprep and mriqc reports and figures for the bad dataset: fmriprep_sdc_reports_protocols.zip
My best guess is that the bad dataset has an orientation problem, or a partial volume problem (top of head and part of cerebellum are missing)…but I’m just guessing here. I’d appreciate any input or ideas. Surely I’m missing something!
I’m struggling with the same issues although, having a bit more luck with synsdc than you report indicates you’re having. I think its worth trying out fmriprep v20.2.7 LTS, which I’m planning on running to.
Relatedly, is there a quantifiable way to decide between these approaches other than visual inspection?
I should have been more clear - as you alluded to, you would use the BOLD ref mask and T1 mask. Maybe a more complicated mutual information approach could be used on the actual bold ref and T1 images, but I’d need to think more about that.