Question about gradient file

Dear AFNI experts,

I have a very basic question related to the gradient file. I’m going to use AFNI for probabilistic tractography and now I’m doing preprocessing of the datasets with TORTOISE V3.0.0. I have some very basic question related to the gradient file.
Two datasets with opposite phase encoding directions (blip_up and blip_down datasets) were collected. Each dataset in addition to b=1000 contains intermediate b-values (b=300 and b=500). In the tutorial page of TORTOISE toolbox it is noted that the gradients have to be scaled to the maximum b-value. I converted the DICOM images with dcm2nii, so that the gradients in the bvec files are of unit length for all b-values: g_x^2 +g_y^2 +g_z^2 =1.

Is it correct,that if the maximum b-value is 1000 then to represent images with b=300 one have to multiply g_x, g_y, g_z gradient components with
sqrt(b=300 / b=1000) ?

Best regrrds,

Hi, Maksym–

So, if you use dcm2nii, you should get one file of bvalues and one file of bvectors; if you put them into 1dDW_Grad_o_Mat++, then you can output the TORTOISE-style b-matrix file. The program is described more here:

An example for your case might be:

1dDW_Grad_o_Mat++                         \
   -in_row_vec   ALL.bvec                 \
   -in_bvals     ALL.bval                 \
   -out_col_matT dwi_matT.dat

More generally, note that there are some specific new tools for going from DICOMs to NIFTI, and up to running TORTOISE (and also FreeSurfer, if so interested), and onward to tensor fitting. These wrap around a lot of functions (fat_proc_*), and try to have some convenient features (keep files ~centered around (0,0,0), keep same orientation, make snapshots of data at most steps, etc.). These are described here, in documentation that is still growing:
and more specifically for converting dicoms:

You should probably update your AFNI to have as recent a version as possible to make sure you have the most uptodate fat_proc_* functions:

@update.afni.binaries -d

Note that, for the TORTOISE parts there, I was using a beta version 3.1 of TORTOISE; the update should be released quite soon (Okan keeps promising…). But using v3.0 and v3.1 are pretty similar.

Feel free to ping back with any questoins on usage/description that isn’t clear-- as I said, the docs are still being full built and ironed out. Feedbacks be useful.


Thank you for detailed response.


Sure thing.

I also forgot to mention that dcm2niix is now distributed within AFNI as “dcm2niix_afni”-- the name is different just to avoid conflicts with any versions you might have on your system already. Thanks again to C. Rorden for making that happen!

And as ever, sometimes funky things can happen converting dicoms to NIFTI, even with the best of tools. So, it helps if you can check a row or two, for example making sure that the b-value comes out correct (esp. if the sequence is “home-designed” on your scanner). You can add a “-out_col_bval_sep FILE” output to get a separate output of just the b-values, one per row in a text file. I also have a gradient viewer program I have been working on; still finishing it so it isn’t in the released distribution, but we can discuss more about that if something looks potentially funny with the grads/matrices.


Thank you for additional information about the data conversion.

I have additional question related to DR_BUDDI module. I’ve successfully preprocessed blip_down and blip_up datasets with DIFPREP command as described on this page:

It is mentioned in the tutorial that DR_BUDDI performs EPI distortion correction and then combines both datasets into one. As I understood, after the correction it performs averaging of 4D images and b-matrix files. In my case the blip_down dataset starts with b=1000 images and blip_up dataset starts with b=300 images. The order of the values in the b-matrix files corresponds to the order of DWI images in 4D nifti files. Does the order of DWI volumes in blip_up and blip_down datasets have to be the same and one have to rearrange the files?


Hi, Maksym-

DR-BUDDI questions should be directed to the TORTOISE folks, but I will have a go at this one:
Yes, the blipup and blipdown sets need to: have the same number of volumes, be acquired with the same grads, and be in the same order. And yes, the order of the rows in the bmatrix text file must correspond to the order of the volumes in the NIFTI dsets.