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

Matthew Brett matthew.brett at gmail.com
Wed Jul 22 15:46:01 CEST 2015


Hi,

On Wed, Jul 22, 2015 at 2:36 PM, François Rousseau
<francois.rousseau at telecom-bretagne.eu> wrote:
>>
>> However, the results are not the same. There is a minus sign for x and y. I don’t understand where the issue comes from. Any help?
>
> As far I understand, it seems that it comes from that ITK uses LPS and nibabel uses RAS.
>
> Is there any function in nibabel to handle such thing ‘transparently’ ?

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?

Cheers,

Matthew


More information about the Neuroimaging mailing list