qsiprep
qsiprep copied to clipboard
"No b=0 volumes present" when bvals are under b0 threshold but not 0
Summary
I am receiving the following error from dwibiascorrect when the lowest bvals are not 0, but below the b0 threshold:
dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3
dwiextract: [ERROR] No b=0 volumes present
mrmath: [ERROR] no filename supplied to standard input (broken pipe?)
mrmath: [ERROR] error opening image "-"
In this case the lowest bvals are 10. Explicitly setting --b0-threshold to 100 or using --no-b0-harmonization does not resolve the error, but manually changing the 10s to 0s in *.bval does resolve the error.
Additional details
- QSIPrep version: 0.20.0
- Docker version: 25.0.3
Reproducing the bug
Terminal command (without full paths):
docker run -ti --rm \
-v [bids_path]:/data \
-v [bids_path]/derivatives:/out \
-v [bids_path]/fs_license.txt:/opt/freesurfer/license.txt \
-v [work_path]:/work \
pennbbl/qsiprep:0.20.0 \
/data /out participant \
--fs-license-file /opt/freesurfer/license.txt \
--output-resolution 1.25 \
-w /work
These are the bvals:
10 10 1490 2990 1490 3010 1500 2990 1495 3005 1490 3000 1490 2985 1495 2985 1500 10 3005 1490 2995 1500 3000 1500 3005 1490 2980 1510 2990 1500 3000 1490 3005 10 1510 3000 1490 2980 1500 2990 1505 3000 1505 2985 1495 3000 1500 3000 1485 10 3005 1500 2990 1505 2995 1495 2985 1490 2995 1500 3000 1500 2980 1495 2985 10 1510 3005 1495 3000 1505 3010 1495 3005 1490 2995 1490 3000 1505 3000 1495 10 2985 1500 2985 1490 2995 1495 2995 1490 2980 1500 3000 1490 3005 1495 2990 1500 3005
Great catch! thanks for reporting. Should be an easy fix
@teresamg do you have the error message from this? I'm wondering where this dwiextract is being run
Here is the full output from the error (sorry for the formatting):
240214-07:41:17,803 nipype.workflow INFO: [Node] Executing "biascorr" <qsiprep.interfaces.mrtrix.DWIBiasCorrect> 240214-07:41:28,197 nipype.interface INFO: Generating denoising visual report 240214-07:41:28,208 nipype.workflow INFO: [Node] Finished "biascorr", elapsed time 10.394761s. 240214-07:41:28,208 nipype.workflow WARNING: Storing result file without outputs 240214-07:41:28,209 nipype.workflow WARNING: [Node] Error on "qsiprep_wf.single_subject_12121_wf.dwi_finalize_ses_22912_run_01_wf.final_denoise_wf.biascorr" (/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr) 240214-07:41:29,725 nipype.workflow ERROR: Node biascorr failed to run on host a505d7ba3957. 240214-07:41:29,747 nipype.workflow ERROR: Saving crash info to /out/qsiprep/sub-12121/log/20240213-220522_857a8bc1-0722-4da7-b568-8d90117f4d22/crash-20240214-074129-root-biascorr-6993fc78-3df9-4c68-9979-27eae22f006d.txt Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.10/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 biascorr. Cmdline: dwibiascorrect ants -ants.b [150,3] -ants.c [200x200,1e-6] -bias vol0000_trans_merged_bias.nii.gz -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval -mask /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii vol0000_trans_merged_N4.nii.gz Stdout: Stderr: dwibiascorrect: dwibiascorrect: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information. dwibiascorrect: dwibiascorrect: Generated scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/in.mif -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/mask.mif -datatype bit dwibiascorrect: Changing to scratch directory (/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/) Command: dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 dwibiascorrect: [ERROR] dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 (ants.py:64) dwibiascorrect: [ERROR] Information from failed command: dwibiascorrect: dwiextract: [ERROR] No b=0 volumes present mrmath: [ERROR] no filename supplied to standard input (broken pipe?) mrmath: [ERROR] error opening image "-" dwibiascorrect: dwibiascorrect: [ERROR] For debugging, inspect contents of scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ dwibiascorrect: Scratch directory retained; location: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run runtime = self._post_run_hook(runtime) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook self._generate_report() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/denoise.py", line 68, in _generate_report input_dwi, denoised_nii, field_nii = self._get_plotting_images() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/mrtrix.py", line 1188, in _get_plotting_images denoised_nii = load_img(ref_name) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/image/image.py", line 1334, in load_img return check_niimg(img, wildcards=wildcards, dtype=dtype) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/_utils/niimg_conversions.py", line 306, in check_niimg raise ValueError(f"File not found: '{niimg}'") ValueError: File not found: '/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/vol0000_trans_merged_N4.nii.gz' QSIPrep failed: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.10/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 biascorr. Cmdline: dwibiascorrect ants -ants.b [150,3] -ants.c [200x200,1e-6] -bias vol0000_trans_merged_bias.nii.gz -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval -mask /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii vol0000_trans_merged_N4.nii.gz Stdout: Stderr: dwibiascorrect: dwibiascorrect: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information. dwibiascorrect: dwibiascorrect: Generated scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/in.mif -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/mask.mif -datatype bit dwibiascorrect: Changing to scratch directory (/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/) Command: dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 dwibiascorrect: [ERROR] dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 (ants.py:64) dwibiascorrect: [ERROR] Information from failed command: dwibiascorrect: dwiextract: [ERROR] No b=0 volumes present mrmath: [ERROR] no filename supplied to standard input (broken pipe?) mrmath: [ERROR] error opening image "-" dwibiascorrect: dwibiascorrect: [ERROR] For debugging, inspect contents of scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ dwibiascorrect: Scratch directory retained; location: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run runtime = self._post_run_hook(runtime) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook self._generate_report() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/denoise.py", line 68, in _generate_report input_dwi, denoised_nii, field_nii = self._get_plotting_images() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/mrtrix.py", line 1188, in _get_plotting_images denoised_nii = load_img(ref_name) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/image/image.py", line 1334, in load_img return check_niimg(img, wildcards=wildcards, dtype=dtype) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/_utils/niimg_conversions.py", line 306, in check_niimg raise ValueError(f"File not found: '{niimg}'") ValueError: File not found: '/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/vol0000_trans_merged_N4.nii.gz' Traceback (most recent call last): File "/usr/local/miniconda/bin/qsiprep", line 8, in <module> sys.exit(main()) File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/cli/run.py", line 690, in main qsiprep_wf.run(**plugin_settings) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run runner.run(execgraph, updatehash=updatehash, config=self.config) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/plugins/base.py", line 178, in run self._clean_queue(jobid, graph, result=result) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/plugins/base.py", line 256, in _clean_queue raise RuntimeError("".join(result["traceback"])) RuntimeError: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.10/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 biascorr. Cmdline: dwibiascorrect ants -ants.b [150,3] -ants.c [200x200,1e-6] -bias vol0000_trans_merged_bias.nii.gz -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval -mask /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii vol0000_trans_merged_N4.nii.gz Stdout: Stderr: dwibiascorrect: dwibiascorrect: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information. dwibiascorrect: dwibiascorrect: Generated scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/merge/vol0000_trans_merged.nii /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/in.mif -fslgrad /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bvec /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/rotate_gradients/rotated.bval Command: mrconvert /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/transform_dwis_t1/final_b0_ref/synthstrip_wf/mask_to_original_grid/vol0000_trans_merged_b0_series_mean_trans_mask_trans.nii.gz /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/mask.mif -datatype bit dwibiascorrect: Changing to scratch directory (/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/) Command: dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 dwibiascorrect: [ERROR] dwiextract in.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3 (ants.py:64) dwibiascorrect: [ERROR] Information from failed command: dwibiascorrect: dwiextract: [ERROR] No b=0 volumes present mrmath: [ERROR] no filename supplied to standard input (broken pipe?) mrmath: [ERROR] error opening image "-" dwibiascorrect: dwibiascorrect: [ERROR] For debugging, inspect contents of scratch directory: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ dwibiascorrect: Scratch directory retained; location: /tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/dwibiascorrect-tmp-E4MTLZ/ Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run runtime = self._post_run_hook(runtime) File "/usr/local/miniconda/lib/python3.10/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook self._generate_report() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/denoise.py", line 68, in _generate_report input_dwi, denoised_nii, field_nii = self._get_plotting_images() File "/usr/local/miniconda/lib/python3.10/site-packages/qsiprep/interfaces/mrtrix.py", line 1188, in _get_plotting_images denoised_nii = load_img(ref_name) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/image/image.py", line 1334, in load_img return check_niimg(img, wildcards=wildcards, dtype=dtype) File "/usr/local/miniconda/lib/python3.10/site-packages/nilearn/_utils/niimg_conversions.py", line 306, in check_niimg raise ValueError(f"File not found: '{niimg}'") ValueError: File not found: '/tmp/work/qsiprep_wf/single_subject_12121_wf/dwi_finalize_ses_22912_run_01_wf/final_denoise_wf/biascorr/vol0000_trans_merged_N4.nii.gz'
could you try pennbbl/qsiprep:unstable?
Same error
I tried adding a -config BZeroThreshold to the dwibiascorrect commandline, but this appears to not have been propagated into the commands run by dwibiascorrect. You can create a mrtrix config file and mount it into the container when you run qsiprep. There are some relevant threads in the mrtrix forum:
- https://community.mrtrix.org/t/no-bzero-detected-in-hcp-s1200-7t-data/1993
- https://community.mrtrix.org/t/b15-instead-of-b0/1959
In the long run I think qsiprep will have to write the mrtrix config file into the derivatives and set an environment variable to point to it
Okay I built a .sif, echoed "BZeroThreshold: 100" to ~/.mrtrix.conf inside of it, and it ran without errors!
Any chance it would help to change DWIBiasCorrectInputSpec in qsiprep/interfaces/mrtrix.py from
bzero_max = traits.Int(
argstr="-config BZeroThreshold %d",
desc="Maximum b-value that can be considered a b=0",
)
to
bzero_max = traits.Int(
default_value=100,
argstr="-config BZeroThreshold %d",
desc="Maximum b-value that can be considered a b=0",
usedefault=True,
)
or workflow in qsiprep/config.py from
b0_threshold = None
to
b0_threshold = 100?
Should there be another use somewhere of config.workflow.b0_threshold like I see throughout qsiprep/workflows/dwi/merge.py? We're still having trouble finding a consistent workaround for everyone.