Access to voxel cooradinates


I am new to MRtrix3 and I am having troubles accessing the voxel coordinates.
I have .mif file with FOD and all I can read from that are SH coefficients of each voxel. In MRtrix view I can see coordinates of each voxel of interest so the information seems to be there.

How do I generate the matrix with voxel index and coordinates ?

Thank you for your help.

I’m not sure what you mean here. Can you give an example of what you’re trying to do?

If you’re trying to display the ODFs, you’ll probably want to load that image in the ODF tool.

Hi J-Donald,

I am sorry, let me try to explain better.

When displaying ODFs, you can also view the position (coordinate) of each voxel for which you are viewing the fixels.

What I want to do is to link ODF data with finite element model and for that I need voxel info (position) as well as fixel info (direction, fractional anisotropy, amplitude) stored in a matrix.

I manage to get all the fixel information but I am still struggling to get the voxel position.

Thank you for all your help.

With regards,


Ok, then I guess the question is how are you currently getting the fixel information in the format you need? Because you’d need the voxel position to figure out where to find the data for each fixel. Do the docs on the fixel format not provide the information you’re after?

The question is expressed unusually, but I think I might be able to translate.

Storing “a matrix of voxel indices and coordinates” would be a highly inefficient way to handle such spatial information. The image transform permits, for any individual voxel, derivation of the location of that voxel in space, based on the coordinates of that voxel within the image in the three spatial axes.

Just in case: If you happen to additionally be reading ODF information directly from the .mif file raw data without using any provided I/O interface, and therefore you don’t have those indices in the three spatial dimensions but just a “voxel index” as the raw data are arranged in the file, then you will need to wrap your head around strides, which define how a 1D array of values stored within a file is mapped to axes of a higher-dimensional image.

Hi @shaiblikova,

You can run

warpinit odf.mif coordinates.mif

to get an image containing the (world) coordinates for all voxels. The resulting image is a 4D image, with 3 volumes representing the x, y and z coordinates of each voxel.


I really don’t understand the file I got out of this command. I just want the coordinate of the connectome nodes that I can see in mrview using my *.mif file. How can I get these coordinates?

The original question was about coordinates for individual voxels, I think, i.e. to go with the SH coefficients (of the FOD) in each voxel? Connectome nodes are something completely different. I’ll leave the latter to others to answer, if that’s effectively what you’re after.

OK, I’m sorry if my question was irrelevant, I’m still very new to MRTrix.
I produced my connectome using tck2connectome command and now I want the coordinate of the ROI nodes that are in my connectome. I was wondering if you can help me get that information

I could do it using this page

1 Like

For any future web travelers: If what you ultimately wanted was, for each unique index in a parcellation image, the geometric centroid of each parcel in 3D space, this will be made more accessible with the next update of MRtrix3 via a new command labelstats.

1 Like