Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
IsabelV

Junior Member
Registered:
Posts: 21
Reply with quote  #1 
Hi Jaewon,
Is there an easy way to detect blinks on real time, such that the trial is marked as "wrong" if there is a blink within the response time window?
If that is possible to do, I could include it my ML task code. Otherwise, I will do it in offline analyses.
Thank you very much.

0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #2 
Please describe in what circumstance you want to detect blinks. Usually you know there was a blink if fixation was broken.

And how are you tracking eye positions?
0
IsabelV

Junior Member
Registered:
Posts: 21
Reply with quote  #3 
I am using a fixation window (wait then hold command) to make sure fixation is being held for a certain period. A target appears somewhere else, and the task requires to make an eye movement towards that target location. If this happens, the trial is rewarded. However, I have noticed that sometimes there can be a "blink" but still followed by an eye movement to the target. The "response period" to reach the target is 1000ms, so there is plenty of time to blink, and still make the correct eye movement to the target location.
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #4 
I am using an Arrington eye tracker which takes shots of eye images fast and calculates the gaze direction with image processing. Are you using a similar tech? When there is a blink, my eye tracker loses eye signals and its voltage output goes to a sort of a null state. For example, when the voltage range is set to -5V to 5V, the eye signal normally changes between 1V to 3V, but, when the subject blinks, both x and y channels briefly become close to -5V, like -4.95V.

If your eye tracker works in a similar way, you can tell when blinks occur by picking up such voltage changes. Please take a look at the eye traces of your data and see if there is some characteristic of blinks you can use, like the example I just mentioned. You probably need to do the same thing when you detect blinks offline. So you can tell me how you were going to analyze blinks offline.
0
IsabelV

Junior Member
Registered:
Posts: 21
Reply with quote  #5 
I am using the eye tracker SR-1000. I see what you mean, that's how I am analyzing the eye movements offline, by looking at the analog (x, y data) signal converted to degrees of visual angle, etc, and in blinks this signal goes to the most negative value ~-10, in my case. I will try to implement a line of code that does this "live" then. Thank you very much Jaewon!
0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #6 
The attached is an adapter that does what I described above and an example code is below.

----- BEGINNING OF EXAMPLE CODE -----
fix1 = SingleTarget(eye_);
fix1.Target = [0 0];
fix1.Threshold = 3;
wth1 = WaitThenHold(fix1);
wth1.WaitTime = 5000;
wth1.HoldTime = 1000;
bd1 = BlinkDetector(wth1);
bd1.XRange = [-10.5 -9.5];   % [min max] in degrees
bd1.YRange = [-10.5 -9.5];   % [min max] in degrees
bd1.StopOnDetection = true;  % if true, abort the trial on blinking

scene1 = create_scene(bd1);

run_scene(scene1);

if bd1.Detected
    trialerror(9);  % blink detected
else
    if wth1.Success
        trialerror(0);  % success
    else
        if wth1.Waiting
            trialerror(4);  % no fixation
        else
            trialerror(3);  % fixation break
        end
    end
end
----- END OF EXAMPLE CODE -----

 
Attached Files
m BlinkDetector.m (2.16 KB, 1 views)

0
IsabelV

Junior Member
Registered:
Posts: 21
Reply with quote  #7 
Thank you Jaewon.

I am trying it out. I get the following error. Any ideas, what could be going on?

Matrix dimensions must agree.

Error in mlcalibrate/deg2pix (line 108)
xy = xy .* repmat(obj.ppd,n,1) + repmat(obj.sshalf,n,1);

Error in BlinkDetector/init (line 48)
obj.Rect = obj.Tracker.CalFun.deg2pix([obj.XRange(1) obj.YRange(1) obj.XRange(2) obj.YRange(2)]);

Error in MGS_task_runtime/create_scene (line 102)
adapter.init(param_);

Error in MGS_task_runtime (line 953)
scene4=create_scene(bd1);

Error in run_trial (line 113)
runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 1146)
result = run_trial(MLConfig,datafile);

0
Jaewon

Administrator
Registered:
Posts: 971
Reply with quote  #8 
It is written for the latest version of ML. To make it work with your version, modify Line 48 of BlinkDetector.m like the following.

From
     obj.Rect = obj.Tracker.CalFun.deg2pix([obj.XRange(1) obj.YRange(1) obj.XRange(2) obj.YRange(2)]);

To
    obj.Rect = [obj.Tracker.CalFun.deg2pix([obj.XRange(1) obj.YRange(1)]) obj.Tracker.CalFun.deg2pix([obj.XRange(2) obj.YRange(2)])];
0
IsabelV

Junior Member
Registered:
Posts: 21
Reply with quote  #9 
It works! Thank you very much Jaewon.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.