Regions and Patterns for Rendering Visual Stimuli
In this introduction, you will learn how to use region and pattern components to draw a white circle on top of a uniform gray background. This tutorial is intended as a first step to understanding how to handle components through the LabMaestro interface.
Create the LabMaestro Project
To start, you should create a new empty project in LabMaestro. To do so, open the LabMaestro application and click File -> New (empty). You can save this project through File -> Save.
Creating a Timeline
To begin adding components to your project, you must first add a timeline to the project. Right click on “Experiment Design” in the Project window, located in the upper-left of the interface by default. Select Add -> Timeline. This will create a basic empty Timeline with only one Epoch by default.
Part 1 – Create Regions on the Screen
In this demo, we will explore Region components to create a white circle on top of a uniform gray background.
Create a Rectangle Region
The first step should be to create the background region. As a first step, go into the Component Library (by default, on the lower left of your screen). Under “Regions”, drag & drop “Rectangle” into your epoch. Your screen should now look like this:
As you can see, we have added a rectangular region to our project. However, we must modify its size for it covers the full screen. This can be done by modifying our Rectangle’s properties, in the “Properties” tab (by default, to the right of the interface.)
Region Properties
The Properties menu should look like this:
You can read more details about each property on the Region Shared Parameter Groups page on the LabMaestro documentation. As a quick refresher, here is what each property can do:
Center: Specify the position of the region’s center relative to the experiment display.
Orientation: Specify the orientation of the region in degrees.
Color: Specify the color of the region.
Filcker Waveform: Allows to enable and control region flicker.
Geometry: The size the region will take on the screen.
As we want this region to act as a background, we can simply click “Full Screen.” This will disable the “Geometry” property (as region size will be equal to your display’s resolution).
Your timeline preview should now look like this:
For the rectangle color, by default it will appear as gray. If you want to define specific RGB values, use the “Solid” type and enter each RGB value. 0.5 in all channels will return a uniform gray background.
Create a Circular Region on top of the Background
Now that our background is properly defined, we can add a circular region on top of the background. In the Component Library, under Regions, drag and drop an “Oval” in your epoch.
A new region was added, as shown by the outline appearing on the timeline preview. However, it is not visible as the oval is the same color as the background. To remedy this, we must adjust the color properties of the new Oval region. We set it to white.
Once this is defined, your timeline preview should now look like this:
To better understand the effect of different region properties, please take some time to experiment with different values in each of the “Oval” region’s properties. Refer to Region Shared Parameter Groups to read on the effect of each property.
Part 2 – Use Patterns to Display a Circular Grating
Following the previous part, let us learn how to add a pattern to a specific region on the screen.
Add a Grating Inside the Oval Region
To add a pattern to a region, drag & drop a pattern into the region name in the Epoch. To add a grating, look at the Component Library, under Patterns, and select Grating. Drag & drop this component over the Oval region defined previously. Your timeline preview should now look like this:
The grating component was successfully added to the epoch, however, it is not visible in the preview. To change this, we must change the Color property of the Oval object so that its Type is set to Full.
Your timeline preview should now look like this:
Change Pattern Properties
As with the Oval region in the part, we can now change the properties of the Grating object to modify its appearance. The properties are set in the Properties window. As an example, let us change the Grating’s Orientation and Spatial Frequency. We can apply a 45 degrees counterclockwise rotation, and change the Spatial Frequency to 2 cycles per degrees:
Your grating should now look like this in your timeline preview:
Part 3 – Use Combine Mode to Create a Gabor Patch
LabMaestro patterns can also be combined to create more complex visual stimuli. In this part, we will combine the previously created grating with a Gaussian pattern to create a Gabor patch.
As a first step, let us add a Gaussian pattern to our timeline. To do so, look at the Component Library, under Patterns, and choose Gaussian. Drag & drop this pattern over the Oval region in your epoch. Your timeline preview should now look like this:
As you can see, the Gaussian was added on top of the grating component. However, this is not the outcome we want. To change this, look at the Properties window when selecting the Gaussian pattern, you will see a new property, named “Combine Mode.”
Combine Modes
Combine modes allow for the combination of different patterns to create complex shapes. This property has two possible values:
Add (Default): Components’ pixel color values are summed (Grating + Gaussian).
Multiply: Components’ pixel color values are multiplied (Grating * Gaussian).
To create a Gabor Patch, we choose the Multiply combine mode. Once this is changed, your timeline preview should look like this:
We now have a proper Gabor patch, but the patch is small. We can change this by editing the standard deviation property of the Gaussian component. For instance, by setting it to .4 degrees of visual angle for both height and width, we obtain:
There are many more possible uses of combine modes. For instance, combining two gratings of different orientations using the Multiply combine mode can create plaids, like so:
To get more information on using combine modes, please refer to the Combine Modes page.
Part 4 – Using a Custom Resource as a Pattern
f your experiments require more complex or “real-world” visual stimuli (e.g. Faces), LabMaestro allows users to import custom resources to be used as patterns. This can be done in the Project window, by right-clicking Resources, and selecting Add.
You can then browse your file explorer to import your resource into the project. The resource will then appear greyed out (while unused) under the Resource section of the project window. As a good practice, we recommend keeping your resources in the same folder structure as the LabMaestro project.
To use this resource in a project, you can use the Picture component. Let’s first add this component to the previously created Oval region. To do so, look in the Component Library, under Patterns, and drag & drop the Picture component on top of the Oval region. Here is what the timeline preview will look like:
We must now specify which resource we will be using in the Picture component’s properties. Set the Resource property to the image you previously imported to the project:
Once this is done, your timeline preview should now look like this:
If you are using video stimuli, you can replace the Picture component with the Movie component. Videos can be imported to the LabMaestro project in the same way as images.
This concludes our tutorial on the basics of using regions and patterns to render visual stimuli in LabMaestro. If you need further assistance or would like to suggest additional topics to be covered on this page, feel free to contact us at support@vpixx.com.