Use Matlab Built in drawFreehand ROI at the same time as Psychtoolbox

Hi all,

I’m trying to program an experiment in which the participant is asked to circle what they think are the relevant areas on an image. I want these to be free-form closed shapes. Matlab has a built-in function that would work wonderfully (drawFreehand, which you call after using imshow to pull up the image. Is there a way to pull up imshow on top of psychtoolbox? Otherwise, does anyone have any ideas of how best to accomplish this?

This part of the experiment has to integrate with the other parts which require precise stimuli / response timing with EEG and eye-tracking triggers, which is why I’m using Psychtoolbox.

Thank you so much,

Sara

The recommended way is to not mix Matlab figures like imshow() with PTB onscreen windows, because that destroys precise and trustworthy visual stimulation timing. Have a look at MouseTraceDemo4.m which demos drawing some contour with the mouse. As long as you subjects can draw the contour in one go, that would allow you to do this in PTB only. Or you fancy it up a bit to deal with more complexity.

The only other way would be to use Linux. Open an onscreen window, do visual stimulation, then imshow() and drawFreehand to pop up the Matlab window on top of the PTB window. While that Matlab figure is visible, PTB’s visual timing would be broken. After you close the Matlab window though, PTB would eventually switch back into high precision timing mode, after a few 'Flip’s with botched timing possibly before the system switches back to high-precision.

On MS-Windows or Apples trainwreck it isn’t possible at all to mix Matlab figures and PTB windows without destroying timing precision for the remainder of an experiment session. You’d have to close the PTB onscreen window and reopen it to recover.

But i’d recommend using the method from MouseTraceDemo4.m to keep it all in PTB’s window and avoid mixing with Matlab display. That’s the most robust way if timing precision is important.

-mario

Awesome, thank you so much! That’s exactly what I ended up doing.

Cheers,

Sara