Stage is a MATLAB based visual stimulus system for vision research. It provides a toolbox for writing visual stimulus routines.
Stage comes with a wide variety of built-in stimuli like rectangle, ellipse, grating, image, and movie. Stimuli may be layered and their attributes (position, size, orientation, color, opacity, etc.) animated to create complex presentations. View some example presentations below.
Stage supports real-time transparency masks and convolution filters. The use of shaders enable all effects processing to occur on the GPU. View some example presentations with masks and filters below.
Stage includes a Stage Server app to enable remote stimulus presentation across MATLAB sessions. The sessions may be running on the same machine or on separate machines across a network.
Stage integrates seamlessly with Symphony. Stage presentations may be created and displayed directly in Symphony protocols.
classdef SingleSpot < io.github.stage_vss.protocols.StageProtocol | |
properties | |
amp = 'Amp' % Output amplifier | |
preTime = 500 % Spot leading duration (ms) | |
stimTime = 1000 % Spot duration (ms) | |
tailTime = 500 % Spot trailing duration (ms) | |
spotIntensity = 1.0 % Spot light intensity (0-1) | |
spotDiameter = 300 % Spot diameter size (pixels) | |
backgroundIntensity = 0.5 % Background light intensity (0-1) | |
centerOffset = [0, 0] % Spot [x, y] center offset (pixels) | |
numberOfAverages = uint16(5) % Number of epochs | |
end | |
methods | |
function prepareRun(obj) | |
prepareRun@io.github.stage_vss.protocols.StageProtocol(obj); | |
device = obj.rig.getDevice(obj.amp); | |
obj.showFigure('symphonyui.builtin.figures.ResponseFigure', device); | |
obj.showFigure('symphonyui.builtin.figures.MeanResponseFigure', device); | |
end | |
function p = createPresentation(obj) | |
canvasSize = obj.rig.getDevice('Stage').getCanvasSize(); | |
p = stage.core.Presentation((obj.preTime + obj.stimTime + obj.tailTime) * 1e-3); | |
p.setBackgroundColor(obj.backgroundIntensity); | |
spot = stage.builtin.stimuli.Ellipse(); | |
spot.color = obj.spotIntensity; | |
spot.radiusX = obj.spotDiameter/2; | |
spot.radiusY = obj.spotDiameter/2; | |
spot.position = canvasSize/2 + obj.centerOffset; | |
p.addStimulus(spot); | |
spotVisible = stage.builtin.controllers.PropertyController(spot, 'visible', ... | |
@(state)state.time >= obj.preTime * 1e-3 && state.time < (obj.preTime + obj.stimTime) * 1e-3); | |
p.addController(spotVisible); | |
end | |
function prepareEpoch(obj, epoch) | |
prepareEpoch@io.github.stage_vss.protocols.StageProtocol(obj, epoch); | |
device = obj.rig.getDevice(obj.amp); | |
duration = (obj.preTime + obj.stimTime + obj.tailTime) / 1e3; | |
epoch.addDirectCurrentStimulus(device, device.background, duration, obj.sampleRate); | |
epoch.addResponse(device); | |
end | |
function tf = shouldContinuePreparingEpochs(obj) | |
tf = obj.numEpochsPrepared < obj.numberOfAverages; | |
end | |
function tf = shouldContinueRun(obj) | |
tf = obj.numEpochsCompleted < obj.numberOfAverages; | |
end | |
end | |
end |
Stage was built for core OpenGL 3.2+ which enables it to be more efficient, flexible, and future-proof. The toolbox makes extensive use of vertex buffer and array objects as well as shaders.
Stage is released under the MIT License, which is an open source license. Pull requests to the Stage-VSS GitHub organization are welcomed and encouraged.
© 2017 Stage-VSS. MATLAB is a registered trademark of The MathWorks, Inc. OpenGL and the oval logo are trademarks or registered trademarks of Silicon Graphics, Inc. in the United States and/or other countries worldwide. The OSI logo trademark is the trademark of Open Source Initiative.