Qsiprep : how to toggle distortion correction properly with my dataset?

Hello Julien, @mattcieslak and @Steven and thank you very much for your feedback.

I moved the 3D volume into the fmap directory and added the "IntendedFor" key in the associated .json file and that worked like a charm :+1:.

:white_check_mark: Not a single raw_rpe_concat crash
:white_check_mark: I have HTML reports
:white_check_mark: Pre-processed DWI look good
:white_check_mark: DWI are unambiguously corrected for distortions (animation in html report is :ok:)

This is what my dataset looked like :

├── anat
│   ├── sub-VS006_T1w.json
│   └── sub-VS006_T1w.nii.gz
├── dwi
│   ├── sub-VS006_acq-cusp66b3000_dir-ap_dwi.bval
│   ├── sub-VS006_acq-cusp66b3000_dir-ap_dwi.bvec
│   ├── sub-VS006_acq-cusp66b3000_dir-ap_dwi.json
│   └── sub-VS006_acq-cusp66b3000_dir-ap_dwi.nii.gz
├── fmap
│   ├── sub-VS006_acq-cusp66b0_dir-pa_epi.json (with "IntendedFor" : ["dwi/sub-VS006_acq-cusp66b3000_dir-ap_dwi.nii.gz"])
│   ├── sub-VS006_acq-cusp66b0_dir-pa_epi.nii.gz  (3D file, shape = (148,148,90))

:x: I encountered other crashes but they are not related to my original question :

  • 14 raw_gqi crashes (similar bug than reported here)
  • 1 dwi_rpt crash
Node: qsiprep_wf.single_subject_VS056_wf.dwi_preproc_acq_cusp66b3000_dir_ap_wf.fmap_unwarp_report_wf.dwi_rpt
Working directory: /work/qsiprep_wf/single_subject_VS056_wf/dwi_preproc_acq_cusp66b3000_dir_ap_wf/fmap_unwarp_report_wf/dwi_rpt

Node inputs:

after = <undefined>
before = <undefined>
compress_report = auto
out_report = report.svg
wm_seg = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/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 dwi_rpt.

Traceback:
        Traceback (most recent call last):
          File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 399, in run
            runtime = self._post_run_hook(runtime)
          File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/niworkflows/interfaces/registration.py", line 312, in _post_run_hook
            return super(SimpleBeforeAfterRPT, self)._post_run_hook(runtime)
          File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/mixins/reporting.py", line 50, in _post_run_hook
            self._generate_report()
          File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/niworkflows/interfaces/report_base.py", line 59, in _generate_report
            cuts = cuts_from_bbox(contour_nii, cuts=n_cuts)
          File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/niworkflows/viz/utils.py", line 205, in cuts_from_bbox
            start_coords = B.min(0)
          File "/usr/local/miniconda/lib/python3.8/site-packages/numpy/core/_methods.py", line 44, in _amin
            return umr_minimum(a, axis, None, out, keepdims, initial, where)
        ValueError: zero-size array to reduction operation minimum which has no identity
  • 1 gather_inputs crash
ode: qsiprep_wf.single_subject_VS054_wf.dwi_preproc_acq_cusp66b3000_dir_ap_wf.hmc_sdc_wf.gather_inputs
Working directory: /work/qsiprep_wf/single_subject_VS054_wf/dwi_preproc_acq_cusp66b3000_dir_ap_wf/hmc_sdc_wf/gather_inputs

Node inputs:

b0_threshold = 100
bval_file = <undefined>
bvec_file = <undefined>
dwi_file = <undefined>
epi_fmaps = ['/bids_dataset/sub-VS054/fmap/sub-VS054_acq-cusp66b0_dir-pa_epi.nii.gz']
original_files = <undefined>
raw_image_sdc = True
topup_max_b0s_per_spec = 3
topup_requested = True

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/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 gather_inputs.

Traceback:
        Traceback (most recent call last):
          File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 398, in run
            runtime = self._run_interface(runtime)
          File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/interfaces/eddy.py", line 76, in _run_interface
            get_best_b0_topup_inputs_from(
          File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/interfaces/epi_fmap.py", line 212, in get_best_b0_topup_inputs_from
            raise Exception("Unable to run TOPUP: not enough distortion groups. "
        Exception: Unable to run TOPUP: not enough distortion groups. Check "IntendedFor" fields or consider using --ignore fieldmaps.