Qsiprep - Distortion correction not applied to eddy_corrected image?

Summary of what happened:

Hello!

I am running qsiprep preprocessing on dwi data acquired with reversed phase-encoding directions (AP and PA), each with 93 diffusion directions. It completes successfully. My topup results look good (are corrected for susceptibility distortions), but my eddy results don’t appear to be corrected for these distortions, and likely neither the eddy current distortions. See screenshots below.

I have tried running qsiprep both with and without the --distortion-group-merge flag (set to average) and get similar results. What am I missing?

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

docker run -ti --rm --gpus all \
	-v /usr/local/freesurfer/7.4.1/license.txt:/opt/freesurfer/license.txt:ro \
	-v $bids_dir:/data:ro \
	-v $eddy_config_file:/sngl/eddy/eddy_config.json:ro \
	-v $out_dir:/out \
	-v $out_dir:/scratch \
	pennbbl/qsiprep:0.20.0 /data /out participant \
	--eddy-config /sngl/eddy/eddy_config.json \
	--output-resolution $res --pepolar-method TOPUP \
	--distortion-group-merge average \
	--bids-database-dir $bids_dir \
	-w /scratch 

Version:

qsiprep 0.20.0

Environment (Docker, Singularity / Apptainer, custom installation):

Docker

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

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

PASTE LOG OUTPUT HERE

Screenshots / relevant information:

eddy_corrected image from the qsiprep_wf/single_subject_0001_wf/dwi_preproc_wf/hmc_sdc_wf/eddy directory:

topup_imain_corrected image from the qsiprep_wf/single_subject_0001_wf/dwi_preproc_wf/hmc_sdc_wf/topup directory:


Hi @jhau,

It would probably be better to look at the quality of the final preprocessed images, including screenshots in the html.

Best,
Steven

Hi @Steven,

From the html, here is a screenshot of the topup results:

and a screenshot of the b0 ref image before correction, which already looks odd - the after image is identical just cropped to the blue outline:

Thanks for your help.

Best,
Jan

It looks to me like there might be a problem with the PhaseEncodingDirection in the sidecars. Are there separate AP/PA images in your fmap directory? It’s possible that topup is working, but the flipped PE Direction for the dwi images is causing the wrong correction to be applied during eddy.

Hi @mattcieslak,
I have my dir-AP and dir-PA images, labelled correspondingly, in the dwi directory. No fmap directory as I don’t think that’s needed in this case, correct? The json files show the PhaseEncodingDirection field to be j- for the AP and j for the PA images, which I believe are correct.

As an additional check, I tried swapping the AP and PA labels (i.e., I renamed the AP nii/bval/bvec/json files to PA and PA nii/bval/bvec/json files to AP) and reran qsiprep. I get the same results as before - the topup results look good, but the b0 ref is not uncorrected for distortions. Based on this, I don’t think the results are due to my PE Directions being flipped. Any other ideas?