User Tools

Site Tools


biac:analysis:roi_et

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
biac:analysis:roi_et [2011/04/25 19:54]
petty [Calculate Eyetracking Hits]
biac:analysis:roi_et [2023/02/23 18:43] (current)
Line 247: Line 247:
 Hits are considered eyetracking points where gaze was within ROIs defined in step 1, during the duration of each image. Hits are considered eyetracking points where gaze was within ROIs defined in step 1, during the duration of each image.
  
-Chris written a perl script (**merge_eyetracking.pl**), which takes the merged behavioral-ROI xml and the preprocessed eyetracking data from the last step to calculate the hits.+Chris has written a perl script (**merge_eyetracking.pl**), which takes the merged behavioral-ROI xml and the preprocessed eyetracking data from the last step to calculate the hits.
 The script can be copied from: \\Munin\Data\Programs\User_Scripts\petty, or run directly from cluster nodes. The script can be copied from: \\Munin\Data\Programs\User_Scripts\petty, or run directly from cluster nodes.
  
Line 291: Line 291:
   </event>   </event>
  </HTML>  </HTML>
 +
 +At this point you could use these additional XML elements when extracting your onsets for FSL, etc by including some hit criteria in your xcede_extract_schedules.pl queries.
 +
 +
 +===== Visualizing Eyetracking Points in Matlab =====
 +
 +Once eyetracking has been preprocessed, behavioral/ROI XML files have been created, you can visualize the points in matlab.  The following script will run a function that will re-draw the screen and image, redraw the ROI if thats the function chosen and plot the eyetracking points.  If ROIs are included, hits and misses will be differentiated.
 +
 +Functions can be added to matlab path: \\Munin\Data\Programs\User_Scripts\petty\matlab\ or copied into a local location.
 +
 +To run the plotter:
 +
 +<file matlab et_visualization_sample.m>
 +%% add biac tools if needed
 +%run /usr/local/packages/MATLAB/BIAC/startup.m
 +
 +%%add my functions
 +%addpath \\Munin\Data\Programs\User_Scripts\petty\matlab\
 +addpath /home/petty/net/munin/data/Programs/User_Scripts/petty/matlab/
 +
 +%%XML with behavioral and ROIS
 +XML_docname = '11436_run04_roiHits_pupil.xml';
 +
 +%%preprocessed eyetracking data
 +ET_filename = '11436_run4_pre.txt';
 +
 +%%Path to your actual images, an array if multiple locations possible
 +imgPath = {'//hill/data/Dichter/AutReg.01/Stimuli/AutReg.01/','//hill/data/Dichter/AutReg.01/Notes/SubjectPics/PS06'};
 +
 +%%Image attribute name from behavioral XML [value=name"THIS"]
 +imgAttr = 'imgName';
 +
 +%%screen resolution of stimulus computer
 +xRes = 1024;
 +yRes = 768;
 +scrSize = [ xRes yRes ];
 +
 +%%turn on scanpath lines
 +linesOn = 1;
 +%%turn on pause
 +withPause = 0; %1=on, this pauses between every point
 +
 +%%run the function
 +%%this will show image, ROI, and ET points
 +ROI_redraw(XML_docname,ET_filename,imgPath,imgAttr,scrSize,linesOn,withPause);
 +
 +%%this will only show image and ET points
 +%ET_plot(XML_docname,ET_filename,imgPath,imgAttr,scrSize,linesOn,withPause);
 +
 +</file>
 +
 +The output will look like this:
 +
 +{{:biac:analysis:plotter_example.png?800|}}
 +
 +Hits are green circles inside the ROI, misses are red Xs outside.  Since **linesOn** was turned on, there is a yellow gaze path from one point to the next.  If **withPause** was turned on, there would be a slight pause between each point.
 +
 +Currently, to move to the next image in the XML, just close the current figure.  If you want to stop the redrawing, "ctrl + c" inside matlab to kill the loop.  There are some updates planned to the controls.
 +
 +Also, if you just have the behavioral XML and preprocessed ET data, you can run the function **ET_plot** instead.  This will look at all images and ignore any ROIs, otherwise and ROI must be present for the image to get plotted.
 +
 +
 +===== PupilOmetry in Matlab =====
 +
 +A matlab script based on pupilometry steps from {{:biac:analysis:2006_urry_neuro.pdf|Urry et al}} can be run to denoise pupil dilation data found in the preprocessed viewpoint WKS or cigal eyetracking files.
 +
 +The result will be a pupilchange element added to your behavioral+ROI XML.
 +
 +This example node has all previous steps run, pupil was smaller then the .5sec before image by 2.9% :
 +
 +<HTML>
 +   <event type="image" units="sec">
 +      <onset>17.141</onset>
 +      <duration>4</duration>
 +      <value name="imgName">HAI_21.bmp</value>
 +      <value name="regType">look</value>
 +      <value name="trialType">HAI</value>
 +      <value name="response">2</value>
 +      <value name="RT">1212</value>
 +      <roi type="block">
 +         <name>object</name>
 +         <origin>260 258</origin>
 +         <size>500 205</size>
 +         <units>pixels</units>
 +         <value name="hits">10</value>
 +         <value name="hit_percent">8.47</value>
 +      </roi>
 +      <value name="samples">118</value>
 +      <value name="pupilChange">-0.029751</value>
 +   </event>
 +</HTML>
 +
 +
 +The pupilOmetry function can be found: \\Munin\Data\Programs\Users_Scripts\petty\matlab\ or just added to your path.
 +
 +This example script will run pupilOmetry on preprocessed eyetracking data and create the new XML with the added element:
 +
 +<file matlab run_pupilOmetry_sample.m>
 +%% add BIAC tools if needed
 +%run /usr/local/packages/MATLAB/BIAC/startup.m
 +
 +%% add path to pupilOmetry function
 +%addpath /home/petty/net/munin/data/Programs/User_Scripts/petty/matlab/
 +%addpath \\Munin\Data\Programs\User_Scripts\petty\matlab\
 +
 +%%input XML ( merged behavioral + ROI )
 +xmlName = '/home/petty/eyetracking/autreg/11436_run04_roiHits.xml';
 +
 +%%preprocessed eyetracking output
 +ET_filename = '/home/petty/net/hill/data/Dichter/AutReg.01/Data/Eyetracking/subj1234_run1_pre.wks';
 +
 +%%the attribute to match images with from the inputXML
 +imgAttr = 'imgName';
 +
 +%%output name of the XML with added pupilOmetry data. will be everything from input + pupilchange
 +outName = '/home/petty/eyetracking/autreg/11436_cigal_pupil2.xml';
 +
 +%%show the denoising plots
 +plot = 0; %1 to show, 0 to skip
 +
 +%%run the actual function
 +pupilOmetry(xmlName,ET_filename,imgAttr,outName,plot);
 +</file>
 +
 +
 +===== future =====
 +  * If there are any suggestions for added features, or something just isn't right please contact Chris
 +
biac/analysis/roi_et.1303761248.txt.gz · Last modified: 2014/08/04 16:03 (external edit)