DriftingGrating and mask

mhisted's Avatar

mhisted

27 Jul, 2017 01:48 PM

Hi Chris,

I've taken a closer look at the DriftingGrating mask recently, and I have a few questions.

We often use the sinusoidal grating and gaussian mask (to give a Gabor stimulus).
First,
The mask has two parameters: stdDev and mean. I would normally expect the mean to be a constant offset of the mask intensity or alpha value. But it seems like the mask equation (in code below)

https://github.com/mworks/mworks/blob/master/plugins/core/DriftingGratingStimulus/DriftingGratingStimulus.cpp

actually gives a radial offset of the gaussian peak from the center. I'm not sure what the application of such a toroidal stimulus would be. Is that what's intended?

Second q:
When tested recently on a 7 bit (twisted nematic) monitor that is linearized, we find that there is an obvious mask step about 1/5 of the distance from the center (producing a visible circle). You can see that by making the stimulus 10-20% of the size of the screen and using stdDev 0.3, mean 0.0-0.1.

That's not a huge problem for us, but my guess is that it's related to a limited number of digital levels allowed in the OpenGL texture. Can you look into it?

Thanks,
Mark

  1. Support Staff 1 Posted by Christopher Sta... on 27 Jul, 2017 07:05 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    I'm not sure what the application of such a toroidal stimulus would be. Is that what's intended?

    That mask equation was defined before I started working on MWorks, and I have no knowledge of the rationale behind it. I agree that it seems strange.

    Is there an alternative Gaussian mask formulation that you'd like to use? If so, I'd be happy to implement it.

    When tested recently on a 7 bit (twisted nematic) monitor that is linearized, we find that there is an obvious mask step about 1/5 of the distance from the center (producing a visible circle).

    I can't reproduce exactly what you describe. However, with some gratings, I am able to see banding, which I suspect is what you're seeing (and which should be more pronounced when you have only 7 bits per color channel).

    Chris

  2. 2 Posted by mhisted on 27 Jul, 2017 08:28 PM

    mhisted's Avatar

    Hi Chris,

    A typical Gabor stimulus is a sinusoidal grating filtered by a gaussian mask. Normally the spatial extent of the stimulus is given by its standard deviation in degrees of visual angle, which in this case is the product of height/width and the stdDev parameter.

    Psychtoolbox may be worth emulating:
    http://docs.psychtoolbox.org/CreateProceduralGabor <http://docs.psychtoolbox.org/CreateProceduralGabor>
    It looks like they parameterize a Gabor with:
    rotation, phase, spatial freq, sigma of gaussian mask, contrast, aspect ratio.

    > I can't reproduce exactly what you describe. However, with some gratings, I am able to see banding <http://www.lagom.nl/lcd-test/gradient.php>, which I suspect is what you're seeing (and which should be more pronounced when you have only 7 bits per color channel).
    >

    Agreed that is the likely problem. How many bits are used for the mask now, 8? Is it possible to use more?

    Thanks,
    Mark

  3. Support Staff 3 Posted by Christopher Sta... on 28 Jul, 2017 03:47 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    It looks like they parameterize a Gabor with: rotation, phase, spatial freq, sigma of gaussian mask, contrast, aspect ratio.

    Unless I'm misunderstanding, I believe we already provide equivalents for all of those parameters. Notably, their Gabor has no parameter to set the mean of the Gaussian (probably because, as you've noted, it isn't particularly useful).

    I do think that MWorks' drifting grating should have the equivalent of Psychtoolbox's disableNorm parameter. When that's set, the normalization term (1.0 / (stdDev * sqrt(2.0 * pi))) is omitted from the computation of the Gaussian. Another MWorks user noted previously that it was strange for the amplitude of the Gaussian to be tied to its spatial extent, so giving folks the option to disable that could be useful.

    Also, I should add a note to the drifting grating docs explaining what "mean" does (and probably advising just to leave it at zero).

    How many bits are used for the mask now, 8? Is it possible to use more?

    The computation of the mask is done in floating point, but the color buffer, where the final color is stored, has 8 bits per channel. We could use a deeper color buffer (16-bit, or 32-bit floating point), although there'd be some performance cost to that. However, if the display only supports 8 (or fewer) bits per channel, I don't think that would help, as the color values still get rounded to an 8-bit integer.

    Out of curiosity, why are you using a 7-bit display? And where do you even get such a thing?

    Chris

  4. Support Staff 4 Posted by Christopher Sta... on 12 Aug, 2017 03:38 PM

    Christopher Stawarz's Avatar

    I do think that MWorks' drifting grating should have the equivalent of Psychtoolbox's disableNorm parameter.

    As noted elsewhere, this is done.

  5. Christopher Stawarz closed this discussion on 12 Aug, 2017 03:38 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac