Dimension mismatch when using fieldmaps in qsiprep

Summary of what happened:

I’m trying to preprocess some data with qsiprep and there seem to be some issues with the .hmc_sdc_wf.sdc_wf.sdc_unwarp_wf.fmap2ref_apply step, specifically the call to antsApplyTransforms where the dimensionality (3) does not match the dimensions of the reference image (4). The field maps we are using are case 3. I’m not sure if there’s some flag I should set during my call to qsiprep that I’m missing or if there’s something else going on. Any advice is most welcome!

Command used (and if a helper script was used, a link to the helper script or the command generated):

`

singularity run --cleanenv /<path_to_image>/qsiprep_unstable.sif \
/<path-to-input> \
/<path-to-input>/derivatives participant --participant-label sub-<participant_id> \
--prefer_dedicated_fmaps \
-w  /path/to/work \
--output-resolution 1.5

Version:

qsiprep version: 0.17.0

Environment (Docker, Singularity, custom installation):

Singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

Data formatted according to BIDS standard

Relevant log outputs (up to 20 lines):

    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node fmap2ref_apply.

Cmdline:
	antsApplyTransforms --default-value 0 --dimensionality 3 --float 1 
    --input /<work_dir>/hmc_sdc_wf/sdc_wf/fmap_wf/applymsk/<subject_id>_acq-60_fieldmap_ras_rad_unwrapped_hz_filt_demean_maths_masked.nii.gz 
    --interpolation BSpline 
    --output <subject_id>_acq-60_fieldmap_ras_rad_unwrapped_hz_filt_demean_maths_masked_trans.nii.gz
    --reference-image <work_dir>/dwi_preproc_acq_60_wf/hmc_sdc_wf/b0_ref_to_lps/topup_imain_LPS.nii.gz
    --transform <work_dir>/dwi_preproc_acq_60_wf/hmc_sdc_wf/sdc_wf/sdc_unwarp_wf/fmap2ref_reg/transformComposite.h5
Stdout:

Stderr:

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 106, in _post_run_hook
	    return super(ANTSApplyTransformsRPT, 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 61, in _generate_report
	    cuts = cuts_from_bbox(mask_nii, cuts=n_cuts)
	  File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/niworkflows/viz/utils.py", line 215, in cuts_from_bbox
	    ras_coords.append(apply_affine(mask_nii.affine, cross).tolist())
	  File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/affines.py", line 97, in apply_affine
	    pts = pts @ rzs.T + trans[None, :]
	ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 3 is different from 4)

Hi @earoy were you able to figure this out? I have never actually seen data with case 3 and the code here is from an super old version of fmriprep before sdcflows existed.

Hi @mattcieslak, thanks for following up! I ended up using an older version of qsiprep (qsiprep-0.16.1), which oddly ran fine and performed the sdc as expected.

Hello @mattcieslak, I am getting exactly the same error when trying to preprocess dwi data with 2 phase maps or a phasediff map through qsiprep (v0.19.1, docker) using datasets that are bids valid. It results in no dwi output folder.

Relatedly, would it be possible to provide example datasets for these use cases (#1 and #2 as defined here: Magnetic Resonance Imaging - Brain Imaging Data Structure v1.8.0)?

Hi @jhau and welcome to neurostars!

You can find examples of fieldmaps on datasets in openneuro: OpenNeuro.

For your case you should open a new issue using the Software Support category and provide all of the information in the prepopulated template.

Best,
Steven

Thanks @Steven for pointing me to that!

Yes, I’ll open a new issue.