Home > data-import > gaze > filter_cont_eye_vars.m

filter_cont_eye_vars

PURPOSE ^

% Filtering invalid eye datapoints.

SYNOPSIS ^

function filter_cont_eye_vars(sid)

DESCRIPTION ^

% Filtering invalid eye datapoints.
 PosSci bounds: x=0-640 y=0-480
 LASA bounds: x=0-384 y=0-470
 This will take the cont2_eye_xy, cont_eye_x, and cont_eye_y and turn
 invalid datapoints into NaN values.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function filter_cont_eye_vars(sid)
0002 %% Filtering invalid eye datapoints.
0003 % PosSci bounds: x=0-640 y=0-480
0004 % LASA bounds: x=0-384 y=0-470
0005 % This will take the cont2_eye_xy, cont_eye_x, and cont_eye_y and turn
0006 % invalid datapoints into NaN values.
0007 
0008 % Updated by txu@indiana.edu on Feb 6, 2013, add the step of rescaling
0009 % old eye_xy data from [w=640 h=480] to [w=720, h=480]has been applied to
0010 % exp32, 34, 35 [3501-3512]
0011 % mlelston@indiana.edu, subjects that generated after 3517, raw eye data
0012 % is already [w=720, h=480]
0013 
0014 % get cont2_child_eye_xy and filter
0015 if has_variable(sid, 'cont2_eye_xy_child')
0016     cont2_child_xy = get_variable(sid, 'cont2_eye_xy_child');
0017 
0018     % x bounds
0019     cont2_child_xy(cont2_child_xy(:,2) > 720, 2:3) = NaN;
0020     cont2_child_xy(cont2_child_xy(:,2) < 0, 2:3) = NaN;
0021             
0022     % y bounds
0023     cont2_child_xy(cont2_child_xy(:,3) > 480, 2:3) = NaN;
0024     cont2_child_xy(cont2_child_xy(:,3) < 0, 2:3) = NaN;
0025 
0026     % Save xy
0027     record_variable(sid, 'cont2_eye_xy_child', cont2_child_xy);
0028     % Save x
0029     cont_child_x = cont2_child_xy(:,1:2);
0030     record_variable(sid, 'cont_eye_x_child', cont_child_x);
0031     % Save y
0032     cont_child_y = [cont2_child_xy(:,1) cont2_child_xy(:,3)];
0033     record_variable(sid, 'cont_eye_y_child', cont_child_y);
0034 else
0035     fprintf('\ncont2_eye_xy_child does not exist for sub %d\n', sid);
0036 end
0037 
0038 if has_variable(sid, 'cont2_eye_xy_parent')
0039     % get cont2_parent_eye_xy and filter
0040     cont2_parent_xy = get_variable(sid, 'cont2_eye_xy_parent');
0041   
0042     % x bounds
0043     cont2_parent_xy(cont2_parent_xy(:,2) > 720, 2:3) = NaN;
0044     cont2_parent_xy(cont2_parent_xy(:,2) < 0, 2:3) = NaN;
0045         
0046     % y bounds
0047     cont2_parent_xy(cont2_parent_xy(:,3) > 480, 2:3) = NaN;
0048     cont2_parent_xy(cont2_parent_xy(:,3) < 0, 2:3) = NaN;
0049         
0050     % Save xy
0051     record_variable(sid, 'cont2_eye_xy_parent', cont2_parent_xy);
0052     % Save x
0053     cont_parent_x = cont2_parent_xy(:,1:2);
0054     record_variable(sid, 'cont_eye_x_parent', cont_parent_x);
0055     % Save y
0056     cont_parent_y = [cont2_parent_xy(:,1) cont2_parent_xy(:,3)];
0057     record_variable(sid, 'cont_eye_y_parent', cont_parent_y);
0058 else
0059     fprintf('\ncont2_eye_xy_parent does not exist for sub %d\n', sid);
0060 end
0061

Generated on Tue 23-May-2017 20:00:55 by m2html © 2005