Welcome
Guest
, you are in:
<root>
Elements
•
Login
EventIDE Wiki
Navigation
¶
Main Page
Random Page
Create a new Page
All Pages
Categories
Navigation Paths
Administration
File Management
Create Account
Search the wiki
Back
Random Noise Patch Element
Modified on 2018/07/16 02:36
by
Administrator
Categorized as
Elements
,
Stimulus generators
<div style="margin-right: 10px; margin-left: 16px; margin-bottom:10px; float: right; width: 500px; overflow: hidden; height: auto; padding: 0px; background: #fafafa; background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));background: -moz-linear-gradient(top, #fbfbfb, #fafafa);border: 1px dashed #ddd;box-shadow: 0 0 0 3px #fff, 0 0 0 5px #ddd, 0 0 0 10px #fff, 0 0 2px 10px #eee;"> == Summary == {s:Element Info Panel | title=Random Noise Patch | category=Stimulus Generators | icon=[image|Element Icon|{UP(Random-Noise-Patch-Element)}Random-Noise-Patch-Element-Icon.png] | author= OkazoLab | addin= Visual Kernels | scope= Parent event | usage= Stimulus screen | ownsnippets= None } == Properties == {| |- ! Name ! Description ! Constraints ! Type ! On<br/>runtime<br/>change |- | colspan="5" bgcolor="#AADDDDD" | Settings |- | Patch Type | Defines a type of the random dot patch | {s:atNormal} | enRand.. | |- | Random Distribution | Defines a type of the random dot distribution | {s:atNormal} | enRand.. | |- | Luminance Range | Defines the normalized range, 0..1, for the dot luminance. The full range, 0..1, corresponds to 0..255 in the RGB space. The range does not affects the color hues | {s:atNormal} | clRange | |- | Patch Shape | Defines a shape of the generated patch | {s:atNormal} | GaborP.. | |- | Random Seed | Defines a seed value for the random noise patch. If the value is equal zero, a random seed value is automatically selected. Assigning a new value regenerates the patch. | {s:atNormal} | Int32 | |- | colspan="5" bgcolor="#AADDDDD" | Runtime Status |- | Current Seed | Returns the current random seed of the dot pattern, when the seed selection is randomized (Random Seed value is zero). If the seed is assigned manually via Random Seed, this property mirrors the assigned value. | {s:atStatus} | Int32 | |- | Regenerate Patch Now | Runtime command regenerating the patch. Use as 'RegeneratePatchNow=true;' in snippets | {s:atRuntimeAction} | Boolean | |- | colspan="5" bgcolor="#AADDDDD" | Visual Appearance |- | Alpha Masking | Defines, whether the visual content is used to create an opacity mask on the event surface. If masking is on, the content's pixel luminance (or, its inverse) defines transparency within element's viewport. The alpha masking allows, for example, create transparent holes on the event surface. | {s:atDesign} | Int32 | |- | AntiAliasing | if true, the rendered content will be antialiased for smoother visual appeariance. If false, rendering will be authentic to its source, e.g. a bitmap. | {s:atNormal} | Boolean | |- | Position | Defines a position of the rendering viewport on the screen | {s:atNormal} | clPoint | |- | Size | Defines a size of the element's rendering viewport on the screen | {s:atNormal} | clSize | |- | Z Order | Indicates Z Order of the element on the given event | {s:atStatus} | Int32 | |- | Pivot Point | Defines alignment of the pivot point (or, element's position) relative to element's rendering area. The pivot point sets the center of element's rotation and scale directions. | {s:atNormal} | stAlig.. | |- | Visible | Defines whether the element is visible | {s:atNormal} | Boolean | |- | Rotation | Rotation angle in degrees | {s:atNormal} | Double | |- | colspan="5" bgcolor="#AADDDDD" | Effects |- | Transparent Color | The color of the original pixels of rendered content that will be set as transparent | {s:atNormal} | stColor | |- | Transparent Tolerance | Tolerance ratio for choosing colors that become transparent. Zero means that effect is not applied, 1 denotes that all colors will become trasparent | {s:atNormal} | Int32 | |- | Color Mask | Produces a multiplicative combination of the original pixels and the selected mask color (except the alpha channel). The effect emulates a look through a colored glass. White or transparent mask color dont change the original pixels | {s:atNormal} | stColor | |- | Opacity | Opacity of the rendered content | {s:atNormal} | Int32 | |- | Contrast | Contrast of the rendered content | {s:atNormal} | Int32 | |- | Brightness | Brightness the rendered content | {s:atNormal} | Int32 | |- | Saturation | Saturation of the rendered content | {s:atNormal} | Double | |- | Pixelation | Pixelation of the rendered content | {s:atNormal} | Int32 | |- | Blurring | The radius used in the gaussian blur of rendered content, as a pixel-based factor. The default is 0 which means no blurring. | {s:atNormal} | Int32 | |- | Scrambling | | {s:atNormal} | Double | |- | Scrambling Grid Size | Defines a size of the scrambling grid | {s:atNormal} | clSize | |- | colspan="5" bgcolor="#AADDDDD" | Positional Jitter |- | Reset Jitter Now | Runtime command that resets the positional jitter. | {s:atRuntimeAction} | Boolean | |- | Current Jitter | Returns the current jitter | {s:atStatus} | clPoint | |- | Jitter Range | Defines a possible range for the random jitter. The range is centered to the position of the element. | {s:atNormal} | clSize | |- | Test Jitter | Click to test the current jitter | {s:atDesign} | Boolean | |- | colspan="5" bgcolor="#AADDDDD" | Control |- | Is Enabled | If set to false the element is completely omitted when the experiment is run | {s:atDesign} | Boolean | |- | Title | Title of the element | {s:atDesign} | String | |- |} == == </div> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> <!--*****************************************************************************************************************************************************************************--> '''Random Noise Patch Element''' is capable of generating random dot patterns in real-time. The patterns are composed of pixels with random gray luminance or combinations of random color and luminance. The randomization is based on the fast Multiply-with-Carry algorithm (Marsaglia and Zaman, 1991). The element is a recommended replacement for the old Random Dots element.{br}{br} {TOC} == Description == The random noise patch element can generate and render 2D noise patches controlled by several input parameters. The element employs hardware-accelerated graphics and fast randomization algorithm allowing generation of the noise stimuli in real-time. == Snapshots == The examples of rendered element with three available random dots types (the insets show zoomed patterns): {| | [imageleft|Random luminance surface|{UP}/pictures/random_dots/small/021311_0416_1.png|{UP}/pictures/random_dots/021311_0416_1.png] | [imageleft|Random luminance&color surface|{UP}/pictures/random_dots/small/021311_0416_2.png|{UP}/pictures/random_dots/021311_0416_2.png] | [imageleft|Random color surface|{UP}/pictures/random_dots/small/021311_0416_3.png|{UP}/pictures/random_dots/021311_0416_3.png] |} == Practical Use == Generation of random dots surfaces via the graphics hardware implies certain limitations on type of a randomization algorithm. Our algorithm requires a relatively slow initialization where the random seed map is created by a standard random number generator. Later this seed map is used for generation of new random surfaces by ultra-fast shuffling of the original pixel positions. There are two major ways of using the element for generation of multiple random dots surfaces (e.g., one per trial). Every surface generated by the element is defined by the index of the seed map and index of the surface itself. You may choose how to control these indexes in experiment. <nowiki>If you need to present an incidental random dots surface (for example, for introducing a random noise to stimuli), you can setup the automatic time-dependent indexes. For this purpose, set two index properties [Seed map] and [Surface] to zero. Then the element will automatically generate the seed map and random dot surface with indexes that are random themselves. If you want to log these indexes, anytime you can read them in the statistical properties [Current Map] and [Current Surface]. In order to generate a new incidental surface at runtime you should initiate one of runtime actions in your code snippets: [Update Seed Map] or [Update Surface]. The runtime action is initiated by assigning TRUE to the property in a snippet.</nowiki> <nowiki>If you need to present a deterministic random dots surface then you have to set the indexes manually, at design-time or in code snippets at runtime. You can do by assigning a certain positive integer value to the [Seed map index] or [Surface Index] properties which causes immediate regeneration of the surface. Thus, for the "deterministic" scenario you don't need to initiate the runtime actions [Update Seed Map] or [Update Surface].</nowiki> In most cases the regeneration of the seed map is not necessary, since there are 2,147,483,648 unique random surfaces can be created with a single seed map. <nowiki>By default, the seed map is generated with the same dimensions as a current size of the random dot element. If you change the size of the element in runtime, it might be a good practice to initiate regeneration of the seed map in parallel by the runtime action [Update Seed Map] - it will guarantee a correct randomization process. </nowiki> === Evaluation of the randomization algorithm === Our randomization algorithm of reshuffling the pixel positions has an important gain for many experimental scenarios – it allows keeping the overall luminance intensity of each generated surface nearly constant. The graph below demonstrates the frequency distribution of the RGB luminance for 10000 random dots surfaces (1024x768) generated by the random dots element. Notice that the entire distribution falls within a single RGB step. {| | [imageleft||{UP}/pictures/random_dots/small/021311_0416_4.png|{UP}/pictures/random_dots/021311_0416_4.png] |} The algorithm has been also tested for cross-correlation of two randomly selected pixels in a sequence of the generated surfaces. The results are shown below on the scatter plot. The cross-correlation has been found to be not significant after 10000 runs and r is -0.02. The red line shows the "zero" correlation trend with confidence intervals. {| | [imageleft||{UP}/pictures/random_dots/small/021311_0416_5.png|{UP}/pictures/random_dots/021311_0416_5.png] |} Our randomization algorithm has been designed to produce a continuous uniform distribution of random values for every pixel. For luminance the distribution falls within the standard gray RGB range, 0..255, by default. We evaluated the goodness of the produced uniform distribution by comparing it with the distribution of pixel sampling by the standard random number generator in the C# programming language. Below are three graphs showing frequency distributions of the RGB luminance for two pixels (coordinates are randomly selected) and the standard random numbers generated in ~ 10000 passes. {| | [imageleft||{UP}/pictures/random_dots/small/021311_0416_6.png|{UP}/pictures/random_dots/021311_0416_6.png] | [imageleft||{UP}/pictures/random_dots/small/021311_0416_7.png|{UP}/pictures/random_dots/021311_0416_7.png] | [imageleft||{UP}/pictures/random_dots/small/021311_0416_8.png|{UP}/pictures/random_dots/021311_0416_8.png] |} We assesses the most common statistical measures of all the obtained distributions and did not find significant differences in results between our and standard randomization algorithms. Notice the Kurtosis values in the table below, the negative values are indicative for the uniform distributions. {| |- ! Generator ! N ! Mean ! Sum ! Minimum ! Maximum ! Variance ! Std. Dev. ! Std. Error ! Kurtosis |- | Pixel A | 10000 | 126.9760 | 1378959 | 0.00 | 255.0000 | 5446.435 | 73.79997 | 0.708176 | -1.18102 |- | Pixel B | 10000 | 128.8085 | 1398860 | 0.00 | 255.0000 | 5457.436 | 73.87446 | 0.708891 | -1.18804 |- | Standard | 10000 | 126.8245 | 1377314 | 0.00 | 255.0000 | 5365.272 | 73.24802 | 0.702880 | -1.17682 |} == Notes == 1. If you need a random dots surface with individual dots larger than the screen pixel (like as a grid with large cells of random colors), the best way is to simply apply the pixelation effect with the selected ratio to the element. The pixelation effect would zoom the generated pixel pattern such that a color of the central pixel in each cell would define the color of the cell itself. Then the element can be rendered as on the example below. {| | [imageauto||{UP}/pictures/random_dots/small/021311_0416_9.png|{UP}/pictures/random_dots/021311_0416_9.png] |} ''The random dot surface, 1024x768, is rendered with the pixelation effect (pixilation ratio=86%)'' 2. You can enable different visual effects on the random dots element in order to obtain various rendering outputs, useful in real scenarios. One example below demonstrates the random dots surface made of only black and white pixels. The result is obtained with the contrasts visual effect set to +100%. {| | [imageauto||{UP}/pictures/random_dots/small/021311_0416_10.png|{UP}/pictures/random_dots/021311_0416_10.png] |} ''The element with the contrast filter (+100%) applied produces the surface that contains only black and white dots.'' 3. Another example below shows a monochromatic random dots surface made of combination of the gray random dots and the "orange" color filter effect. {| | [imageauto||{UP}/pictures/random_dots/small/021311_0416_11.png|{UP}/pictures/random_dots/021311_0416_11.png] |} ''The element with a monochromatic random dots surface made of combination of the gray random dots and the orange color filter effect.''
Meta Keywords:
Meta Description:
Change Comment:
ScrewTurn Wiki
version 5.2.0.8. Some of the icons created by
FamFamFam
.