Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Python API
  4. Importing electrode positions recorded in RAS coordinates

Importing electrode positions recorded in RAS coordinates

Scheduled Pinned Locked Moved Python API
1 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tbone
    wrote last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Search