Skip to content
johncolby edited this page Apr 25, 2011 · 9 revisions

trk_stats_overlay.m

Once you have compiled diffusion imaging data from multiple subjects/tracts/hemispheres in an along-tract form ([[trk_compile_data|trk-compile-data]]), and analyzed how variability in these measures relates to patient status, age, gender, etc. ([[between_grp.R|between group]]), the final step in an along-tract analysis is to display the results. One useful approach is to overlay the statistical results onto the mean tract geometry of a representative subject, and this is accomplished by trk_stats_overlay.

Exporting in general

While trk_stats_overlay is convenient because it automatically loops over subjects and tracts, the basic idea for displaying along-tract statistical results is no different from the way we exported and visualized the original along-tract scalar estimates and mean tract geometries at the end of the Basic workflow wiki page. We will craft a custom tract group to fit our needs, and then load this up in TrackVis for a nice display. Here are the steps:

  1. Generate the mean tract geometry of a tract of interest from a representative subject.
  2. Associate scalar values (in this case now p-values and effect sizes) with each vertex along the streamline.
  3. Stack the individual streamlines from multiple tracts together into a custom tract group.
  4. Add a “dummy” streamline to allow you to set display ranges (TrackVis normally limits the extremes of the color bar to the range of the actual data, but I normally find it more useful to set the range to same values each time. See here for suggestions).
  5. Update the header:
    • n_count – The number of streamlines (i.e. the number of tracts that were analyzed)
    • n_scalars – The number of scalars that were added
    • scalar_name – The names of the scalars
  6. Save the results with trk_write.
  7. Visualize in TrackVis. [See also this video]

Example

Using the included subject1 data, and some pretend statistical results, we can generate an example along-tract results visualization.

exDir           = '/path/to/along-tract-stats/example';
efxFile         = fullfile(exDir, 'effects_table.txt');
subDir          = fullfile(exDir, 'subject1');

We also load in the previous starting points used for reorienting the streamlines.

starting_pts_in = dataset('file', fullfile(exDir, 'starting_pts_out.txt'));

Finally, call trk_stats_overlay:

trk_stats_overlay(efxFile,subDir,[],starting_pts_in)

This outputs the tract group as effects.trk, which can then be loaded into TrackVis. Here is what it looks like displaying the p-value scalar: