MATLAB Python

drawFunc_cursor

Syntax

[sample_bin, quit] = drawFunc_cursor(window, last_sample, draw_args, trial_bin, sample_bin)

Description

DRAWFUNC_CURSOR is an advanced draw_func that can be used with easyScale to power an interactive drawing environment. The user can draw and erase using the left and right mouse buttons, respectively. Devices other than a cursor could also be used, in principle, if they complied with the inputFunc_mouse output format. A background image or color can be added.

Usage

The current draw_func takes the standard form required by easyScale. The parameters that are fed to this function by easyScale are as follows: window: token for the window where the bar plot should be drawn. last_sample: timeseries object with recent history of responses (with dimensionality of [n 4], where n is any number of samples and m takes the form [x_pos y_pos l_button, r_button], as described in inputFunc_mouse). draw_args: parameters set by the calling experiment used to control the behaviour of this draw_func. 1: canvas_rect: a four-element rec [x_min y_min x_max y_max] used to set the boundaries of the drawing area. 2: brush_width: the diameter of the paintbrush to be used, in pixels. 3: brush_colour: a string or three-element numeric array describing a color, recognized by matlab, to be drawn by the paintbrush. 4: use_OS_cursor: when set to true, use the OS cursor for drawing; when false, a custom paintbrush image is used. trial_bin: the trial_bin is a cell array containing trial-specific information. DRAWFUNC_CURSOR uses the following element positions: 1: a filename pointing to a custom cursor (if called for in draw_args). 2: a filename pointing to a custom background image (if desired). 3: should contain a struct frame_info with field canvas_absOffset containing the [x y] offset of the canvas from the window corner (this parameter is kind of a mess -- sorry). sample_bin: the sample_bin is a two-element cell array containing sample-specific information. By convention, the first element is written to by input_funcs and the second written to by draw_funcs. DRAWFUNC_CURSOR writes a nan to the first draw_func element of the sample_bin to indicate that the trial has begun, but otherwise does not use the sample_bin. DRAWFUNC_CURSOR also returns sample_bin and quit as output, because these are required by easyScale. However, sample_bin is simply returned as it was provided in the input_args, and quit is a boolean that is always false.

Example Usage

For example usage of DRAWFUNC_CURSOR, please see demoEasyCursor_draw.