File Exchange

image thumbnail

DTI and Fiber Tracking

version (5.05 MB) by Dirk-Jan Kroon
Diffusion MRI (DTI), calculates FA, ADC, Vector Field, and will track and visualize neural tracts.


Updated 20 Aug 2008

View License

Straightforward Diffusion MRI (DTI) and Fiber Tracking (FT) functions and examples.

DTI.m, will calculate the Apparent Diffusion Coefficient(ADC), fractional anistropy (FA), and diffusion tensor field, of a DTI datasets consisting of at least 6 dataset with different MRI gradients and at least 1 without gradient.

FT.m, will calculate neural tracts (fiber tracts) starting from every point in the brain, and outputs all fibers crossing a certain ROI.

Try DTI_example.m and then FT_example.m

Cite As

Dirk-Jan Kroon (2021). DTI and Fiber Tracking (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (19)

yahui ouyang

Thank you very much. But ,dear Sir, I have some questions about how to use matlab to read b value b vector from DICOM header.I tried Dicomread and the metadata command but failed to extract the value.

Di Fan

Thanks a lot.
How we get the Roi?


firstly thanks share this code with us

i have a problem in part of code

FT(FA,VectorF,Roi,parameters) in FT.m

How we take "Roi Parameter" in different image

if someone knows, kindly help me about this topic


First of all, thank you very much for sharing your code.

I have just the same question as M :

- Is there any reference or paper published of this fiber tracking method?

-It is a new method or is a known tracktography algorithm?


Is there any reference or paper published of this fiber tracking method?
It is a new method or is a known tracktography algorithm like the S. Mori approach?


In the help note for DTI function we see: DifT: A 3D matrix ... should it be 4D matrix?

Bunheang Tay

hi all, I know this code is work with gipl format. I have used with hdr, and img, it just fine.
I wonder whether it works accurate or not?

it is a nice work, thank!

Shripad Kondra

Alper Yaman

In FT.m line 41 should be "fiber=zeros(parameters.FiberLengthMax,3);" not "fiber=zeros(600,3);".

k m

Is this code working with only gipl format? I have been using .img files, but the results seem to be now good. Is any body there who has similar question?


k m

Is anybody there who used this code with phantom data rather than human data?

Alper Yaman

You may also change stepsize to a 1x3 vector, each element increments fiber by different scales for anisotropic image sets.

Alper Yaman

Thank you for codes. For smoothing, you may use 2 approach:
1. Smooth images before all calculations.
2. Convert eigenvectors to spherical coordinates and smooth r,theta and phi seperately. I am not sure, but it will better than smoothing in cartesian coordinates.

Eric Candelabro

Is there any reference or paper published of this fiber tracking method?
It is a new method or is a known tracktography algorithm like the S. Mori approach?

smitha mahesh

can I use it for 30 directions

Dirk-Jan Kroon

I detected an error in the fiber tracking function when working on a version which could detect crossing and fiber splittings.

The smoothing of the vector/tensor field in FT.m, may not be done in this way: VectorF(:,:,:,1)=imfilter(VectorF(:,:,:,1),fspecial3('gaussian',[4 4 4]));
because a DTI vector is equal to a DTI vector pointing in the exact oppositie direction. With simple gaussian smoothing they will cancel each other out, which we don't want.

You can fix the function by removing the smoothing.

I hope to replace this smoothing with another smoothing algorithm, next file update.

Dirk-Jan Kroon

*Jerod Rasmussen
The method works also for 10 or 12 directions, in fact I use this function for more then 30 gradient directions in Dicom formatted 3D data.

The DTI_example is only an simple example! of how you can use the DTI function...

Jerod Rasmussen

Requires an obscure file format, as is only works on 6 directional, but nice place to start a DTI function.

jichao zhao

It is excellent work. thanks for sharing

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!