Skip to content
Brian Wandell edited this page Jan 6, 2018 · 20 revisions
  • We describe the oiSequence concept.
  • The tutorial t_oisCreate.m shows a simple way to make certain oiSequences using the oisCreate function, a gateway to oiSequence.

The oiSequence class was created to represent certain simple stimuli that are used in psychophysical and physiological experiments. The oiSequence is an input to the cone mosaic compute method.

The oiSequence

Many psychophysical stimuli are created by combining weighted sums of two fixed stimuli. We can represent such stimuli compactly with two retinal images (oi) and a time series of weights that describe how to combine the images. We call the two retinal images oiFixed and oiModulated; the time series of weights is the modulation function. One more variable, the sampleTimeSeries, defines the time when we apply each modulation weight.

For example, the oiFixed might be a steady background and the oiModulated might be a Gabor patch (Gaussian-enveloped harmonic). The modulation might be a set of Gaussian weights that increase and decrease over time. As the weights rise from 0 to a peak and back to 0, the stimulus is a blend that is first dominated by the fixed background, then the Gabor, and then the background. This blending controls the contrast of the stimulus

Here is the appearance of such a stimulus

A oiSequence for the case in which the background is fixed and a second stimulus is added can also be specified. In that case, the composition is 'add', while in the previous case it is 'blend'.

An example

This code generates an achromatic Gabor stimulus. It calculates the scenes using the sceneCreate function.

scene = cell(1,2);  % Two scenes, for oiFixed and oiModulated

% oiModulated harmonic parameters
tparams(2) = harmonicP;
tparams(2).freq = 4;
tparams(2).GaborFlag = 0.2;

% oiFixed has the same parameters, but zero contrast
tparams(1) = tparams(2);
tparams(1).contrast = 0;

% Create the harmonic scenes
for ii=1:2
    scene{ii} = sceneCreate('harmonic',tparams(ii));
end

Now, we compute the oiFixed and oiModulated from the two scenes

% Compute optical images from the scene
OIs = cell(1, 2);
oi = oiCreate;
for ii = 1:2
    OIs{ii} = oiCompute(oi,scene{ii});
end

We are ready to create the sample times, one frame every 10 ms, and the modulation function, which is a Gaussian with 50 steps. Hence, the whole sequence is 10*50 ms (half a second).

integrationTime = 0.010;
sampleTimes = ((1:length(modulation))-1)*integrationTime;
modulation = ieScale(fspecial('gaussian',[1,50],10),0,.5);
ois = oiSequence(OIs{1}, OIs{2}, sampleTimes, modulation, ...
    'composition', 'blend');

You can visualize the result with this plotting function

ois.visualize('movie illuminance');

You can see a montage of the individual frames this way

ois.visualize('montage');

Computation

The oiSequence is an input to the cone mosaic compute method. For example, this code creates a cone mosaic with a 1 deg field of view and the same 10 ms integration time. We generate some eye movements for the length of the stimulus. And then we compute the cone absorptions.

fov = 1;
cmosaic = coneMosaic;
cmosaic.integrationTime = integrationTime;
cmosaic.setSizeToFOV(fov);
cmosaic.emGenSequence(ois.length);
cmosaic.compute(ois);

This generates a mean cone absorption image that can be shown in the window

cmosaic.window;

And a spatial pattern of L-cone absorptions (with Poisson noise and eye movements)

Clone this wiki locally