Tckmap -stat_vox mean median mode

Dear experts
For each midsagittal corpus callosum voxel, the average length of streamlines passing through each voxel could be calculated using the command

tckmap CCtck -template CCmask -contrast length -stat_vox mean -precise outmap

I wonder how to calculate the median or mode length for each voxel. If the median or mode length information are not available, how to get the streamline index information passing through each voxel?

Thank you

Hi Liyuan,

The median and mode statistics are not currently supported in tckmap because their calculation differs very drastically from other statistics: instead of keeping track of just one scalar value per voxel, this would necessitate storing a list of values - one value per intersecting streamline - for every voxel. Apart from the programmatic complexity, this would blow out memory usage considerably.

(Note also that technically a mode statistic would not make sense, since streamline length is a continuous rather than discrete measure in the most general case)

There isn’t currently a command-line mechanism for accessing the voxel visitations of each streamline, though I’m sure the question has been raised at least once previously. If you don’t mind getting your hands dirty with a little C++, this functor takes as input a streamline and outputs the set of voxels intersected in one of these containers. You could either do your processing with those data in C++, or write a small C++ command that just writes those data to a text file, which you could then read in some other language.