Find the location of streamline in voxel coordinate

Hi all,

I would like to know about the location of streamline in voxel coordinate in these days(So, it should be integer coordinate).

Firstly, I called the matrix of streamline location using read_mrtrix_tracks in MATLAB, but their information consists of mm scale, so I have no idea of which voxel contains the piece of target streamline.

So what I did is, made the same size matrix with diffusion weighted image, and numbering to each voxel in order. (For instance, (1,1,1) to 1, (1,2,1) to 2 …)
and then, using tcksample function, in order to find the index of streamline.

and there are two weird points that I found.

  1. Some of streamline shows non-integer value although I only use the integer for numbering.
    Does this phenomenon come from interpolation? Is there any way to perform the sampling the value of voxel which contains the points of target streamline? I tried to use precise option but the error meassge showed up like this : [ERROR] Precise streamline mapping may only be used with per-streamline statistics. I think I didn’t understand the proper way to use this option.

  2. The output of tcksample was so weird. For example, the result of target fiber’s tcksample shows like this : 268056 269368 269711 268908 267742 266703 266049 265780 266439 266680
    and when I get the voxel location from the numbering matrix, the first two coordinates presented as follows:
    268056 : [x,y,z] = [9,24,30]
    269368 : [x,y,z] = [22,88,30]

It is impossible to jump from (9,22) to (24,88) in one step size.
Indeed, the result of read_mrtrix_tracks in MATLAB show (-37.9760, 28.3500, 17.4598) to (-38.8237, 28.7703, 17.7489) , which makes sense.

Overall, I cannot find the correlation between the result of tcksample and read_mrtrix_tracks.
I have thought that tcksample return the value of the input matrix voxel which contains the point of target streamline so far. If I thought incorrectly, plz don’t hesitate to make a correction or give any advise.



To get the track coordinates in voxel coordinates, it’s probably a lot easier to use tckconvert -scanner2voxel reference.mif in.tck out.tck. The output will be (floating point) coordinates in the voxel reference frame, which you can easily round to the nearest integer in Matlab if you so desire.