Difference between revisions of "EyeSeeCam SCI"

From biophysics
Jump to navigation Jump to search
Line 9: Line 9:
 
===Converting rotation speed===
 
===Converting rotation speed===
 
<pre>
 
<pre>
%maak een coordinaat object met begin coordinaten
+
%make a coordinate object  
 
mycoordinates_XYZ = coordinates_XYZ(startingGaze);
 
mycoordinates_XYZ = coordinates_XYZ(startingGaze);
%initalizeer de loop
+
 
newpoint = startingGaze;
+
% initialize R_total to 3D unit matrix
%loop door alle rotatie stapjes
+
R_total = [1,0,0;0,1,0;0,0,1];
for i = (timeRange) %iterate in reversed order
+
 
     %creeer een rotatiematrix voor het interval van t tot t+delta_t
+
%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;
     %maak rotatie matrices
+
 
 +
     %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);
     %vermenigvuldig de rotatiematrices, volgorde is niet belangrijk als de
+
 
    %hoeken klein genoeg zijn.
+
     %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;
     % Combineer de rotaties
+
 
     % volgorde R_total * delta_R is rotatie in device coordinaten
+
     % 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;
     %roteer van startpunt met nieuwe totaal matrix
+
 
 +
     %rotate startingpoint with R_total
 
     newpoint = R_total * startingGaze;
 
     newpoint = R_total * startingGaze;
     %sla voor iedere iteratie het geroteerde punt op
+
 
 +
     %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

EyeSeeCam SCI

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);