Page 1 of 1

voxels to mm conversion?

Posted: Tue Oct 25, 2011 1:34 pm
by SylvainT
Hi,

Working with un-normalized EPI volumes, I need to convert my voxels/matrix coordinates into the mm anatomist coordinates. To be more precise, I'm talking of the mm coordinates that get displaied in anatomist after you just open the nifti file (before assigning any referential to the image/window).

From what I read here:
http://www.brainvisa.info/doc/aimsdata- ... /ch06.html
I think I'm asking how to get the transformation matrix from RAAd to RAA

Thanks for your help,

Sylvain

Re: voxels to mm conversion?

Posted: Fri Nov 04, 2011 11:39 am
by riviere
Hi Sylvain,

You get the "storage_to_memory" field in Aims headers (either in aims API in C++ or python, either in the output of AimsFileInfo), this contains the matrix to go from disk orientation to memory orientation in Aims (in voxels). This matrix is determined in the IO system, and its determination depends on the file format, but is normally always given in this field in a format-independent way. Then you just need to multiply by voxels size to go to mm coordinates.
Was that your question ?

Denis

Re: voxels to mm conversion?

Posted: Fri Nov 04, 2011 1:32 pm
by SylvainT
Hello Denis,

Yes, that was my question! I was trying very complicated stuff, but the answer was indeed quite simple (Olivier C. had helped since; that was also related to the graph questions he'd sent you coz I'm trying to do some graph visualization... I wanted to mention it on the forum but I forgot, sorry).

But: the "storage to memory" matrix stored in the nifti header does not seem to be adequate in my case: I had to change from xyz to zyx, which is not what the storage_to_memory matrix gives me. Or (which is more probable ;) ): I don't understand how to use it properly... But that's not a big deal anymore (at least for now) since I found the solution "manually".

Thanks again,

Sylvain

Re: voxels to mm conversion?

Posted: Fri Nov 04, 2011 3:10 pm
by riviere
The storage_to_memory matrix is the transform from "storage" (how voxels are stored on disk) space to the Aims space (axial, with our strange orientation conventions). Now it depends from which space you really wanted to convert. It it was an external space (like MNI), the it would require other transformations (some may be in the "transformations" field of the header).
In graphs, the system was different (for historical, and probably bad reasons): there is only one transform, going from the graph (or image) Aims space to Talairach space, and it is encoded using several fields "Talairach_translation", "Talairach_rotation", "Talairach_scale". But there are functions somewhere in the Aims lib (C++ and python) to read/write them from regular transformation matrixes: GraphManip.talairach( graph ) and GraphManip.storeTalairach( graph, transform ).

Denis