Visualization with tckmap vs. mrview

MRtrix-ers,

I’m using MRtrix and Lauren O’Donnell’s Automated white matter fiber tract technique to find specific tracts in clinical cases. The results so far have been very good.

Where I could use a bit of help is visualizing the final results of the clustering. For reasons that I have not yet figured out, 2M initial tracts result in a limited number of clustered tracts, around 40K. I’m having a hard time creating good visualizations of the data using tckmap. tckmap is used to generate an overlay for the FLAIR image to visualize the relationship between tracts and lesions. My code uses tckmap with a thresholds to color any voxel that contains streamlines based on cluster. This gives a good indication of where the streamlines run.

I’d also like to generate DEC images that look more like traditional tractography results that mrview might generate. This is my results so far (remember, I don’t have many streamlines to use):

Here is roughly the same in mrview:

mrview shows more streamlines even when the density is low. I was hoping to generate an image more like this using tckmap, but have not found the right set of parameters. I’ve been using -contrast, -stat_vox and -stat_tck to tweak the visualization, but without success.

Any tips on how to have tckmap generate images closer to mrview?

# Generating the images
tckmap -quiet -force \
    -dec \
    -upsample 2 \
    -template flair.mif \
    all_bundles.tck \
    all_dec.mif
mrview all_dec.mif
# Merge
mrcalc -force flair.mif all_dec.mif 2 -mult -add merged.mif
# View
mrview flair.mif -tractography.load all_bundles.tck

Cheers,
-dan

Hey Daniel,

I worked on streamlines clustering in the first half of my PhD, so much of this information may be buried under multiple layers of repressed resentment… :stuck_out_tongue:

For reasons that I have not yet figured out, 2M initial tracts result in a limited number of clustered tracts, around 40K.

Can’t recall the details of this specific method, but if it’s a genuine “spectral” clustering, then it requires a full streamline-streamline similarity matrix, and hence the number of streamlines is limited by the size of the matrix that can be stored in RAM. So it may be intentionally discarding all but the first ~40k streamlines before it even begins processing. It would be more “conventional” in clustering to then have a hierarchical scheme: each input streamline can be assigned to the nearest “clustered” streamline, and the cluster assignment of the “clustered” streamline is then propagated back to the input streamline. Maybe check to see if such a tool is provided in the software you are using?

I’m having a hard time creating good visualizations of the data using tckmap.

With low streamline counts, tckmap will usually look awry. A lower spatial resolution (using -vox option) could help, as could using the -precise option (gives a bit of “anti-aliasing”). If you want to brighten low-density regions without brightening high-density regions (much like one might do for a 2D image in e.g. GIMP), you could try e.g. using the greyscale TDI in conjunction with mrcalc to define a non-linear scaling function, and then divide the DEC TDI by this map.

I was hoping to generate an image more like this using tckmap

By drawing quads for each streamline, mrview’s Tractography tool is essentially saturating any pixel for which there’s at least one streamline within the “diameter” of a pseudo-streamtube; these are produced using a custom GLSL geometry shader. This “diameter” effect is simply not possible in tckmap. You could get a similar result by using -vox to set a very high spatial resolution and -stat_vox mean to get the saturation effect, but with so few streamlines you’ll most likely observe “gaps” in the bundles.

Cheers
Rob