You can make a TDI map, given a tractography (.tck file) and some image (.mif or .nii.gz for example) to define the grid:
tckmap tracks.tck -contrast tdi -template image.nii.gz output_tdi.nii.gz
In fact, the default contrast is already ‘tdi’, so you can also leave out the
-contrast tdi part. The image.nii.gz in this example is only used to define the grid of the output image. It doesn’t matter what intensities there are in there.
I understand you want to have the TDI value separate in a selection of voxel coordinates (x,y,z), not averaged out or anything. One approach would be to start from the output_tdi.nii.gz and use
mrstats with the
-mask option to obtain the value in a ROI. This ROI can be an image containing a single voxel. So you could make a loop in which you create a ROI image and compute the TDI in it:
mrcalc image.nii.gz 0 -mult - | mredit - -voxel x,y,z 1 - | mrstats output_tdi.nii.gz -mask - -output mean
This basically takes an image.nii.gz, sets all intensities to 0, then passes it on to
mredit to set the intensity of voxel x,y,z (change this within your loop) to value 1. This binary ROI is then passed on to
mrstats to be used as a mask on output_tdi.nii.gz, from which the mean value (of a single voxel, so the voxel intensity itself) is taken. Best to check that the value you get is the correct one, else the x,y,z definition needs to be changed.
There may be other solutions, but this is the one that pops in my head for now, given that you want to have the TDI values of each voxel, and not the average across voxels.