Opticka 2.18.1
Opticka is an experiment manager for behavioral research.
Loading...
Searching...
No Matches
aprilTagStimulus Class Reference

Texture-backed binary checkerboard / AprilTag-style stimulus. More...

Detailed Description

Texture-backed binary checkerboard / AprilTag-style stimulus.

This stimulus builds a binary MATLAB array either from a user-defined patternMatrix or by randomly generating 0/1 values for rows x columns. It then maps the binary values to colour and colour2, creates a PTB texture via ‘Screen('MakeTexture’,...)`, and draws it as a standard texture stimulus.

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

Inheritance diagram for aprilTagStimulus:

Public Member Functions

function aprilTagStimulus (in varargin)
 Class constructor.
 
function setup (in me, in sM)
 Setup this stimulus object in preparation for display.
 
function set_xPositionOut (in me, in value)
 
function set_yPositionOut (in me, in value)
 
function set_alphaOut (in me, in value)
 
function update (in me)
 Update this stimulus object for display.
 
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 back to pre-setup state.
 
function set colour2 (in me, in value)
 SET colour2 method.
 
function getAprilTag (in me, in tagID)
 
- 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 lab, in create)
 get the ALF path
 
function makeReport (in me, in rpt)
 Generate a detailed report for the opticka object.
 
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)
 Return the declared default value for a class property.
 
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 initialiseSaveFile (in me, in varargin)
 just get date fragment for backwards compatibility
 
function checkPaths (in me)
 checks the paths are valid
 

Public Attributes

Property type
 stimulus type
 
Property rows
 number of rows for generated patterns
 
Property columns
 number of columns for generated patterns
 
Property patternMatrix
 user supplied binary matrix of 0s and 1s, if empty generate one
 
Property randomisePattern
 generate a new random pattern on update if no fixed patternMatrix is set
 
Property colour2
 second colour used for binary value 1
 
Property filter
 filter mode for DrawTexture, 0 keeps edges crisp
 
Property precision
 texture precision: 0=8-bit | 1=16-bit | 2=32-bit
 
Property specialFlags
 special flags passed to MakeTexture / DrawTexture
 
Property direction
 direction for motion of the texture object
 
Property cellSize
 number of pixels per binary cell in the generated texture matrix
 
Property binaryMatrix
 current binary matrix used to generate the texture
 
Property matrix
 RGBA matrix passed to MakeTexture.
 
Property width
 texture width in pixels
 
Property height
 texture height in pixels
 
Property scale
 scale used when size is set in degrees
 
Property widthD
 width in degrees at native texture scale
 
Property heightD
 height in degrees at native texture scale
 
Property family
 stimulus family
 
Property typeList
 visible in UI lists
 
Property ignorePropertiesUI
 properties to ignore in the UI panel
 
Constant Property tag36_11 = [1 1 1 1 1 1 1 1 1 1
 
Constant Property tag36_20 = [1 1 1 1 1 1 1 1 1 1
 
Constant Property tag36_34 = [1 1 1 1 1 1 1 1 1 1
 
Constant Property tag36_46 = [1 1 1 1 1 1 1 1 1 1
 
Constant Property tag36_52 = [1 1 1 1 1 1 1 1 1 1
 
Constant Property tag36_65 = [1 1 1 1 1 1 1 1 1 1
 
- 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 optickaVersion
 version number
 
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 buildTexture (in me)
 Create or rebuild the binary texture.
 
function resolvePattern (in me)
 Resolve the active binary pattern.
 
function validatePattern (in me, in in)
 Validate a binary pattern matrix.
 
function makePatternMatrix (in me, in pattern)
 Convert the binary pattern to an RGBA texture matrix.
 
function setRect (in me)
 setRect makes the PsychRect based on the texture and screen values.
 
- 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 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 mixColour (in c1, in c2, in contrast)
 linear interpolation between two colour arrays based on a contrast
 
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 initialiseGlobals (in doReset, in doOpen)
 
static function makeArgs (in args)
 Converts cell args to structure array.
 
static function addDefaults (in args, in defs)
 regularises and adds 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

◆ aprilTagStimulus()

function aprilTagStimulus::aprilTagStimulus ( in  varargin)

Class constructor.

Parameters
vararginare passed as a list of parameter/value pairs or a structure of properties which is parsed.
Returns
instance of class.

Member Function Documentation

◆ animate()

function aprilTagStimulus::animate ( in  me)
virtual

Animate this stimulus object.

Reimplemented from baseStimulus.

◆ buildTexture()

function aprilTagStimulus::buildTexture ( in  me)
protected

Create or rebuild the binary texture.

◆ colour2()

function set aprilTagStimulus::colour2 ( in  me,
in  value 
)

SET colour2 method.

Allow 1 (R=G=B), 3 (RGB) or 4 (RGBA) values.

◆ draw()

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

Draw this stimulus object.

Parameters
winoptional offscreen window pointer.

◆ getAprilTag()

function aprilTagStimulus::getAprilTag ( in  me,
in  tagID 
)

◆ makePatternMatrix()

function aprilTagStimulus::makePatternMatrix ( in  me,
in  pattern 
)
protected

Convert the binary pattern to an RGBA texture matrix.

Parameters
patternbinary 0/1 matrix.
Returns
out RGBA image matrix.

◆ reset()

function aprilTagStimulus::reset ( in  me)
virtual

Reset this object back to pre-setup state.

Reimplemented from baseStimulus.

◆ resolvePattern()

function aprilTagStimulus::resolvePattern ( in  me)
protected

Resolve the active binary pattern.

Returns
out binary 0/1 matrix.

◆ set_alphaOut()

function aprilTagStimulus::set_alphaOut ( in  me,
in  value 
)

◆ set_xPositionOut()

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

◆ set_yPositionOut()

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

◆ setRect()

function aprilTagStimulus::setRect ( in  me)
protected

setRect makes the PsychRect based on the texture and screen values.

◆ setup()

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

Setup this stimulus object in preparation for display.

Parameters
sMscreenManager object for reference.

◆ update()

function aprilTagStimulus::update ( in  me)
virtual

Update this stimulus object for display.

Reimplemented from baseStimulus.

◆ validatePattern()

function aprilTagStimulus::validatePattern ( in  me,
in  in 
)
protected

Validate a binary pattern matrix.

Parameters
incandidate pattern matrix.
Returns
out validated binary matrix.

Member Data Documentation

◆ allowedProperties

Property aprilTagStimulus::allowedProperties
protected

allowed properties passed to object upon construction

◆ binaryMatrix

Property aprilTagStimulus::binaryMatrix

current binary matrix used to generate the texture

◆ cellSize

Property aprilTagStimulus::cellSize

number of pixels per binary cell in the generated texture matrix

◆ colour2

Property aprilTagStimulus::colour2

second colour used for binary value 1

◆ columns

Property aprilTagStimulus::columns

number of columns for generated patterns

◆ direction

Property aprilTagStimulus::direction

direction for motion of the texture object

◆ family

Property aprilTagStimulus::family

stimulus family

◆ filter

Property aprilTagStimulus::filter

filter mode for DrawTexture, 0 keeps edges crisp

◆ height

Property aprilTagStimulus::height

texture height in pixels

◆ heightD

Property aprilTagStimulus::heightD

height in degrees at native texture scale

◆ ignoreProperties

Property aprilTagStimulus::ignoreProperties
protected

properties to not create transient copies of during setup phase

◆ ignorePropertiesUI

Property aprilTagStimulus::ignorePropertiesUI

properties to ignore in the UI panel

◆ matrix

Property aprilTagStimulus::matrix

RGBA matrix passed to MakeTexture.

◆ patternMatrix

Property aprilTagStimulus::patternMatrix

user supplied binary matrix of 0s and 1s, if empty generate one

◆ precision

Property aprilTagStimulus::precision

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

◆ randomisePattern

Property aprilTagStimulus::randomisePattern

generate a new random pattern on update if no fixed patternMatrix is set

◆ rows

Property aprilTagStimulus::rows

number of rows for generated patterns

◆ scale

Property aprilTagStimulus::scale

scale used when size is set in degrees

◆ specialFlags

Property aprilTagStimulus::specialFlags

special flags passed to MakeTexture / DrawTexture

◆ tag36_11

Constant Property aprilTagStimulus::tag36_11 = [1 1 1 1 1 1 1 1 1 1

◆ tag36_20

Constant Property aprilTagStimulus::tag36_20 = [1 1 1 1 1 1 1 1 1 1

◆ tag36_34

Constant Property aprilTagStimulus::tag36_34 = [1 1 1 1 1 1 1 1 1 1

◆ tag36_46

Constant Property aprilTagStimulus::tag36_46 = [1 1 1 1 1 1 1 1 1 1

◆ tag36_52

Constant Property aprilTagStimulus::tag36_52 = [1 1 1 1 1 1 1 1 1 1

◆ tag36_65

Constant Property aprilTagStimulus::tag36_65 = [1 1 1 1 1 1 1 1 1 1

◆ type

Property aprilTagStimulus::type

stimulus type

◆ typeList

Property aprilTagStimulus::typeList

visible in UI lists

◆ width

Property aprilTagStimulus::width

texture width in pixels

◆ widthD

Property aprilTagStimulus::widthD

width in degrees at native texture scale


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