Running eddy_quad on eddy outputs with LSR resampling

Summary of what happened:

Hi all!

I’m trying to run the eddy_quad command on the outputs of eddy preprocessing with --resamp=lsr option, and was wondering if anyone has done this before. My dwi data consists of two equivalent runs acquired in opposite phase-encoding directions.

Since there’s only half the number of volumes after resampling, I try to trick the program a bit by providing new acqparams.txt, index.txt and bvals files by just cutting the originals in half:

nlines=$(wc -l < acqparams.txt)
head -n $(( nlines/2 )) acqparams.txt > acqparams_for-lsr.txt

nlines=$(wc -l < index.txt)
head -n $(( nlines/2 )) index.txt > index_for-lsr.txt

nlines=$(wc -l < bvals)
head -n $(( nlines/2 )) bvals > bvals_for-lsr

Now, when I try to run eddy_quad, I still get a dimensionality error. I guess the program detects some other files (eddy RMS file still has 2N lines, s2v…) in the eddy directory that aren’t adjusted for the resampling.

eddy_quad \
         eddy/eddy \
         --eddyIdx=index_for-lsr.txt \
         --eddyParams=acqparams_for-lsr.txt \
         --mask=$brainmask \
         --bvals=bvals_for-lsr \
         --field=$topup_field \
         --output=$qc_dir \

Output:

found b-shell of 20 orientations with b-value 0.000000
found b-shell of 120 orientations with b-value 2000.000000
found b-shell of 70 orientations with b-value 1000.000000
RMS movement estimates file detected
Eddy parameters file detected
Eddy s2v movement file detected
Warning: slspec or json file not provided for single-band data. Assuming interleaved acquisition strategy.
Outliers output files detected

Traceback (most recent call last):
  File "/usr/local/fsl/bin/eddy_quad", line 52, in <module>
    main(args.eddyBase, args.eddyIdx, args.eddyParams, args.mask, args.bvals, args.bvecs, args.output_dir, args.field, args.slspec, args.json, args.verbose)
  File "/usr/local/fsl/lib/python3.11/site-packages/eddy_qc/QUAD/quad.py", line 330, in main
    eddyOutput['b_ol'][i] = 100*np.count_nonzero(eddyOutput['olMap'][data['bvals'] == data['unique_bvals'][i], :])/(data['bvals_dirs'][i]*data['vol_size'][2])
                                                 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: boolean index did not match indexed array along dimension 0; dimension is 420 but corresponding boolean dimension is 210

Would anyone now of a way to get eddy_quad to run on these data? Or, maybe there’s a better way to run eddy/do some postprocessing? It’s not strictly necessary of course, but I do find the report quite useful.

Thank you!

Best,
Roman

Hi @romanbelenya , the trick I use is the oppposite: I give eddy_quad twice the number of volumes.

for instance:

if [ $mode = "full" ] # which means I used resamp='lsr' for eddy
then
   mv $out_dir/topup/topup_eddy.nii.gz $out_dir/topup/topup_eddy_lsr.nii.gz
    fslmerge -t $out_dir/topup/topup_eddy.nii.gz $out_dir/topup/topup_eddy_lsr.nii.gz $out_dir/topup/topup_eddy_lsr.nii.gz
fi
rm -r ${out_dir}/topup/quad

eddy_quad ${out_dir}/topup/topup_eddy -idx ${out_dir}/topup/acq_index -par ${out_dir}/topup/acq_parameters -m ${out_dir}/topup/topup_b0_mean_brain_mask.nii.gz -b ${out_dir}/topup/topup_bval -o ${out_dir}/topup/quad -g ${out_dir}/topup/topup_bvec -f ${out_dir}/topup/topup_fieldmap.nii.gz -s "$out_dir/topup/slspec_TOLD.txt"

Hi @jsein, thanks for the suggestion! A quite clean trick indeed at it also worked well with my data :slight_smile: