[Neuroimaging] How to apply an affine transform estimated from ITK?

François Rousseau francois.rousseau at telecom-bretagne.eu
Wed Jul 22 15:55:10 CEST 2015


> 
> Not transparently, no.  I'm afraid you have do something like:
> 
> RAS2LPS = np.diag([-1, -1, 1, 1])
> vox2itk_world = LPS2RAS.dot(img.affine)
> lpi_world_pts = nib.affines.apply_affine(vox2itk_world, vox_pts)
> 
> Is that what you mean?
> 


Yes, exactly. This is what I’m doing right now. Thank you Matthew.

However, I still do have another question.

In ITK, the index coordinates (say for instance (0,0,0) ) correspond to the center of a voxel.
It seems that in nibabel, it correspond to the corner of a voxel. Am I right? (I didn’t find that in the documentation)

Such difference can introduce a shift of half a voxel in registration / interpolation / reconstruction algorithms.

François




More information about the Neuroimaging mailing list