You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering whether it's possible to get the coordinates of a probe insertion from the xyz_tracks inputted into the ephys atlas GUI - essentially this would be the angles of the line that is fit to the tracked points in the slice plot and the xy coordinates of the insertion point from that line.
Thank you for the super helpful tool!
The text was updated successfully, but these errors were encountered:
Yes that is possible, you can get it out in the following way
import json
from pathlib import Path
import numpy as np
from iblatlas.atlas import Insertion, AllenAtlas
output_path = Path(r'/Users/admin/Downloads/data')
with open(Path(output_path, 'xyz_picks.json'), "r") as f:
xyz_picks = np.array(json.load(f)['xyz_picks']) / 1e6
ba = AllenAtlas()
ins = Insertion.from_track(xyz_picks, ba)
tip = ins.tip # coordinate of tip of xyz_picks (relative to bregma)
entry = ins.entry # coordinate of entry on surface of brain of xyz_picks (relative to bregma)
depth = ins.depth # depth of xyz_picks relative to surface
theta = ins.theta # phi angle of xyz_pixks
phi = ins.phi # theta angle of xyz_pixks
# Display the insertion that has been fitted to the xyz_picks
import matplotlib.pyplot as plt
ax = ba.plot_tilted_slice(ins.xyz, 1, volume='annotation')
ax.plot(ins.xyz[:, 0] * 1e6, ins.xyz[:, 2] * 1e6, 'r')
plt.show()
Let me know if that helps. Our convention of theta and phi are explained here
I was wondering whether it's possible to get the coordinates of a probe insertion from the xyz_tracks inputted into the ephys atlas GUI - essentially this would be the angles of the line that is fit to the tracked points in the slice plot and the xy coordinates of the insertion point from that line.
Thank you for the super helpful tool!
The text was updated successfully, but these errors were encountered: