dki-questions > bvecs extracted from bmatrix or grad table
Showing 1-6 of 6 posts
Display:
Results per page:
Nov 20, 2016  08:11 PM | Ehsan Misaghi - University of Alberta
bvecs extracted from bmatrix or grad table
Hello everyone,

I have a DKI dataset from a 4.7T Varian Inova scanner that unfortunately does not export dicom files, but rather nifti files. The nifti files are accompanied by a bmatrix file (for use with ExploreDTI) and a gradient table file. I used MATLAB to convert the bmatrix back into bvecs and bvals. I then compared the gradient table file (organized in the bvecs format) with the bvecs file and they don't look alike! I have attached a sample of the two files from the same subject. Which one of these files should I use with DKE or any other DKI processing software package for that matter? (BTW, I know I have to use only one b0 image and only one set of gradient directions even if I have two non-zero b-values. Also, as far as I know, there is no way I can get dicom files from the scanner.)
Attachment: bvecs.zip
Nov 21, 2016  02:11 PM | Emilie McKinnon - MUSC
RE: bvecs extracted from bmatrix or grad table
Dear Ehsan, 

Every processing software works a little different. DKE expects the gradient table to be structured as a Ndir x 3 matrix. Specifically, this is a matrix with 3 columns and the number of rows equal to the number of gradient directions (only one set). Do not add any zero rows corresponding to your b0 image, this will result in errors.  If you have different gradient directions for each b-value you can create several text files and refer to them in the DKEparameters.dat file under :

fn_gradients = 'gradient_vectors_siemens30.dat'; % text file containing the gradient vectors; each row corresponds to a gradient vector; if a different gradient set was used for each b-value, a 1-by-(nbval-1) cell array of file names should be specified, with each cell specifying the gradient file name for the corresponding nonzero b-value

The 4D nifti you need to upload will exist of 1 b0 image (this can be an average of all your b0s) followed by your diffusion weighted images (e.g 30 B1000, 30 B2000) in the same order as your gradient table. 

Hope this makes sense, 
Best 
Emilie
Nov 21, 2016  05:11 PM | Ehsan Misaghi - University of Alberta
RE: bvecs extracted from bmatrix or grad table
Hi Emilie,

Thank you so much for your response. I will change the gradient table to reflect what DKE is asking for (i.e. remove 0s and average b0 images and either use only one set of gradient directions or use the command line to input both sets). The only thing is that like I said, I'm not sure which one of the files that I have attached I have to use (after reflecting those changes). One is from a file named "gradient table" and the other is a bvecs file extracted from the bmatrix. Could you please help me figure out which one of these files should I use as the gradient table input to DKE?

Thanks a lot,
Ehsan
Nov 21, 2016  07:11 PM | Emilie McKinnon - MUSC
RE: bvecs extracted from bmatrix or grad table
Hi Ehsan, 

Can you provide me with some more details on where you got these values from? 

Emilie
Nov 21, 2016  07:11 PM | Ehsan Misaghi - University of Alberta
RE: bvecs extracted from bmatrix or grad table
Hi Emilie,

The NIFTI file I got from the scanner is accompanied by two txt files. One of them includes the scanning parameters such as the echo time, resolution, etc. This file also includes the gradient table (the file I've attached to this post contains the gradient table part of that file. The bvecs_gtable.bvec file I had attached to the first post was a reorganization of this file into the conventional bvecs format). The other file is a bmatrix for use with the ExploreDTI software. I have used that bmatrix with ExploreDTI before and the directions look fine with a permutation of the gradient directions, but unfortunately, ExploreDTI is not capable of doing DKI-based tractography, hence the need to use DKE. Normally, what we did with ExploreDTI was that we converted the bvecs and bvals files into the bmatrix file before processing and used the bmatrix with the NIFTI file. However, since I don't have the original bvecs/bvals for this dataset, I used MATLAB to extract the bvals and bvecs (the code I used: https://groups.google.com/d/msg/e_dti/8-bk8GKcQ9g/VruykovSBgAJ). The bvecs file for this was attached to the first post as bvecs.bvec. I hope this gives more info as to where these files came from.

Thanks again for your help,
Ehsan
Attachment: grad_table.txt
Nov 21, 2016  08:11 PM | Emilie McKinnon - MUSC
RE: bvecs extracted from bmatrix or grad table
Hi Ehsan,

I suspect that it has something to do with a difference in coordinate systems. I believe that the following is going on: bvecs_gtable.bvec is most likely the orientation of the gradient vectors in the coordinate system of the bore. This orientation is not necessarily the same as the coordinate system of your image. Normally what you do is extract information out of the dicom header called ImagePatientOrientation, and use the orientation of these axes to rotate your raw gradient table to the coordinate system of the Image. Dcm2Nii will also do this when you transform your data from dcm to nii for example. I have not worked with explore DTI before, although it looks like this transformation is applied to your gradient table as well.  Does the other text file you are working with provide you with any information on the orientation of the image in the scanner space? In dicom headers it is given as a 1x6 vector.  From the two gradient matrices you have, you should be able to calculate the rotation matrix between them. In matlab it should be something like R=B\A ?

Anyway, if it does not really matter where it comes from, I would run DKE with the bvec you created from the Bmatrix (provided you put it in the right format), because for tractography it is important that your gradient tables are expressed in the same coordinate space as your images.

Hope this helps,
Emilie