Welcome! Log In Create A New Profile

Advanced

mouse_position

Posted by bts 
bts
mouse_position
July 30, 2020 08:30PM
Hi Jaewon,

I currently have an eye-tracking task written that will display a fixation cue at the mouse cursor position (left click will display a box, right click will display an image). We have a three-monitor setup, where Monitor 1 has the control panel/control screen, and Monitors 2 and 3 both display the subject screen. Monitor 2 is next to Monitor 1, outside the booth, so we can see what the monkey sees, while Monitor 3 is in the booth for the monkey.

The task works great in simulation mode, as it reads the mouse position within the control screen (Monitor 1, what we want). When actually eye tracking (simulation off), it instead reads the mouse position within the subject screen (Monitor 2). This means that to display a fixation cue in the center of the screen for the monkey (Monitor 3), we must click in the center of the subject screen (Monitor 2). This is not what we want, as it means the monkey can see the mouse cursor (and even if we were to turn off the cursor, we wouldn't know where we are on the screen).

What we want is to click in the control screen on Monitor 1 and have the cue display in that position on Monitors 2 and 3. As I mentioned, this works as described in simulation mode, but not when simulation mode is turned off.
Re: mouse_position
July 31, 2020 09:43AM
First of all, the behavior of NIMH ML that you are talking about is perfectly normal and made it that way by design. You think that you are controlling the task with keyboard and mouse, but, in fact, the keyboard and mouse are tools for subjects to report responses with. So you are actually borrowing them from subjects.

NIMH ML displays visual stimuli both on the subject and control screen so that your Monitor 2 is not necessary, so assume that you don't have Monitor 2. In the simulation mode, you are sitting in front of the control screen (Monitor 1) and playing the role of a subject for a testing purpose, so the responses you are making are interpreted in terms of the control screen's dimensions. When the simulation mode is off, however, the task is supposed to be performed by a real subject who is looking at the subject screen (Monitor 3), so the units of measurement, like visual degrees, should be based on the subject screen's dimensions.

With the simulation mode off, mouse_position() returns visual degrees from the subject's viewpoint. To get the degree positions from the experimenter's viewpoint, you need to get raw xy positions of the mouse cursor and convert them to degrees yourself. Update your NIMH ML to use the following code, since the previous versions do not accept the 'raw' argument in mouse_position().
mouse_position                             % visual degrees from the subject's viewpoint
EyeCal.control2deg(mouse_position('raw'))  % visual degrees from the experimenter's viewpoint

For more information about coordinate conversions, see the link below.
https://monkeylogic.nimh.nih.gov/board/read.php?2,37,37#msg-37
bts
Re: mouse_position
July 31, 2020 04:42PM
Thank you Jaewon, it works perfectly.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.