Help for Diffusion map making

This is a quick reference on programs for analyzing diffusion data.

If you use the programs on this page for your analysis, an acknowledgment to Ona Wu, Timothy L. Davis and Thomas Benner for assistance in data analysis would be much appreciated.

If you find this page helpful in developing your own programs, a reference to the following paper would be appreciated.

The following programs were developed and tested for diffusion imaging using the Stejskal-Tanner PFGSE sequence and have not been validated for balanced or refocused diffusion sequences. They work on both Solaris and Linux systems.

The conventions used are words in italics are arguments that you specify at run time and all other text, including < and > need to be included. Arguments in [] are optional.

  1. ~ona/bin/Diff/bin/`uname -s`/mktensorsb2 [-N noiseDevs] [-B badj] tensor.bshort bval_data > tenout

    This program assumes the data has been acquired using the following diffusion gradients:

    It assumes the files are ordered with 7 shots for each slice arranged sequentially. That is:

    If your files are not in that order or in bshort format, you may be able to use repack to reslice your files into the right order.

    If you use ~ona/bin/Diff/bin/ideal.dat for your bval_data file, you will need to supply the -B argument with the b-value you used since the ideal.dat file assumes an input matrix of magnitude 1.

    ~ona/bin/Diff/bin/bcoeffs.dat is the inverse matrix file customized for the sequence that ran on the ANMR systems with b-value=1221. The -B argument is not necessary in this case. This matrix also compensates for cross-term gradient effects in the ANMR system.

    This program can be used for any sequence provided the correct bval_data file is used. The bval_data file is a binary file containing the elements in double precision of the 7x7 inverse matrix that can be used to solve the diffusion equations assuming each row represents the elements used for each image acquisition. Also mktensorsb populates the D tensor as [Dxx,Dyy,Dzz,Dxy,Dyz,Dxz,ln(So)]. For example for the above diffusion sequence, assuming the magnitude of Gx=Gy=Gz=1/sqrt(2) and b-value=1, the ASCII representation of ideal.dat would be:

    The structure of the tenout file consists of nrows*ncolumns*nslices+1 TensorType elements. The structure of TensorType is described in the tensordata.h file:

    The first TensorType structure in the file contains the ncols, nrows and nslices in e1, e2 and e3 elements respectively. The next few programs assume this format for their analysis.

  2. ~ona/bin/Diff/bin/`uname -s`/eigenmap_sort < tenout > eigmap.bfloat

    This program takes the output of mktensorsb and generates various scalar metrices of the diffusion tensor. The order of the images are:

    The sequence is repeated for each slice. The user still needs to create the appropriate eigmap.hdr file with the correct inplane dimensions and number of images (= number of slices * 16).

  3. ~ona/bin/Diff/bin/eigenmap_ppm -i tenout_file [-e 1|2|3] [-s 0|1|2|3|4] -o outfile

    Output are .ppm files specified by -o argument and can be viewed with your favorite graphics viewer, e.g. xv.


This page is not guaranteed to be up-to-date and is worth what you paid for it. The programs described on this page are for research purposes only. Please send all bug reports to

Ona Wu
MGH-NMR Center
13th Street, Bldg 149
Boston, MA 02129
(617) 643-3873 (o)
(617) 643-3939 (fax)
Last modified Fri Apr 6 20:32:10 EDT 2001