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

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

Detailed Description

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

single grating stimulus, inherits from baseStimulus GRATINGSTIMULUS single grating stimulus, inherits from baseStimulus The current properties are: sf = spatial frequency in degrees tf = temporal frequency angle = angle in degrees rotationMethod = do we rotate the grating texture (1) or the patch itself (0) phase = phase of grating contrast = contrast from 0 - 1 mask = use circular mask (1) or not (0) gabor = use a gabor rather than grating

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

Inheritance diagram for gaborStimulus:

Public Types

enum  Events { changeScale , changePhaseIncrement }
 
- Public Types inherited from baseStimulus
enum  Events { readPanelUpdate }
 

Public Member Functions

function gaborStimulus (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 converyed 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 for display.
 
function set_xPositionOut (in me, in value)
 
function set_yPositionOut (in me, in value)
 
function set_sfOut (in me, in value)
 
function set_tfOut (in me, in value)
 
function set_driftDirectionOut (in me, in value)
 
function set_sizeOut (in me, in value)
 
function update (in me)
 Update this stimulus object for display.
 
function draw (in me)
 Draw this stimulus object for display.
 
function animate (in me)
 Animate this object for runExperiment.
 
function reset (in me)
 Reset an structure for runExperiment.
 
function set sf (in me, in value)
 sf Set method
 
function calculatePhase (in me)
 calculate phase offset
 
- Public Member Functions inherited from baseStimulus
virtual setup (in runObject)
 ALL Children must implement these 5 methods!
 
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 sf
 spatial frequency
 
Property tf
 temporal frequency
 
Property rotationMethod
 rotate the object (0/false) or the texture (1/true)?
 
Property phase
 phase of grating
 
Property contrast
 contrast of grating
 
Property driftDirection
 reverse the drift direction?
 
Property direction
 the angle which the direction of the grating patch is moving
 
Property contrastMult
 Contrast Multiplier, 0.5 gives "standard" 0-1 contrast measure.
 
Property aspectRatio
 aspect ratio of the gabor
 
Property disableNorm
 should we disable normalisation of the gabor (generally TRUE)?
 
Property spatialConstant
 a divisor for the size for the gaussian envelope for a gabor
 
Property correctPhase
 do we need to correct the phase to be relative to center not edge?
 
Property phaseReverseTime
 reverse phase of grating X times per second?
 
Property phaseOfReverse
 What phase to use for reverse?
 
Property type
 type
 
Property family
 
Property scale
 scale is used when changing size as an independent variable to keep sf accurate
 
Property phaseIncrement
 the phase amount we need to add for each frame of animation
 
- 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 setRect (in me)
 setRect setRect makes the PsychRect based on the texture and screen values this is modified over parent method as gratings have slightly different requirements.
 
function calculateScale (in me, in ignoredArg, in ignoredArg)
 calculateScale Use an event to recalculate scale as get method is slower (called many more times), than an event which is only called on update
 
function calculatePhaseIncrement (in me, in ignoredArg, in ignoredArg)
 calculatePhaseIncrement Use an event to recalculate as get method is slower (called many more times), than an event which is only called on update
 
- 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 sfCache
 
Property sfRecurse
 to stop a loop between set method and an event
 
Property allowedProperties
 allowed properties passed to object upon construction
 
Property ignoreProperties
 properties to not create transient copies of during setup phase
 
Property phaseCounter
 how many frames between phase reverses
 
- 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

- 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.
 

Member Enumeration Documentation

◆ Events

Enumerator
changeScale 

triggered when changing size, so we can change sf etc to compensate

changePhaseIncrement 

triggered when changing tf or drift direction

148 :length(fn)
149 if ~matches(fn{j}, me.ignoreProperties) %create a temporary dynamic property
150 p = addprop(me, [fn{j} 'Out']);
151 if strcmp(fn{j},'sf'); p.SetMethod = @set_sfOut; end
152 if strcmp(fn{j},'tf')
153 p.SetMethod = @set_tfOut;
154 p.SetObservable = true;
155 addlistener(me, [fn{j} 'Out'], 'PostSet', @me.calculatePhaseIncrement);
156 end
157 if strcmp(fn{j},'driftDirection')
158 p.SetMethod = @set_driftDirectionOut;
159 p.SetObservable = true;
160 addlistener(me, [fn{j} 'Out'], 'PostSet', @me.calculatePhaseIncrement);
161 end
162 if strcmp(fn{j},'size')
163 p.SetMethod = @set_sizeOut;
164 p.SetObservable = true;
165 addlistener(me, [fn{j} 'Out'], 'PostSet', @me.calculateScale);
166 end
167 if strcmp(fn{j},'xPosition'); p.SetMethod = @set_xPositionOut; end
168 if strcmp(fn{j},'yPosition'); p.SetMethod = @set_yPositionOut; end
169 me.([fn{j} 'Out']) = me.(fn{j}); %copy our property value to our tempory copy
170 end
171 end
172
174
175 if ~isprop(me,'rotateMode'); addprop(me,'rotateMode'); end
176 if me.rotationMethod==1
177 me.rotateMode = kPsychUseTextureMatrixForRotation;
178 else
179 me.rotateMode = [];
180 end
181
182 if ~isprop(me,'gratingSize'); addprop(me,'gratingSize'); end
183 me.gratingSize = round(me.ppd*me.size);
184
185 if ~isprop(me,'phaseIncrement'); addprop(me,'phaseIncrement'); end
186
187 if ~isprop(me,'driftPhase'); addprop(me,'driftPhase'); end
188 if me.correctPhase
189 ps = me.calculatePhase;
190 me.driftPhase = me.phaseOut-ps;
191 else
192 me.driftPhase = me.phaseOut;
193 end
194
195 if ~isprop(me,'res'); addprop(me,'res'); end
196 me.res = [me.gratingSize me.gratingSize];
197
198 if me.phaseReverseTime > 0
199 me.phaseCounter = round(me.phaseReverseTime / me.sM.screenVals.ifi);
200 end
201
202 if me.aspectRatio == 1
203 nonSymmetric = 0;
204 else
205 nonSymmetric = 1;
206 end
207 me.texture = CreateProceduralGabor(me.sM.win, me.res(1),...
208 me.res(2), nonSymmetric, me.colourOut, me.disableNorm,...
209 me.contrastMult);
210
211 me.inSetup = false; me.isSetup = true;
212
213 notify(me,'changeScale');
214 computePosition(me);
215 setRect(me);
216
217 function set_xPositionOut(me, value)
218 me.xPositionOut = value * me.ppd;
219 end
220 function set_yPositionOut(me,value)
221 me.yPositionOut = value * me.ppd;
222 end
223 function set_sfOut(me,value)
224 if me.sfRecurse == false
225 me.sfCache = (value / me.ppd);
226 me.sfOut = me.sfCache * me.scale;
227 else
228 me.sfOut = value;
229 me.sfRecurse = false;
230 end
231 %fprintf('\nSET SFOut: %d | cachce: %d | in: %d\n', me.sfOut, me.sfCache, value);
232 end
233 function set_tfOut(me,value)
234 me.tfOut = value;
235 end
236 function set_driftDirectionOut(me,value)
237 me.driftDirectionOut = value;
238 end
239 function set_sizeOut(me,value)
240 me.sizeOut = value * me.ppd;
241 me.szPx = me.sizeOut;
242 end
243
244 end
245
246 % ===================================================================
247 %> @brief Update this stimulus object for display
248 %>
249 % ===================================================================
250 function update(me)
251 resetTicks(me);
252 if me.correctPhase
253 ps=me.calculatePhase;
254 me.driftPhase=me.phaseOut-ps;
255 else
256 me.driftPhase=me.phaseOut;
257 end
258 computePosition(me);
259 setRect(me);
260 end
261
262 % ===================================================================
263 %> @brief Draw this stimulus object for display
264 %>
265 %>
266 % ===================================================================
267 function draw(me)
268 if me.isVisible && me.tick >= me.delayTicks && me.tick < me.offTicks
269 Screen('DrawTexture', me.sM.win, me.texture, [],me.mvRect,...
270 me.angleOut, [], [], [], [], 2,...
271 [me.driftPhase, me.sfOut, me.spatialConstantOut,...
272 me.contrastOut, me.aspectRatioOut, 0, 0, 0]);
273 me.drawTick = me.drawTick + 1;
274 end
275 if me.isVisible; me.tick = me.tick + 1; end
276 end
277
278 % ===================================================================
279 %> @brief Animate this object for runExperiment
280 %>
281 % ===================================================================
282 function animate(me)
283 if me.isVisible && me.tick >= me.delayTicks
284 if me.mouseOverride
286 if me.mouseValid
287 me.mvRect = CenterRectOnPointd(me.mvRect, me.mouseX, me.mouseY);
288 end
289 end
290 if me.doMotion == true
291 me.mvRect=OffsetRect(me.mvRect,me.dX_,me.dY_);
292 end
293 if me.doDrift == true
294 me.driftPhase = me.driftPhase + me.phaseIncrement;
295 end
296 if mod(me.tick,me.phaseCounter) == 0
297 me.driftPhase = me.driftPhase + me.phaseOfReverse;
298 end
299 end
300 end
301
302 % ===================================================================
303 %> @brief Reset an structure for runExperiment
304 %>
305 %> @param rE runExperiment object for reference
306 %> @return stimulus structure.
307 % ===================================================================
308 function reset(me)
309 resetTicks(me);
310 if isprop(me,'texture')
311 if ~isempty(me.texture) && me.texture > 0 && Screen(me.texture,'WindowKind') == -1
312 try Screen('Close',me.texture); end %#ok<*TRYNC>
313 end
314 me.texture = [];
315 end
317 end
318
319 % ===================================================================
320 %> @brief sf Set method
321 %>
322 % ===================================================================
323 function set.sf(me,value)
324 if value <= 0
325 value = 0.05;
326 end
327 me.sf = value;
328 me.salutation(['set sf: ' num2str(value)],'Custom set method')
329 end
330
331 % ===================================================================
332 %> @brief calculate phase offset
333 %>
334 % ===================================================================
335 function phase = calculatePhase(me)
336 phase = 0;
337 if me.correctPhase > 0
338 ppd = me.ppd;
339 size = (me.sizeOut/2); %divide by 2 to get the 0 point
340 sfTmp = (me.sfOut/me.scale)*me.ppd;
341 md = size / (ppd/sfTmp);
342 md=md-floor(md);
343 phase = (360*md);
344 end
345 end
346
347 end %---END PUBLIC METHODS---%
348
349
350 %=======================================================================
351 methods ( Access = protected ) %-------PROTECTED METHODS-----%
352 %=======================================================================
353
354 % ===================================================================
355 %> @brief setRect
356 %> setRect makes the PsychRect based on the texture and screen values
357 %> this is modified over parent method as gratings have slightly different
358 %> requirements.
359 % ===================================================================
360 function setRect(me)
361 me.dstRect=Screen('Rect',me.texture);
362 me.dstRect=ScaleRect(me.dstRect,me.scale,me.scale);
363 if me.mouseOverride
364 if me.mouseValid
365 me.dstRect = CenterRectOnPointd(me.dstRect, me.mouseX, me.mouseY);
366 end
367 else
368 if ~isprop(me,'directionOut')
369 [sx sy]=pol2cart(me.d2r(me.direction),me.startPosition);
370 else
371 [sx sy]=pol2cart(me.d2r(me.directionOut),me.startPosition);
372 end
373 me.dstRect=CenterRectOnPointd(me.dstRect,me.sM.xCenter,me.sM.yCenter);
374 if ~isprop(me,'xPositionOut')
375 me.dstRect=OffsetRect(me.dstRect,(me.xPosition)*me.ppd,(me.yPosition)*me.ppd);
376 else
377 me.dstRect=OffsetRect(me.dstRect,me.xPositionOut+(sx*me.ppd),me.yPositionOut+(sy*me.ppd));
378 end
379 end
380 me.mvRect=me.dstRect;
381 me.szPx = RectWidth(me.mvRect);
383 end
384
385 end %---END PROTECTED METHODS---%
386
387 %=======================================================================
388 methods ( Access = protected ) %-------PROTECTED METHODS-----%
389 %=======================================================================
390
391 % ===================================================================
392 %> @brief calculateScale
393 %> Use an event to recalculate scale as get method is slower (called
394 %> many more times), than an event which is only called on update
395 % ===================================================================
396 function calculateScale(me,~,~)
397 me.scale = me.sizeOut / (me.size * me.ppd);
398 me.sfRecurse = true;
399 me.sfOut = me.sfCache * me.scale;
400 if isprop(me,'spatialConstantOut')
401 me.spatialConstantOut = me.sizeOut / me.spatialConstant;
402 end
403 end
404
405 % ===================================================================
407 %> Use an event to recalculate as get method is slower (called
408 %> many more times), than an event which is only called on update
409 % ===================================================================
410 function calculatePhaseIncrement(me,~,~)
411 if isprop(me,'tfOut')
412 me.phaseIncrement = (me.tfOut * 360) * me.sM.screenVals.ifi;
413 if isprop(me,'driftDirectionOut') && me.driftDirectionOut == false
415 end
416 end
417 end
418
419 end
420end
function computePosition(in me)
compute xFinal and yFinal (in pixels) taking startPosition, xPosition, yPosition and direction/angle ...
Property size
Definition baseStimulus.m:46
function getMousePosition(in me)
get mouse position we make sure this is only called once per animation tick to improve performance an...
Property sM
our screen manager
Definition baseStimulus.m:165
Property szPx
computed size in pixels
Definition baseStimulus.m:113
function setAnimationDelta(in me)
Property ppd
pixels per degree (normally inhereted from screenManager)
Definition baseStimulus.m:139
function resetTicks(in me)
reset the various tick counters for our stimulus
Property texture
Our texture pointer for texture-based stimuli.
Definition baseStimulus.m:159
Property yPosition
Definition baseStimulus.m:42
Property screenVals
screen settings generated by sM on setup
Definition baseStimulus.m:171
Property mvRect
Definition baseStimulus.m:102
function removeTmpProperties(in me)
Finds and removes dynamic properties.
Property dstRect
initial screen rectangle position [LEFT TOP RIGHT BOTTOM]
Definition baseStimulus.m:184
function addRuntimeProperties(in me)
These are transient properties that specify actions during runtime.
Property xPosition
Definition baseStimulus.m:38
Property sfCache
Definition gaborStimulus.m:93
function set_yPositionOut(in me, in value)
function calculateScale(in me, in ignoredArg, in ignoredArg)
calculateScale Use an event to recalculate scale as get method is slower (called many more times),...
function calculatePhase(in me)
calculate phase offset
function draw(in me)
Draw this stimulus object for display.
function reset(in me)
Reset an structure for runExperiment.
function set_sizeOut(in me, in value)
function calculatePhaseIncrement(in me, in ignoredArg, in ignoredArg)
calculatePhaseIncrement Use an event to recalculate as get method is slower (called many more times),...
Property sfRecurse
to stop a loop between set method and an event
Definition gaborStimulus.m:96
Property phase
phase of grating
Definition gaborStimulus.m:36
function set_tfOut(in me, in value)
function set_sfOut(in me, in value)
Property scale
scale is used when changing size as an independent variable to keep sf accurate
Definition gaborStimulus.m:78
Property sf
spatial frequency
Definition gaborStimulus.m:27
Property phaseIncrement
the phase amount we need to add for each frame of animation
Definition gaborStimulus.m:81
function set_xPositionOut(in me, in value)
function update(in me)
Update this stimulus object for display.
function set_driftDirectionOut(in me, in value)
function setRect(in me)
setRect setRect makes the PsychRect based on the texture and screen values this is modified over pare...
Property spatialConstant
a divisor for the size for the gaussian envelope for a gabor
Definition gaborStimulus.m:57
function animate(in me)
Animate this object for runExperiment.
The main experiment manager.
Definition runExperiment.m:3

Constructor & Destructor Documentation

◆ gaborStimulus()

function gaborStimulus::gaborStimulus ( in  varargin)

Class constructor.

More detailed description of what the constructor does.

Parameters
argsare passed as a structure of properties which is parsed.
Returns
instance of class.

Member Function Documentation

◆ animate()

function gaborStimulus::animate ( in  me)
virtual

Animate this object for runExperiment.

Reimplemented from baseStimulus.

◆ calculatePhase()

function gaborStimulus::calculatePhase ( in  me)

calculate phase offset

◆ calculatePhaseIncrement()

function gaborStimulus::calculatePhaseIncrement ( in  me,
in  ignoredArg,
in  ignoredArg 
)
protected

calculatePhaseIncrement Use an event to recalculate as get method is slower (called many more times), than an event which is only called on update

◆ calculateScale()

function gaborStimulus::calculateScale ( in  me,
in  ignoredArg,
in  ignoredArg 
)
protected

calculateScale Use an event to recalculate scale as get method is slower (called many more times), than an event which is only called on update

◆ draw()

function gaborStimulus::draw ( in  me)
virtual

Draw this stimulus object for display.

Reimplemented from baseStimulus.

◆ reset()

function gaborStimulus::reset ( in  me)
virtual

Reset an structure for runExperiment.

Parameters
rErunExperiment object for reference
Returns
stimulus structure.

Reimplemented from baseStimulus.

◆ set_driftDirectionOut()

function gaborStimulus::set_driftDirectionOut ( in  me,
in  value 
)

◆ set_sfOut()

function gaborStimulus::set_sfOut ( in  me,
in  value 
)

◆ set_sizeOut()

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

◆ set_tfOut()

function gaborStimulus::set_tfOut ( in  me,
in  value 
)

◆ set_xPositionOut()

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

◆ set_yPositionOut()

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

◆ setRect()

function gaborStimulus::setRect ( in  me)
protected

setRect setRect makes the PsychRect based on the texture and screen values this is modified over parent method as gratings have slightly different requirements.

◆ setup()

function gaborStimulus::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 converyed 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 for display.

Parameters
rErunExperiment object for reference

◆ sf()

function set gaborStimulus::sf ( in  me,
in  value 
)

sf Set method

◆ update()

function gaborStimulus::update ( in  me)
virtual

Update this stimulus object for display.

Reimplemented from baseStimulus.

Member Data Documentation

◆ allowedProperties

Property gaborStimulus::allowedProperties
protected

allowed properties passed to object upon construction

◆ aspectRatio

Property gaborStimulus::aspectRatio

aspect ratio of the gabor

◆ contrast

Property gaborStimulus::contrast

contrast of grating

◆ contrastMult

Property gaborStimulus::contrastMult

Contrast Multiplier, 0.5 gives "standard" 0-1 contrast measure.

◆ correctPhase

Property gaborStimulus::correctPhase

do we need to correct the phase to be relative to center not edge?

◆ direction

Property gaborStimulus::direction

the angle which the direction of the grating patch is moving

◆ disableNorm

Property gaborStimulus::disableNorm

should we disable normalisation of the gabor (generally TRUE)?

◆ driftDirection

Property gaborStimulus::driftDirection

reverse the drift direction?

◆ family

Property gaborStimulus::family

◆ ignoreProperties

Property gaborStimulus::ignoreProperties
protected

properties to not create transient copies of during setup phase

◆ phase

Property gaborStimulus::phase

phase of grating

◆ phaseCounter

Property gaborStimulus::phaseCounter
protected

how many frames between phase reverses

◆ phaseIncrement

Property gaborStimulus::phaseIncrement

the phase amount we need to add for each frame of animation

◆ phaseOfReverse

Property gaborStimulus::phaseOfReverse

What phase to use for reverse?

◆ phaseReverseTime

Property gaborStimulus::phaseReverseTime

reverse phase of grating X times per second?

◆ rotationMethod

Property gaborStimulus::rotationMethod

rotate the object (0/false) or the texture (1/true)?

◆ scale

Property gaborStimulus::scale

scale is used when changing size as an independent variable to keep sf accurate

◆ sf

Property gaborStimulus::sf

spatial frequency

◆ sfCache

Property gaborStimulus::sfCache
protected

as get methods are slow, we cache sf, then recalculate sf whenever changeScale event is called

◆ sfRecurse

Property gaborStimulus::sfRecurse
protected

to stop a loop between set method and an event

◆ spatialConstant

Property gaborStimulus::spatialConstant

a divisor for the size for the gaussian envelope for a gabor

◆ tf

Property gaborStimulus::tf

temporal frequency

◆ type

Property gaborStimulus::type

type


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