Query regarding qsiprep

Hi all,

I would like to use qsiprep to preprocess DTI data that I have acquired. I have been able to run it successfully on my data without any errors. However, I notice that the b-vectors after preprocessing seem to be flipped along the x-dimension. This results in incorrect FOD estimations. I was wondering if there is a way to correct this, or if any parameters need to be tuned to rectify this issue.

Thank you for your help.


Hi Varsha,

This is a pretty common problem and does not represent an error in your data or in processing. A lot of data (especially coming from Siemens scanners I believe) have flipped gradients. There are a few things you can do to correct this.

  1. Flip the b-vector using 1dDW_Grad_o_Mat from AFNI. Here is some code for that (change grad_rows to grad_columns if your bvectors are in a column format in your text file.

    1dDW_Grad_o_Mat \
    -in_grad_rows bvec.txt \
    -out_grad_rows bvec_flip_x.txt \
    -flip_x \

  2. If you are using CSD peaks, you can flip those (TractSeg/flip_peaks at 429417c610649debef204a3332641ec74709abb5 · MIC-DKFZ/TractSeg · GitHub

Don’t do both of these, or you will end up back at the incorrect orientation. Hope this helps.


Hi Varsha,

If you’re reconstructing preprocessed data from QSIPrep in mrtrix, you should use the .b file instead of the .bval and .bvec. The .b file is in mrtrix format and is interpreted correctly by mrtrix with the preprocessed image. The bval and bvec files are correctly oriented when used in DIPY and DSI Studio.