dke-questions > fn_gradients "gradient vector table"
Showing 1-5 of 5 posts
Display:
Results per page:
Sep 20, 2017  09:09 AM | mukesh kumar
fn_gradients "gradient vector table"

Hello everyone
I am trying to run my nifti data set using DKE in batch mode.
my dataset bval = [0 500 1000 1500 2000];
ndir = 30;
fn_gradients = '/media/poonamrana/Mukesh_Seagate/PhD_data_DKI/Control_DKI/Hema/gradient.txt';
idx_gradients = {1:30 1:30 1:30 1:30};
The DKE processing done without error,

but my question is,

  • when we convert dicom DKI data into nifti using dcm2nii then we get subject.nii, subject.bval, subject.bvec, This subject.bvec file i used as a gradient table "gradient.txt" its is OK or not

  • how to select individual subject "gradient.txt" file in batch mode analysis in "fn_gradients = '/media/poonamrana/Mukesh_Seagate/PhD_data_DKI/Control_DKI/ subject1/ gradient.txt';" Because i have total 50 subject and every subject have individual gradient.txt file. Here i attached one subject gradient.txt table.
Attachment: gradient.txt
Sep 20, 2017  11:09 AM | Emilie McKinnon - MUSC
RE: fn_gradients "gradient vector table"
Hi Kumar,

Thank you for your question! 

Before you can use the .bvec file as a gradient table in DKE you will need to transpose its content and also remove any lines that match up with your b0 image (0 0 0). Additionally,  if you specify in ndir that you have 30 gradient directions, the program will only use the first 30 lines of your gradient.txt. If you want to use a different gradient table for each diffusion weighting, you can make 4 different txt files for each bval and write fn_gradients as follows: fn_gradients={ 'your path/gradient_500.txt','your path/gradient_1000.txt','your path/gradient_1500.txt' ,'your path/gradient_2000.txt'}.  

Your second question is a little harder to answer. Currently, DKE does not support batch scripting with different gradient tables. Remember, if you are not interested in tractography but only in the diffusion metrics, you can use the gradient table of the scanner as these metrics are rotationally invariant. If you are interested in tractography, you will need to use the gradient tables that are calculated by dcm2nii. That said, a common solution to your problem is to make a dke_parameters file for each subject, with their respective gradient table, and write a script that will loop over all of them executing DKE separately for each subject (either in matlab or in any terminal window). If you would like we could provide a short script for you that would do this! 

I hope this makes sense.
Good luck! 
Emilie
Sep 20, 2017  11:09 AM | mukesh kumar
RE: fn_gradients "gradient vector table"
Hi Emilie McKinnon
Thank your factual suggestion
But i not proper interpret this line "use the gradient table of the scanner as these metrics are rotationally invariant.". Please can explain little more me. It is great help for me.

Thank you in advance
Sep 20, 2017  11:09 AM | Emilie McKinnon - MUSC
RE: fn_gradients "gradient vector table"
Hi Kumar,

I apologize for being unclear. Let me try again!

The majority of people will run the standard diffusion weighted sequences that are provided with your MRI scanner. For example, on our Siemens Prisma scanner we have the build in options of using either 30, 64 or 256 gradient directions for DKI.  This gradient table will be the same for every patient and you should be able to ask your MRI tech for this table.

The problem that arises is as follows. This gradient table is defined in the coordinate system of the scanner (which is stationary), but the coordinate system of the subject will be different every time (as you are not able to exactly position your subject in the scanner the same way).  The nice thing about coordinate systems is that there is a simple linear transformation between your subject's image coordinate system and the coordinate system of the scanner. This transformation is provided in the dicom header and this is actually what dcm2nii uses to calculate the gradient tables in image space (this is why they are different for every subject).  The nice thing about using only the diffusion metrics is that they do not "care" about which coordinate system they are calculated in, they will be the same in both coordinate systems. This is the definition of rotationally invariant. Hence, if you are only interested in calculating MD,MK,FA go ahead and use the gradient table you can find on the scanner! Although if you are interested in tractography, this would be an incorrect approach and you need to use the gradient table defined in image space (as calculated by dcm2nii).

I hope this made more sense!
Thanks,
Emilie
Sep 20, 2017  01:09 PM | Russell Glenn - Medical University of South Carolina
RE: fn_gradients "gradient vector table"
Hi Kumar,

I agree with Emilie, if you are not doing tractography you do not necessarily need to update the parameter's files for each subject.

If you have matlab, and feel comfortable with a little bit of coding, I've attached a script that can help you batch process this and update the parameters for each subject automatically. I've also included a few lines of code where I've used this in the past (you will have to modify this and define your own variables to make this work... it's just included as an example).

Best,

Russell



file_paths.dke = '~/Documents/DKE_2.6'; %Directory with dke executable file

new_params = {'studydir',sprintf('''%s''',file_paths.output),'subject_list','{''''}',...
'fn_gradients',sprintf('''%s''',file_paths.dki_grad),...
'fwhm_img',sprintf('1.25*[%d %d %d]',vox(1),vox(2),vox(3)),'preprocess_options.format','''nifti''',...
'preprocess_options.fn_nii','''dki_4D''','ndir',sprintf('%d',ndir),...
'T',sprintf('%d',dke_mask_threshold),'idx_gradients',idx_gt_str,'bval',bt_str,'median_filter_method','0'};

updateParametersFile(file_paths.dke_params_template,file_paths.dke_params_new,new_params);

%Run DKE
cd(file_paths.dke)
if isunix; eval(sprintf('!./dke ''%s''',file_paths.dke_params_new))
elseif ispc; eval(sprintf('!dke %s',file_paths.dke_params_new))
end