Skip to content

Conversation

hannalee2
Copy link
Collaborator

Update:

  1. Consensus of transM
  2. Getting 3D Angle (5DoF)

1. Consensus of transM

Scientists want to reach a consensus on the transformation-matrix convention.
They obtain Rb and tb using least squares.
Column-vector form
local = Rb @ bregma + tb, where local and bregma are column vectors.

Previously, Parallax obtained R and t using least squares.
Old (row-vector) form: global = R @ local + t, where local and global are row vectors.
Now (column-vector) form: local = R @ global + t, where local and global are column vectors.
(Trained: local = global @ R.T + t, row vectors, since NumPy often uses row vectors by default.)

To get Rb and tb, I use this derivation:
Unknown: Rb and tb. Known: R, t, Rm, tm (where Rm and tm are reticle metadata).

To get Rb and tb, I uses this formula:

Unknown: Rb and tb. Known: R, t, Rm, tm. (Rm and Tm is reticle metadata)

local = Rb @ bregma + tb, where local, bregma, and tb are {3x1} vectors.
local = Rb @ (Rm @ global + tm) + tb, where local, global, and tm, tb are {3x1} vectors.
local = R @ global + t, where local, global, and t are {3x1} vectors.

R @ global +t = Rb @ Rm @ global + Rb @ tm + tb
R = Rb @ Rm
t = Rb @ tm + tb

Rb = R @ Rm.T
tb = t - Rb @ tm
tb = t - R @ Rm.T @ tm

Return shape is a {4×4} transformation matrix [R t; 0 1] (homogeneous coordinates to simplify computation).
After getting Rb and tb, I did a sanity check by comparing out below and the output is same.
bregma = (local - t) @ R @ Rm.T + tm (row major: get global and then apply reticle metadata)
bregma = local - tb @ Rb.T (row major)

Note: The format may change after I hear back from Yoni and Galen. I’m considering letting the user select the reticle metadata and updating only the selected reticle’s points (not the entire list) to save computation. I’m also considering sending global_X, global_Y, and global_Z as the post-bregma–applied coordinates, so they can be used to visualize the bregma-based point from Pinpoint.

1.json

User can save stage info into json format or checkout on the localhost:8081
Example)
image

2. Getting 3D Angle (5DoF)

Let e_z(local) = [0, 0, 1]^T.
Its direction in global coordinates is:
vec = R^T * e_z(local)
= (3rd column of R^T)
= (3rd row of R)^T.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant