How to correct DWI EPI distortion with only one b value PA volume?

Hi Paul,

We collected multi-b-value AP volumes but only one-b-value, equals to that of the first AP volume, PA volume, is it possible to use this PA volume to correct EPI distortion? This can not be processed by fat_proc_convert_dcm_dwis.


Hi, 2086–

So, fat_proc_convert_dcm_dwis is for converting DICOM files to NIFTI. To do the processing step of correcting EPI distortions (along with motion correction and eddy currents), we recommend using the TORTOISE tool, which is also freely available from the NIH:

Their preference is typically to have fully matched AP and PA acquisitions, but I believe you can run TORTOISE just using a single phase encode in one set. I will PM you the email addresses of the TORTOISE folks to query about the specifics.


Hi Paul,

Thank you very much!

I am going through your FATCAT tutorials, and I arrived at this step now.

I have another question, how to judge one volume is good or bad? The attachment is one example of my data, which volume is bad?

Besides, their b values are: 5.000 185.000 185.000 185.000 375.000 375.000 370.000 375.000 375.000 370.000 560.000 560.000 560.000 560.000 750.000 745.000 750.000 940.000 935.000 935.000 935.000 935.000 930.000 935.000 935.000 935.000 930.000 935.000 935.000 1125.000 1125.000 1120.000 1120.000 1120.000 1125.000 1120.000 1120.001 1120.000 1125.000 1120.000 1125.000 1500.000 1495.000 1495.000 1495.000 1500.000 1495.000 1685.000 1685.000 1685.000 1685.000 1680.000 1685.000 1685.000 1680.000 1679.999 1685.000 1684.999 1680.001 1685.000 1685.000 1685.000 1875.000 1875.001 1875.000 1869.999 1869.999 1865.001 1870.000 1874.999 1875.000 1865.000 1874.999 1870.001 2060.000 2060.000 2060.000 2055.000 2055.000 2060.001 2060.001 2055.001 2054.999 2060.000 2060.000 2060.000 2245.000 2245.000 2245.001 2245.000 2440.001 2434.999 2435.001 2429.999 2429.999 2429.999 2429.999 2435.000 2434.999 2430.000 2435.000 2430.001 2624.999 2620.001 2620.000 2625.000 2619.999 2620.000 2620.000 2625.000 2620.000 2615.000 2620.000 2620.001 2620.002 2615.000 2619.999 2620.000 2619.999 2614.999 2615.001 2625.000 2620.001 2620.001 2620.001 2624.999 2999.999 2990.000 3000.001.

It is very different from your example, 3 b=0 + 30 others with same b value. And there is a no-reference-gradients-found warning when convert DICOMs to NIFTI file. What is the consequences of no-reference gradients? Are all the 129 b-value volume needed for latter process?

I am a green hand in this field, sorry if my questions are childish. Thank you much.


Hi, 2086-

That question of “how to judge one volume is good or bad” is decidedly not a childish one! It is also one that does not have a single answer, and different people will tell you different things, no doubt…

In this case, my use of “bad” volume is to suggest looking for “obviously” bad volumes: ones that contain signal distortion so strong as likely not be usable. These include large motion effects, which would exhibit large bright-dark variations in most sagittal images (because of being acquired in interleaved fashion-- slices #0, 2, 4, 6, 8,… etc. and then #1, 3, 5, 7, … etc.). Geometrical distortions due to this might also be apparent. Dropout slices can also be caused by motion, and basically exhibit as nearly blank (axial, for most acquisitions) slices. I don’t really see either such distortion here.

Note that you have pretty large b-values-- up to 3000 s/mm^2. That looks like the data were acquired for HARDI modeling, possibly? You can see that for higher b-values, the data looks less defined and noisier (that is not some issue in your particular data, that is an inherent feature of DWIs acquired with large bvalues). If you just want to do tensor modeling, you might not need all those high bvalues in your tensor reconstruction-- that is something to decide on your/your group’s end, though.

One thing I do note that is a bit odd about those volumes is there is a noticeably and uniformly dimmer band in the superior slices of the FOV. This is most apparent in teh lower b-value volumes at the top. I guess this is a scanner property, and probably not a super desirable one. I emailed one of our local DTI acquisition experts here for suggestions about this-- so hopefully more about this later. It might not be a torpedo for your tensor modeling, as the subject didn’t appear to move much and therefore the relative brightness might be constant for a given voxel across time, and therefore tensor fitting can be done consistently. However, it is probably good to check out.

Re. the “no reference gradient” warning (probably just a warning? can you copy+paste the exact message?) is because the program looks for b=0 as a reference. In your case, you have essentially that with the b=5 s/mm^2 acquisition. I don’t think it should really affect your analysis, but you might see messages about that. Note for future reference, acquiring several reference volumes (b~ 0-5 s/mm^2) is highly recommended. If you only get one and the subject moves during it, your whole acquisition is essentially toast. The reference DWI volumes are really important for tensor modeling so have 4-5 would be a veeery good thing (and even more if you have very long acquisition).


Hi Paul,

Thank you for your detailed answers. I know how to pick out bad volumes now.

I am still not clear about the use of these volumes. The propose of my project is to compare the structure connections between fROIs of two group of people. So are all these volumes should be used? What is the effect of take all volumes, long processing time? And what information can be get from different range of b values?

Here is the warning, as you mentioned above, b=0 not found.

+ WARNING: NO reference gradients/values found.
++ Number of ref vec/mats (b<0.000001): 0
   Number of diffusion weighted  vec/mats: 129
++ Keeping all vec/mats.
++ Output dims to be: 129 x 3
++ DONE with grad/matr. Check output file 'tmpdir_001/fff.cvec'

And thanks for your suggestion to acquire repeated reference volumes. As you can see from the attached image, this patient did move when scanning the reference volume. Do you have any suggestions on processing this kind of data?

As for the dimmer band problem, I will PM you with more details.

Thank you again,


Screenshot from 2018-05-04 16-07-04.png

Hi, 2086–

Yes, that warning is really just a warning so that you know about the data. Always good to know what goes in to the processing, esp. if it might be problematic. Again, you have a b=5 s/mm^2 DWI for your reference-- that effectively has no diffusion info, so that is fine.

But yes, acquisitions really should have several reference volumes with b~0. I don’t think that subject with motion in the only reference volume can be used; there are several other volumes with kind-of-low b-values, but I don’t think it would be low enough; there is probably too much signal distortion in that subject’s b0 to use it, and then those tensor fits would likely be inherently different than others in your group.

The effect of taking all those volumes-- even the very high bvalue ones-- would be to: 1) increase processing time and disk space usage (which is inconvenient, but not inherently a reason not to include them); and 2) probably include some noise along with signal in your tensor fitting from those volumes (which would provide an argument for not including them), in different parts of the brain (the noise floor gets reached differently in different parts of the brain and using different gradient directions, because the magnitude of diffusion would be different). In the AFNI nonlinear tensor fitting, we use a reweighting scheme, and likely the contribution of those volumes would be relatively low. In the TORTOISE RESTORE/iRESTORE tensor fittings, likely contributions from those volumes would also be downweighted. So, you might want to consider/discuss not include b-values greater than, say 1500 s/mm^2. It is a bit of judgment call.


Hi Paul,

Both DTI or HARDI model can be choosed for my data, right? If using DTI model, these high-b volumes are not recommend to use, right?

Actually, I followed your FATCAT tutorial to the end with my data, b>1500 volumes excluded, using DTI model.
Here is the result of one subject, does it looks right?

Thank you,


Here is the answer from TORTOISE folks if someone else needs:

Thank you

Hi Paul,

How to adapt your FATCAT tutorial for HARDI modelling?

I did some try, but not worked very well.

My adaptation start at the “Post-preproc, I: tensor estimation and checking” step.
As the number of my PA volumes is not equal to that of AP, the “ap_proc_DRBUDDI_up_final.nii” is the final output from DR_BUDDI.

# HARDI estimates with DSI studio, with flip chosen from @GradFlipTest
# Get a column of b-value information for DTI-Studio
1dDW_Grad_o_Mat++                                                                           \
        -in_col_matT    $itort/ap_proc_DRBUDDI_up_final.bmtxt       \
        -unit_mag_out                                                                                 \
        -flip_z         $my_flip                                                                        \
        -out_col_bval                                                                                   \
        -out_col_vec    $itort/ap_proc_DRBUDDI_up_final_b_table.txt

After that, I run “do_dsistudio.tcsh” script at FATCAT_DEMO/HARDI with ap_proc_DRBUDDI_up_final.nii.gz+b_table.txt, and got GQI_gfa.nii.gz.

However, the orient of the GFA is different from other dataset mapped to dwi_dwi. This problem can be seen in FATCAT_DEMO/GQI_GFA.nii.gz too:

R-to-L extent:  -254.000 [R] -to-    -0.000     -step-     2.000 mm [128 voxels]
R-to-L extent:  -129.041 [R] -to-   124.959 [L] -step-     2.000 mm [128 voxels]

Does this affects the tracking results? (But this do affects viewing.)
I tried 3dresample the GQI_GFA to dwi, but the volume still located at the corner.
Or should I map all other dataset to GQI_GFA space?

I tired to ignore this problem, and run 3dTrackID with the uncertainty calced like “Do_07_RUNhardi_uncertainty_est.tcsh” (And is there any new uncertainty estimator?):

3dTrackID                                               	            \
        -mode               PROB                            	    \
        -hardi_gfa          GQI_gfa.nii.gz                          \
        -hardi_dirs         GQI_dirs.nii.gz                         \
        -netrois            fmri_msk_${subj}_GMI.nii.gz    \
        -uncert             Simple_Uncert.nii.gz                  \
        -unc_min_FA         0.0015                                  \
        -dump_rois          AFNI                                       \
        -alg_Thresh_FA      0.04                             	    \
        -alg_Thresh_Frac    0.011                             	    \
        -alg_Nseed_Vox      5                               	    \
        -alg_Nmonte         1000                            	    \
        -prefix             fPROB_${subj}              	            \
        -nifti -write_opts -overwrite -echo_edu

As the picture see, all negative.

Thank you

Just eyeballing the tracking results, it looks good, yup. The corpus callosum looks uniformly red connecting the hemispheres, the cingulate bundles are green (running anterior <-> posterior); the cortico-cortical fibers look to have appropriate colors (=directionality) at their endpoints; there looks to be whole brain coverage.

While looking at that tractographic image, if you go to the SUMA control panel (hover the mouse over the SUMA window and hit ctrl+s, to open it if it isn’t already), then you can right click anywhere on the tracts to get the control panel for tracts, and in the lower left corner is a button called “masks”-- hit it once/twice and a faint ball will appear in the tracts, so that only tracts passing through it are shown. While it is translucent/dotted, it is stationary; if you right-click on it, you can turn it into “mobile mode” (-> its appearance will change and it will look like a geodesic pattern of connected triangles); now, wherever you rightclick on the tracts, the mask-ball will move, and you can look at more localized patterns to make sure you see things like: cortical-spinal tracts, genu/splenium, etc.


There is no new uncertainty estimator for this (unfortunately).

Yes, it seems that DSI Studio ignores the header information of location, resetting the corner of the volume to (0,0,0) rather than keeping the origin.

R-to-L extent:  -254.000 [R] -to-    -0.000     -step-     2.000 mm [128 voxels]
R-to-L extent:  -129.041 [R] -to-   124.959 [L] -step-     2.000 mm [128 voxels]

To fix this, you can resample+refit the datasets output by DSI Studio:


set refset    = [whatever is a reference data set for you with correct grid/location/etc., such as your *GMI* file]
set all_dsis  = `ls GQI*nii.gz`  # or whatever your DSI-Studio-named files are-- take all of them and process in loop below

# ref set's orient
set refo      = `3dinfo -orient $refset`

foreach ff ( $all_dsis )

    echo "\n\n+++ Proc'ing dset: $ff\n\n"

    set gg   = $ff:gas/.nii.gz//
    set fout = ${gg}_${refo}.nii.gz

    # new orient for dset (this information is initially *correct* in
    # the input dset as it is, so we change both BRIK+HEAD info);
    # create a new dset whose name reflects the new orient
    3dresample             \
        -orient $refo      \
        -input  $ff        \
        -prefix $fout

    # now change origin of the dset (we are saying this information is
    # *incorrect* in the dset, so we just change the header; the
    # distiction may be a bit trivial, since the origin is juuust info
    # in the header, but there you have it); *overwrites* input dset.
    3drefit \
        -duporigin $refset \

After that, your dsets overlap appropriately (make sure you verify with 3dinfo/visually!)


Thanks, that’s useful to know.


Hi Paul,

Thank you. Resample+refit works well, but the tracking results are bad for HARDI model.

You can see the full brain MINIP tracking results from the first attachment(Left: DTI model, right, HARDI model. Upper, all DWI volumes are used, lower, b>1500 volumes are excluded. Their tracking commands are listed. All these data are from the same subject.).

There are no structure connection between fmri rois either in HARDI model(the second column of the second attachment), though that can be found from DTI model.

So, how to improve the HARDI model results?

Besides that, when using all these volumes, the structure connection calced from different tracking model(the second picture is too width too show all tracking results, it need to be downloaded to see completely) for DTI model are more robust, though it REALLY took a long time.

Thank you,


Did you try just running deterministic (“-mode DET”) tracking first? As noted in the help/scripts, probabilistic tracking methods for HARDI data rely on very heuristic uncertainty measures at the moment.

Also, I am not sure what a recommended threshold value for GFA would be-- basically, voxels with GFA values above that threshold are considered in the WM, and therefore tracked, while those below it are excluded from tracking. In the DTI case of having just FA, for adult humans a threshold value of FA>0.2 is typically taken across the field as a good proxy for WM; in human infants, FA>0.1 is often used. For GFA, I am not sure if such a threshold applies-- that is worth investigating in papers that track that kind of HARDI reconstruction method. You can investigate what would be a good value in your data by adjusting the threshold and seeing what looks like a good WM map.