2-tensor tractography

From Hodaie Lab
Jump to: navigation, search


2-tensor tractography can be found in the latest nightly of the TEEM library. Refer to Qazi et al for details of the algorithm.


The library must be compiled with CMAKE flag BUILD_LEVMAR turned on. Compile Teem

For those under Ubuntu 10.04 64bit, a precompiled binary is here: download

extract the file to your /usr/bin folder or somewhere you prefer.

For our conveniences, the new tend executable is referred to as tend2 to distinguish it from the ordinary tend file that cannot perform 2-tensor tractography.

Average B0 volumes

NOTE That instead of averaging, discard all but the last b0 volume makes more sense. Therefore now the b0avg.py script does this instead.

tend fiber cannot read DWI files with more than 1 b0. So manually averaging b0 is necessary before seeding tracts.

The steps are now automated with b0avg.py script.

Manual two steps

Crop out the b0 volumes only, and keep the gradients.

unu crop -i input.nrrd -min 1 0 0 0 -max M M M M -o grad.nhdr

Crop out the b0, Average the b0, then splice into the gradient directions.

unu crop -i input.nrrd -min 0 0 0 0 -max 1 M M M | unu project -a 0 -m mean | unu splice -i grad.nhdr -s - -a 0 -p 0 -o b0averaged.nhdr

Note that unu spice replaces a specific slice, not inserting it. So an extra index is need at the beginning of 1nd command to leave space for the b0 average slice.

It's possible to switch index columns if the gradient column is not the first column:

unu crop -i input.nrrd -min 0 0 0 4 -max M M M M | unu permute -p 3 0 1 2 -o dwi-sb0.nhdr

This probably won't happen very often, but good to know.


To seed tracts the follow are necessary:

  • eddycorrected DWI file in .nhdr format.
    See DTI Preprocessing
  • A label map in .raw format
  • tend2 executable


  • Prepare a DTI scene as described in DTI Preprocessing.
  • Add a label map and mark the ROI(s).
  • Save the scene file, make sure to change the label map format to nhdr. Note down where the scene is saved.

Run command ten2fiber command to generate the .vtk tracts.

The argument order is:

arg order: dwi label# fa frac radius minlen step_size tensor_file seed_file

  • The seeds are in a "seeds' folder.
  • The tracts are in "xst" folder.

Manually generate seed points

  • getSeedPoints.py -i seeding.nhdr
    It'll create a ./seeds folder, with seed points of each label map according to their label number IC1.txt, IC2.txt ... etc.

Manually generate tracts

tend2 fiber -i eddycorDWI.nhdr -dwi -wspo -ns seeds/IC1.txt -ap \
-t 2evec0 -step $8 -stop aniso:cl2,0.2 frac:0.1 radius:1.3 minlen:30 -n rk4 \
-k cubic:0.0,0.5 \
-v 2 -o fibermodel.vtk

Replace the settings accordingly. For more information see tend2 fiber

Load Fiber model into Slicer


  • Load Data -> Choose File
  • Under Description -> FiberBundle


Now you are ready to load the fiber model into Slicer3

  1. Go to Modules->Diffusion->Tractography->Fiber Bundles
  2. Expand Load menu bar
  3. Load Tractography
  4. Select the fibermodel.vtk you generated.