Opticka 2.16.1
Opticka is an experiment manager for behavioral research.
Loading...
Searching...
No Matches
dotlineStimulus Class Reference

Show lines made of dots. More...

Detailed Description

Show lines made of dots.

Class providing basic structure for dotline (texture) stimulus classes. You can control multiple aspects of the image presentation, and scale images to values in degrees, rotate them, animate them etc.

Copyright ©2014-2024 Ian Max Andolina — released: LGPL3, see LICENCE.md

Inheritance diagram for dotlineStimulus:

Public Member Functions

function dotlineStimulus (in varargin)
 Class constructor.
 
function setup (in me, in sM)
 Setup this object in preperation for use When displaying a stimulus object, the main properties that are to be modified are copied into cache copies of the property, both to convert from visual description (c/d, Hz, degrees) to computer metrics; and to be animated and modified as independant variables. So xPosition is copied to xPositionOut and converted from degrees to pixels. The animation and drawing functions use these modified properties, and when they are updated, for example to change to a new xPosition, internal methods ensure reconversion and update any dependent properties. This method initialises the object in preperation for display.
 
function set_xPositionOut (in me, in value)
 
function set_yPositionOut (in me, in value)
 
function set_sizeOut (in me, in value)
 
function makeLine (in me)
 Make the line texture.
 
function update (in me)
 Update this stimulus object structure for screenManager.
 
function draw (in me, in win)
 Draw this stimulus object.
 
function animate (in me)
 Animate this stimulus object.
 
function reset (in me)
 Reset this object.
 
- Public Member Functions inherited from baseStimulus
virtual setup (in runObject)
 ALL Children must implement these 5 methods!
 
virtual draw (in runObject)
 draw to the screen buffer, ready for flip()
 
function baseStimulus (in varargin)
 Class constructor.
 
function set colour (in me, in value)
 colour set method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour
 
function set alpha (in me, in value)
 alpha set method
 
function get delta (in me)
 delta Get method delta is the normalised number of pixels per frame to move a stimulus
 
function get dX (in me)
 dX Get method X position increment for a given delta and angle
 
function get dY (in me)
 dY Get method Y position increment for a given delta and angle
 
function show (in me)
 Method to set isVisible=true.
 
function hide (in me)
 Method to set isVisible=false.
 
function setOffTime (in me, in time)
 set offTime
 
function setDelayTime (in me, in time)
 set delayTime
 
function resetTicks (in me)
 reset the various tick counters for our stimulus
 
function getMousePosition (in me)
 get mouse position we make sure this is only called once per animation tick to improve performance and ensure all stimuli that are following mouse position have consistent X and Y per frame update This sets mouseX and mouseY and mouseValid if mouse is within PTB screen (useful for mouse override positioning for stimuli)
 
function run (in me, in benchmark, in runtime, in s, in forceScreen, in showVBL)
 Run stimulus in a window to preview it.
 
function makePanel (in me, in parent)
 make a GUI properties panel for this object
 
function selectFilePanel (in me, in varargin)
 read values from a GUI properties panel for this object
 
function readPanel (in me, in varargin)
 read values from a GUI properties panel for this object
 
function showPanel (in me)
 show GUI properties panel for this object
 
function hidePanel (in me)
 hide GUI properties panel for this object
 
function closePanel (in me, in varargin)
 close GUI panel for this object
 
function cleanHandles (in me, in ignoredArg)
 clean any handles
 
function getP (in me, in name, in range)
 gets a property copy or original property
 
function setP (in me, in name, in value)
 sets a property copy or original property
 
function updateXY (in me, in x, in y, in useDegrees)
 Update only position info, faster and doesn't reset image etc.
 
- Public Member Functions inherited from optickaCore
function optickaCore (in varargin)
 Class constructor.
 
function get fullName (in me)
 
function getALF (in me, in subject, in sessionPrefix, in lab, in create)
 
function findAttributes (in me, in attrName, in attrValue)
 
function findAttributesandType (in me, in attrName, in attrValue, in type)
 find properties of object with specific attributes, for example all properties whose GetAcccess attribute is public and type is logical.
 
function findPropertyDefault (in me, in propName)
 
function clone (in me)
 Use this syntax to make a deep copy of the object, i.e. OBJ_OUT has the same field values, but will not behave as a handle-copy of me anymore.
 
function checkSuperclasses (in List)
 
function editProperties (in me, in properties)
 method to modify a set of properties
 
function setProp (in me, in property, in value)
 method to fast change a particular value. This is useful for use in anonymous functions, like in the state machine.
 
function initialiseGlobals (in me, in doReset, in doOpen)
 
function initialiseSaveFile (in me)
 Initialise Save prefix.
 
function checkPaths (in me)
 checks the paths are valid
 

Public Attributes

Property type
 stimulus type: 'circle', 'square'
 
Property itemSize
 item size
 
Property itemDistance
 inter-item distance
 
Property phase
 phase (0 - 360)
 
Property direction
 direction for motion of the image, different to angle
 
Property forceOrthogonal
 force the angle to be orthogonal to the direction
 
Property useEven
 use even and odd colours?
 
Property colour2
 even colour
 
Property contrast
 contrast multiplier
 
Property randomShift
 random shift in degrees (diameter)
 
Property shiftTime
 random shift every N time in seconds
 
Property precision
 precision: 0 = 8bit | 1 = 16bit | 2 = 32bit
 
Property specialFlags
 
Property filter
 
Property scale
 scale is set by size
 
Property matrix
 
Property width
 pixel width
 
Property height
 pixel height
 
Property baseColour
 base colour (usually the background of the screen)
 
Property family
 
Property typeList
 
Property interpMethodList
 
Property ignorePropertiesUI
 properties to ignore in the UI
 
Property filePath
 
- Public Attributes inherited from baseStimulus
Property type
 stimulus type
 
Property xPosition
 
Property yPosition
 
Property size
 
Property colour
 
Property alpha
 Alpha (opacity) [0-1], this gets combined with the RGB colour.
 
Property startPosition
 
Property speed
 
Property angle
 angle in degrees (0 - 360)
 
Property delayTime
 
Property offTime
 time to turn stimulus off, relative to stimulus onset
 
Property isVisible
 true or false, whether to draw() this object
 
Property mouseOverride
 override X and Y position with mouse input? Useful for RF mapping
 
Property showOnTracker
 show the position on the Eyetracker display?
 
Property verbose
 Do we log extra details to the command-line?
 
Property xFinal
 
Property yFinal
 
Property mvRect
 
Property szIsPx
 
Property szPx
 computed size in pixels
 
Property szD
 computed size in °
 
Property xFinalD
 X and Y position in °
 
Property yFinalD
 
Property isRect
 
Property tick
 tick updates +1 on each call of draw (even if delay or off is true and no stimulus is drawn, resets on each update
 
Property drawTick
 draw tick only updates when a draw is actually performed, resets on each update
 
Property ppd
 pixels per degree (normally inhereted from screenManager)
 
Property delta
 What our per-frame motion delta is.
 
Property dX
 X update which is computed from our speed and angle.
 
Property dY
 X update which is computed from our speed and angle.
 
- Public Attributes inherited from optickaCore
Property name
 object name
 
Property comment
 comment
 
Property verbose
 verbose logging, subclasses must assign this. This is normally logical true/false
 
Property dateStamp
 clock() dateStamp set on construction
 
Property uuid
 universal ID
 
Property paths
 storage of various paths
 
Property fullName
 The fullName is the object name combined with its uuid and class name.
 

Protected Member Functions

function mix (in me, in c)
 linear interpolation between two arrays
 
function isOdd (in ignoredArg, in n)
 
- Protected Member Functions inherited from baseStimulus
function addRuntimeProperties (in me)
 These are transient properties that specify actions during runtime.
 
function updateRuntimeProperties (in me)
 Update transient properties that specify actions during runtime.
 
function computePosition (in me)
 compute xFinal and yFinal (in pixels) taking startPosition, xPosition, yPosition and direction/angle into account
 
function setAnimationDelta (in me)
 
function setRect (in me)
 
function toStructure (in me, in tmp)
 Converts properties to a structure.
 
function removeTmpProperties (in me)
 Finds and removes dynamic properties.
 
function delete (in me)
 
- Protected Member Functions inherited from optickaCore
function parseArgs (in me, in args, in allowedProperties)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function addArgs (in me, in args)
 
function setPaths (in me)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function getFonts (in me)
 set paths for object
 
function toStructure (in me)
 Converts properties to a structure.
 
function getType (in me, in in)
 
function logOutput (in me, in in, in message, in override)
 Give a metaproperty return the likely property class.
 
function salutation (in me, in varargin)
 Prints messages dependent on verbosity.
 

Protected Attributes

Property pRect
 
Property randomTick
 
Property thisFlashTick
 
Property allowedProperties
 allowed properties passed to object upon construction
 
Property ignoreProperties
 properties to not create transient copies of during setup phase
 
- Protected Attributes inherited from baseStimulus
Property family
 the stimulus family (grating, dots etc.)
 
Property texture
 Our texture pointer for texture-based stimuli.
 
Property handles
 handles for the GUI
 
Property sM
 our screen manager
 
Property animator
 animation manager
 
Property screenVals
 screen settings generated by sM on setup
 
Property isSetup
 
Property isGUI
 is panel constructed?
 
Property dstRect
 initial screen rectangle position [LEFT TOP RIGHT BOTTOM]
 
Property mouseValid
 is mouse position within screen co-ordinates?
 
Property mouseX
 mouse X position
 
Property mouseY
 mouse Y position
 
Property delayTicks
 delay ticks to wait until display
 
Property offTicks
 ticks before stimulus turns off
 
Property inSetup
 are we setting up?
 
Property delta_
 delta cache
 
Property dX_
 dX cache
 
Property dY_
 dY cache
 
Property isInSetColour
 deal with interaction of colour and alpha
 
Property setLoop
 
Property ignorePropertiesBase
 Which properties to ignore cloning when making transient copies in setup.
 
Property ignorePropertiesUIBase
 Which properties to not draw in the UI panel.
 
- Protected Attributes inherited from optickaCore
Property cloning
 are we cloning this from another object
 
Property mversion
 Matlab version number, this is transient so it is not saved.
 
Property sansFont
 sans font
 
Property monoFont
 monoFont
 
Property className
 class name
 
Property savePrefix
 save prefix generated from clock time
 
Property fullName_
 cached full name
 

Additional Inherited Members

- Public Types inherited from baseStimulus
enum  Events { readPanelUpdate }
 
- Static Public Member Functions inherited from baseStimulus
static function d2r (in degrees)
 degrees2radians
 
static function r2d (in r)
 radians2degrees
 
static function findDistance (in x1, in y1, in x2, in y2)
 findDistance in X and Y coordinates
 
static function updatePosition (in delta, in angle)
 updatePosition returns dX and dY given an angle and delta
 
- Static Public Member Functions inherited from optickaCore
static function makeArgs (in args)
 Converts cell args to structure array.
 
static function addDefaults (in args, in defs)
 add default options to arg input
 
static function hasKey (in in, in key)
 check if a struct / object has a propery / field
 
static function getKeys (in device)
 PTB Get key presses, stops key bouncing.
 

Constructor & Destructor Documentation

◆ dotlineStimulus()

function dotlineStimulus::dotlineStimulus ( in  varargin)

Class constructor.

This parses any input values and initialises the object.

Parameters
vararginare passed as a list of parametoer or a structure of properties which is parsed.
Returns
instance of class.

Member Function Documentation

◆ animate()

function dotlineStimulus::animate ( in  me)
virtual

Animate this stimulus object.

Reimplemented from baseStimulus.

◆ draw()

function dotlineStimulus::draw ( in  me,
in  win 
)

Draw this stimulus object.

◆ isOdd()

function dotlineStimulus::isOdd ( in  ignoredArg,
in  n 
)
protected

◆ makeLine()

function dotlineStimulus::makeLine ( in  me)

Make the line texture.

◆ mix()

function dotlineStimulus::mix ( in  me,
in  c 
)
protected

linear interpolation between two arrays

◆ reset()

function dotlineStimulus::reset ( in  me)
virtual

Reset this object.

Reimplemented from baseStimulus.

◆ set_sizeOut()

function dotlineStimulus::set_sizeOut ( in  me,
in  value 
)

◆ set_xPositionOut()

function dotlineStimulus::set_xPositionOut ( in  me,
in  value 
)

◆ set_yPositionOut()

function dotlineStimulus::set_yPositionOut ( in  me,
in  value 
)

◆ setup()

function dotlineStimulus::setup ( in  me,
in  sM 
)

Setup this object in preperation for use When displaying a stimulus object, the main properties that are to be modified are copied into cache copies of the property, both to convert from visual description (c/d, Hz, degrees) to computer metrics; and to be animated and modified as independant variables. So xPosition is copied to xPositionOut and converted from degrees to pixels. The animation and drawing functions use these modified properties, and when they are updated, for example to change to a new xPosition, internal methods ensure reconversion and update any dependent properties. This method initialises the object in preperation for display.

Parameters
sMscreenManager object for reference

◆ update()

function dotlineStimulus::update ( in  me)
virtual

Update this stimulus object structure for screenManager.

Reimplemented from baseStimulus.

Member Data Documentation

◆ allowedProperties

Property dotlineStimulus::allowedProperties
protected

allowed properties passed to object upon construction

◆ baseColour

Property dotlineStimulus::baseColour

base colour (usually the background of the screen)

◆ colour2

Property dotlineStimulus::colour2

even colour

◆ contrast

Property dotlineStimulus::contrast

contrast multiplier

◆ direction

Property dotlineStimulus::direction

direction for motion of the image, different to angle

◆ family

Property dotlineStimulus::family

◆ filePath

Property dotlineStimulus::filePath

◆ filter

Property dotlineStimulus::filter

How to compute the pixel color values when the texture is drawn magnified, minified or drawn shifted, e.g., if sourceRect and destinationRect do not have the same size or if sourceRect specifies fractional pixel values. 0 = Nearest neighbour filtering, 1 = Bilinear filtering - this is the default. Values 2 or 3 select use of OpenGL mip-mapping for improved quality: 2 = Bilinear filtering for nearest mipmap level, 3 = Trilinear filtering across mipmap levels, 4 = Nearest neighbour filtering for nearest mipmap level, 5 = nearest neighbour filtering with linear interpolation between mipmap levels. Mipmap filtering is only supported for GL_TEXTURE_2D textures (see description of 'specialFlags' flag 1 below). A negative filterMode value will also use mip-mapping for fast drawing of blurred textures if the GL_TEXTURE_2D format is used: Mip-maps are essentially image resolution pyramids, the filterMode value selects a specific layer in that pyramid. A value of -1 draws the highest resolution layer, a value of -2 draws a half-resolution layer, a value of -3 draws a quarter resolution layer and so on. Each layer has half the resolution of the preceeding layer. This allows for very fast drawing of blurred or low-pass filtered images, e.g., for gaze-contingent displays.

◆ forceOrthogonal

Property dotlineStimulus::forceOrthogonal

force the angle to be orthogonal to the direction

◆ height

Property dotlineStimulus::height

pixel height

◆ ignoreProperties

Property dotlineStimulus::ignoreProperties
protected

properties to not create transient copies of during setup phase

◆ ignorePropertiesUI

Property dotlineStimulus::ignorePropertiesUI

properties to ignore in the UI

◆ interpMethodList

Property dotlineStimulus::interpMethodList

◆ itemDistance

Property dotlineStimulus::itemDistance

inter-item distance

◆ itemSize

Property dotlineStimulus::itemSize

item size

◆ matrix

Property dotlineStimulus::matrix

◆ phase

Property dotlineStimulus::phase

phase (0 - 360)

◆ precision

Property dotlineStimulus::precision

precision: 0 = 8bit | 1 = 16bit | 2 = 32bit

◆ pRect

Property dotlineStimulus::pRect
protected

◆ randomShift

Property dotlineStimulus::randomShift

random shift in degrees (diameter)

◆ randomTick

Property dotlineStimulus::randomTick
protected

◆ scale

Property dotlineStimulus::scale

scale is set by size

◆ shiftTime

Property dotlineStimulus::shiftTime

random shift every N time in seconds

◆ specialFlags

Property dotlineStimulus::specialFlags

special flags: 0 = hardware filter, 2 = PTB filter, 4 = fast texture creation, 8 = prevent auto mip-map generation, 32 = stop Screen('Close') clearing texture

◆ thisFlashTick

Property dotlineStimulus::thisFlashTick
protected

◆ type

Property dotlineStimulus::type

stimulus type: 'circle', 'square'

◆ typeList

Property dotlineStimulus::typeList

◆ useEven

Property dotlineStimulus::useEven

use even and odd colours?

◆ width

Property dotlineStimulus::width

pixel width


The documentation for this class was generated from the following file: