TipsAndTricks

From Heeger Lab Wiki

Jump to: navigation, search

Contents

[edit] Eye tracker

[edit] File format

There are two formats supported by the ASL eye tracker. You want to be using the new format (ver 6000, not ver 5000) that saves more information, including separate traces for the pupil and corneal reflection position. To make sure you are doing that, go to File/File Settings on the Eye tracker control software:

Image:Et60001.gif

Then you will get a dialog with options for what traces you want to save. The ones that are really important are XDAT (saves digital i/o information including backticks and calibration control bits), pupil_diam, horz_gaze_coord, vert_gaze_coord (normal eye traces) as well as pupil_pos_horz/vert (pupil traces) and cr_pos_horz/vert (corneal reflection traces):

Image:Et60002.gif


[edit] Calibration sequence

If you are using mgl/task then before each run, you should make sure to run a calibration sequence. You can do this easily by making sure you have the code

myscreen = eyeCalibDisp(myscreen);

in your task, and then hitting space at the beginning of your experiment, when you are prompted:

-----------------------------
Hit SPACE to do eye calibration
ENTER to skip eye calibration
Esc aborts at any time
-----------------------------

One thing that is *very important* about eye tracking is to make sure that you calibrate the eye position with the same intensity background as your real task. So if your task has a gray background, do the eye calibration with the identical gray background. Otherwise the reflected luminance off the eye is very different and the eye tracker won't be able to get a good calibration.

Also, for this to work properly, mgl calls a function called:

writeDigPort

which lives in

mgl/utils/readDigPort/writeDigPort.c

Make sure to have the function compiled, by doing:

mex mgl/utils/readDigPort/writeDigPort.c

It is left uncompiled by default so that on computers that don't have the National Instruments board installed it does not choke. If you don't have that function compiled then mgl will not be able to turn on/off the eye tracker automatically and will not be able to send calibration marks. You will know that it is working properly when you run a test of your program and hit space bar for eye calibration. The first time it runs it will take a long time and the cursor will switch to a waiting symbold (several seconds)--this is the program initializing the NI card. After that you can check to see that the eye tracker gets started and stopped appropriately when you start/stop your experiment (you will have to have a file open on the eye tracker control software/have the option set to automatically start and stop and make sure the eye tracker is turned on).

Also, make sure that you have the proper switch set on the backtick control panel to pass the backticks to the eye tracker (I believe it is called external).

[edit] Analyzing data in matlab

You can load the raw eyd files into matlab, by using a function I have in my matlab directory (~justin/proj/mymatlab):

readeyd('xx070601.eyd');

This relies on a mex file so that it can read the file in quickly

readeydseg.c

This will also read 5000 version files although there is not as much information in those files.

If you want to also calibrate the data you can run:

calibeyd('xx070601.eyd')

This function will also allow you to install the calibration into mrLoadRet. Each scan of your experiment will be a "segment" in the file and it will look for calibration marks, when it finds them, it will try to calibrate the data by putting up a figure like:

Image:eyecalib.png

This is what a good calibration looks like. On occassion the calibrations may not work out quite as well and you have to decide whether to discard them or not. I usually decide based on whether the calibration gives a stable and believable trace for the "Calibrated full timecourse". If you throw out the calibration, later the program will you ask you which segment to calibrate off of instead. You should pick a segment nearby the segment with the missing calibration.

When you are done, the calibration will be saved to a matlab structure that has a field for horizontal/vertical eye position in degrees of visual angle and also has a field for pupil diameter.

Note that the program is always trying to use the difference between the pupil and corneal reflection as the eye position trace (not the one that the ASL system computes, called horz_gaze_coord since that one sometimes has some weird artifcats in it...) There are times when you may have good pupil information but not a good corneal reflection and may want to do use the pupil only. When you want to do that, you can do:

eyepos = calibeyd('xx070530','hTrace=pupilH','vTrace=pupilV');

or for the corneal reflection trace

eyepos = calibeyd('xx070530','hTrace=cornealReflectionH','vTrace=cornealReflectionV');

Also, the program will put a nan into your trace every time the eye tracker lost the eye position information. It knows this by checking the status field that tells it when the pupil lock or corneal reflection lock was lost and also throws out data when the pupil diameter hits 0. Since usually this means neighboring time points are also bad, it throws out time points on either side of the lost data. Usually it throws out 2 time points, but you can set that with the variable dilationSize. If you want to not throw out any data on either side, do:

calibeyd('xx070530','dilationSize=0');

[edit] Free Surfer

[edit] Installation

Install a copy of FreeSurfer on your machine. You can do this by downloading from the website:

http://surfer.nmr.mgh.harvard.edu/

Or, copy the folder /Applications/freesurfer from a computer that has installed FreeSurfer to your Applications folder (make sure the computer has the same processor type -- i.e. Intel or G5).

Next, set up your environment variables properly. You can do this by adding to your .cshrc.mine file the following lines:

setenv FREESURFER_HOME /Applications/freesurfer
if (-d $FREESURFER_HOME) then
   setenv SUBJECTS_DIR    /Volumes/CBIV2/Heegerlab/anatomy
   setenv MINC_BIN_DIR     ${FREESURFER_HOME}/mni/bin
   setenv MINC_LIB_DIR     ${FREESURFER_HOME}/mni/lib
   setenv MNI_INSTALL_DIR /Applications/freesurfer/mni
   source $FREESURFER_HOME/SetUpFreeSurfer.csh >/dev/null
endif

Make sure to change the SUBJECTS_DIR in the above to the directory where you keep the anatomies.

[edit] Running segmentation

To run a segmentation, use the following command

recon-all -subject fp -i fp19750105/FP-centered.hdr -all

Where fp is a directory name that you want to be created, and fp19750105/FP-centered.hdr is the name of your 3D volume

[edit] Importing segmentation to MLR

When the segmentation is done, FreeSurfer should have made a whole bunch of directories. In particular, under mri you can see some new volumes that it has made in its own format under mri. This is not very important, but if you want to take a look at them, you can use the command:

tkmedit fp rawavg.mgz

The real happiness is the surfaces generated in the folder surf. You should see some surface for the left and right hemispheres named lh_* and rh_*. In particular, we are interested in the pial surface (lh_pial), the white matter surface (lh_smoothwm), and the inflated surface (lh_inflated). It should have also created a 3D anatomy file in mri/T1.mgz.

We next need to convert this to the surfRelax format that MLR needs. To do this cd into the directory that freeSurfer made and run mlrImportFreeSurfer:

>> cd fp
>> mlrImportFreeSurfer

The default parameters should be good (just click OK) and it should do the conversion and save everything in the directory surfRelax.

[edit] Wiki page

Lives on agni.cns.nyu.edu in the directory /usr/share/mediawiki

Personal tools