Hi Slicers,
I am working on a project with Slicer generated nrrd files and after looking at the nrrd header I notice there is no info about the ijk to RAS matrix yet when I load that nrrd file into Slicer I obtain the matrix. So I think I figured out how to build it in code and I am looking for validation from someone who is more experienced than me. This is what I am doing:
-
I read the nrrd header and obtain the space direction vectors (say a,b,c)
-
I build a 3x3 matrix (A) where the columns correspond to a, b, and c.
-
Given the t translation column vector (as defined in the nrrd space origin header), I can obtain world coordinates x for the index column vector v by:
x = A*v + t
- since my nrrd volume appears to be in LPS frame (as per the space header), I have to multiply x by the LPS to RAS transform.
Say that’s T = [-1 0 0; 0 -1 0; 0 0 1], so:
x_ras = T * x
Is this correct?
Now, the IJK to RAS direction matrix reported in Slicer (Volumes module) seems to be:
T*A
is this correct?
Thanks!