biac:analysis:roi_et
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
biac:analysis:roi_et [2011/04/25 18:26] – [ROI Drawing] petty | biac:analysis:roi_et [2011/04/25 20:35] – [future] petty | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Region of Interest Based Eyetracking Analysis ====== | ====== Region of Interest Based Eyetracking Analysis ====== | ||
- | These steps were created to gather eyetracking information based on specific regions of interest drawn on stimuli from the experimental task. The following assumes your task was image based, ( or images can be created to mimic the task ), there is XML behavioral output from the task, and your eyetracking was collected through Cigal or Viewpoint. | + | These steps were created to gather eyetracking information based on specific regions of interest drawn on stimuli from the experimental task. The following assumes your task was image based, ( or images can be created to mimic the task ), there is XML behavioral output from the task, and your eyetracking was collected through Cigal or Viewpoint. The steps are run based (excluding drawing the ROIs). |
===== Behavioral XML ===== | ===== Behavioral XML ===== | ||
Line 124: | Line 124: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ===== Merge Behavioral XML and ROI XML Data ===== | ||
+ | |||
+ | Now its necesary to merge the two sets of XML data together using **" | ||
+ | |||
+ | <file sh merge_rois_into_behav.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | bxh_eventmerge \ | ||
+ | --grabexcludeset ' | ||
+ | --mergeeventpath '// | ||
+ | ' | ||
+ | ' | ||
+ | BEHAVIORAL_run.xml \ | ||
+ | my_drawn_ET_ROI.xml | ||
+ | | ||
+ | ## comments | ||
+ | # grabexcludeset ignores any matches | ||
+ | # mergeeventpath is the path to the XML nodes from the ROI.xml, the example above represents | ||
+ | # < | ||
+ | # < | ||
+ | # </ | ||
+ | # ' | ||
+ | # my GRABQUERY is just ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | The above script assumes that the behavioral XML and ROI XML have the images have the same name attribute: | ||
+ | < | ||
+ | |||
+ | The script grabs everything except this node, and merges it into your behavioral xml. By default it writes to a new file with " | ||
+ | |||
+ | Because the ROI XML has all <roi> nodes inside of the < | ||
+ | |||
+ | |||
+ | For example, the following image has 2 associated ROIs that have been merged over: | ||
+ | |||
+ | < | ||
+ | <event type=" | ||
+ | < | ||
+ | < | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <roi type=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <roi type=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Preprocess Eyetracking Data ===== | ||
+ | |||
+ | This will convert either Cigal or Viewpoint wks files into CSV ( comma-separated values ), with distinct headers for each column. | ||
+ | |||
+ | Cigal files will already be in pixel resolution. | ||
+ | |||
+ | Chris Petty has written a perl script (**preprocess_eyetracking.pl**) to handle the preprocessing with various input flags. | ||
+ | |||
+ | <code perl> | ||
+ | USAGE: preprocess_eyetracking.pl [options] --input FILE --output FILENAME --type TYPE | ||
+ | |||
+ | where [OPTIONS] may be the following: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | *--input: is your eyetracking data ( either .wks or cigal eyepos file ) | ||
+ | * --output: is the name to output your csv file ( .txt, .csv, .wks are all file ) | ||
+ | * --type: represents " | ||
+ | |||
+ | if **wks** input, --onsetMarker is required if the data is not time-locked to your zero point. | ||
+ | |||
+ | if **wks** input is not in pixel dimensions as mentioned above, --convertpix with tell the script to convert the normalized space into pixel dimensions using the X and Y values ( --xres, --yres ) | ||
+ | |||
+ | This output will be used in all future steps. | ||
+ | |||
+ | For example: | ||
+ | <file csv> | ||
+ | VP_Code, | ||
+ | 12,0,M | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | 10, | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Calculate Eyetracking Hits ===== | ||
+ | |||
+ | Hits are considered eyetracking points where gaze was within ROIs defined in step 1, during the duration of each image. | ||
+ | |||
+ | Chris has written a perl script (**merge_eyetracking.pl**), | ||
+ | The script can be copied from: \\Munin\Data\Programs\User_Scripts\petty, | ||
+ | |||
+ | < | ||
+ | USAGE: merge_eyetracking.pl [options] --eyetracking FILE --behavioral XML --output XML --type | ||
+ | |||
+ | where [OPTIONS] may be the following: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | * --eyetracking: | ||
+ | * --behavioral : behavioral XML ( with ROIs merged ) | ||
+ | * --ouput | ||
+ | * --type | ||
+ | |||
+ | < | ||
+ | |||
+ | The processing script will add elements to the behavioral XML that represent hits and samples of valid eyetracking points from within your duration, this instance has 120 valid sample, with more than 50% inside the ROI: | ||
+ | |||
+ | < | ||
+ | <event type=" | ||
+ | < | ||
+ | < | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <roi type=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | </ | ||
+ | <value name=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 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, | ||
+ | |||
+ | 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 / | ||
+ | |||
+ | %%add my functions | ||
+ | %addpath \\Munin\Data\Programs\User_Scripts\petty\matlab\ | ||
+ | addpath / | ||
+ | |||
+ | %%XML with behavioral and ROIS | ||
+ | XML_docname = ' | ||
+ | |||
+ | %%preprocessed eyetracking data | ||
+ | ET_filename = ' | ||
+ | |||
+ | %%Path to your actual images, an array if multiple locations possible | ||
+ | imgPath = {'// | ||
+ | |||
+ | %%Image attribute name from behavioral XML [value=name" | ||
+ | imgAttr = ' | ||
+ | |||
+ | %%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, | ||
+ | |||
+ | %%this will only show image and ET points | ||
+ | %ET_plot(XML_docname, | ||
+ | |||
+ | </ | ||
+ | |||
+ | The output will look like this: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Hits are green circles inside the ROI, misses are red Xs outside. | ||
+ | |||
+ | Currently, to move to the next image in the XML, just close the current figure. | ||
+ | |||
+ | Also, if you just have the behavioral XML and preprocessed ET data, you can run the function **ET_plot** instead. | ||
+ | |||
+ | |||
+ | ===== PupilOmetry in Matlab ===== | ||
+ | |||
+ | A matlab script based on pupilometry steps from {{: | ||
+ | |||
+ | 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% : | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | <roi type=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <value name=" | ||
+ | <value name=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | 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 / | ||
+ | |||
+ | %% add path to pupilOmetry function | ||
+ | %addpath / | ||
+ | %addpath \\Munin\Data\Programs\User_Scripts\petty\matlab\ | ||
+ | |||
+ | %%input XML ( merged behavioral + ROI ) | ||
+ | xmlName = '/ | ||
+ | |||
+ | %%preprocessed eyetracking output | ||
+ | ET_filename = '/ | ||
+ | |||
+ | %%the attribute to match images with from the inputXML | ||
+ | imgAttr = ' | ||
+ | |||
+ | %%output name of the XML with added pupilOmetry data. will be everything from input + pupilchange | ||
+ | outName = '/ | ||
+ | |||
+ | %%show the denoising plots | ||
+ | plot = 0; %1 to show, 0 to skip | ||
+ | |||
+ | %%run the actual function | ||
+ | pupilOmetry(xmlName, | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== future ===== | ||
+ | * If there are any suggestions for added features, or something just isn't right please contact Chris | ||
+ |
biac/analysis/roi_et.txt · Last modified: 2024/06/21 15:44 by 127.0.0.1