Importing electrode positions recorded in RAS coordinates
Python API
1
Posts
1
Posters
15
Views
1
Watching
-
Hello
I am trying to load electrode coordinates with a subject's T1w image.
The electrodes were recorded in RAS coordinates (origin point: defined by the MRI scanner).From the forum I've seen that the T1w is placed in world (scanner) coordinates, so I thought using the exact values would place the positioning on the expected 10-10 location.
However, the positions were way off which led to using the image transform as such:
nii = nib.load("Image.nii.gz") affine = nii.affine inv_affine = np.linalg.inv(affine) ras_x = a ras_y = b ras_z = c ras_h = np.array([ras_x , ras_y, ras_z, 1]) voxel = inv_affine @ ras_h voxel_vec = model.Vec3(voxel[0], voxel[1], voxel[2]) world_pos = t1w.Transform * voxel_vec electrode = model.CreateSolidSphere(world_pos, 10.0)But even with this, I could not correctly register my electrode positions.
I would greatly appreciate any help on this! Thank you for your time in advance