TractSeg
TractSeg is a method by which dMRI data is segmented into white matter bundles. The advantage of this method is that it takes place all in native space.
TractSeg can be easily installed with:
pip install TractSeg
Processing
TractSeg processing takes place in five steps:
TractSeg -i [input_dir]/preprocd_dwi.nii.gz -o [output_dir] --raw_diffusion_input --output_type tract_segmentation
TractSeg -i [output_dir]/peaks.nii.gz -o [output_dir] --output_type endings_segmentation
TractSeg -i [output_dir]/peaks.nii.gz -o [output_dir] --output_type TOM
Tracking -i [output_dir]/peaks.nii.gz -o [output_dir] --nr_fibers 5000
Tractometry -i [output_dir]TOM_trackings/ -o [tractometry_output]/Tractometry.csv -e [output_dir]endings_segmentations/ -s [input_dir]/metric.nii
The outputs for the first three steps should look like this:

Tractometry outputs should look like this (note that this is a small snippet of the larger output CSV:

Note that all data is collected in column A and can be split into a proper table using Text-to-Columns in Excel. The top row is all of the discrete tracts segmented by the first four steps of the pipeline. In the following rows, you will find the average of the metric across all of the points along the tract.
Plotting Tractometry
TractSeg's current plotting modules is not ideal for our needs. We have constructed an in-house plotting script in R which outputs a variety of visualizations. In order to use this script, the Tractometry output CSVs need to be slightly rearranged. You can use this script to do that:
Once your CSVs are correctly organized, you can generate plots using this script:
Because there are so many plots, it is not feasible to save them all manually. The easiest way to save plots is by converting this script to an R Markdown script and then Knitting the script to output a DOCX or a PDF.
Last updated