EyeSeeCam SCI

From biophysics
Jump to navigation Jump to search
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);