Difference between revisions of "EyeSeeCam SCI"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
===Converting rotation speed=== | ===Converting rotation speed=== | ||
<pre> | <pre> | ||
− | % | + | %make a coordinate object |
mycoordinates_XYZ = coordinates_XYZ(startingGaze); | mycoordinates_XYZ = coordinates_XYZ(startingGaze); | ||
− | % | + | |
− | + | % initialize R_total to 3D unit matrix | |
− | %loop | + | R_total = [1,0,0;0,1,0;0,0,1]; |
− | for i = (timeRange) | + | |
− | % | + | %loop through al timesteps |
+ | for i = (timeRange) | ||
+ | |||
+ | % determine the angle changes between time t(i)-delta_t/2 to t(i)+delta_t/2 | ||
delta_angleX = Vx(i)*delta_t; | delta_angleX = Vx(i)*delta_t; | ||
delta_angleY = Vy(i)*delta_t; | delta_angleY = Vy(i)*delta_t; | ||
delta_angleZ = Vz(i)*delta_t; | delta_angleZ = Vz(i)*delta_t; | ||
− | % | + | |
+ | %create a rotation matrices | ||
delta_Rx = Rx(delta_angleX); | delta_Rx = Rx(delta_angleX); | ||
delta_Ry = Ry(delta_angleY); | delta_Ry = Ry(delta_angleY); | ||
delta_Rz = Rz(delta_angleZ); | delta_Rz = Rz(delta_angleZ); | ||
− | % | + | |
− | + | %multiply rotation matrices (order is not important if angles are small enough) | |
delta_R = delta_Rx * delta_Ry * delta_Rz; | delta_R = delta_Rx * delta_Ry * delta_Rz; | ||
− | % | + | |
− | % | + | % determine new R_total |
− | + | % rotation in device coordinates, order: R_total * delta_R | |
R_total = R_total * delta_R; | R_total = R_total * delta_R; | ||
− | % | + | |
+ | %rotate startingpoint with R_total | ||
newpoint = R_total * startingGaze; | newpoint = R_total * startingGaze; | ||
− | % | + | |
+ | %add new position to list of coordinates | ||
mycoordinates_XYZ.add(newpoint); | mycoordinates_XYZ.add(newpoint); | ||
end | end | ||
+ | % transform XYZ to RAS coordinates with EyeSeeCam definition | ||
mycoordinates_RAS = transform_XYZ2RAS(mycoordinates_XYZ, definition_XYZ2RAS_EyeSeeCam_Sci); | mycoordinates_RAS = transform_XYZ2RAS(mycoordinates_XYZ, definition_XYZ2RAS_EyeSeeCam_Sci); | ||
mycoordinates_DP = transform_RAS2DP(mycoordinates_RAS); | mycoordinates_DP = transform_RAS2DP(mycoordinates_RAS); | ||
</pre> | </pre> |
Revision as of 09:04, 1 May 2024
Description
Matlab programming
Matlab interface
%todo
Converting rotation speed
%make a coordinate object mycoordinates_XYZ = coordinates_XYZ(startingGaze); % initialize R_total to 3D unit matrix R_total = [1,0,0;0,1,0;0,0,1]; %loop through al timesteps for i = (timeRange) % determine the angle changes between time t(i)-delta_t/2 to t(i)+delta_t/2 delta_angleX = Vx(i)*delta_t; delta_angleY = Vy(i)*delta_t; delta_angleZ = Vz(i)*delta_t; %create a rotation matrices delta_Rx = Rx(delta_angleX); delta_Ry = Ry(delta_angleY); delta_Rz = Rz(delta_angleZ); %multiply rotation matrices (order is not important if angles are small enough) delta_R = delta_Rx * delta_Ry * delta_Rz; % determine new R_total % rotation in device coordinates, order: R_total * delta_R R_total = R_total * delta_R; %rotate startingpoint with R_total newpoint = R_total * startingGaze; %add new position to list of coordinates mycoordinates_XYZ.add(newpoint); end % transform XYZ to RAS coordinates with EyeSeeCam definition mycoordinates_RAS = transform_XYZ2RAS(mycoordinates_XYZ, definition_XYZ2RAS_EyeSeeCam_Sci); mycoordinates_DP = transform_RAS2DP(mycoordinates_RAS);