Many experiments involve displaying a sequence of image stimuli. If the images you want to use are in a folder on disk, you can easily create a group of image stimuli using a replicator.
Suppose you have a directory named
images that contains seven image files named
7.png. The example experiment range_rep_example.xml demonstrates how to use a range replicator to generate a group of image stimuli from the images.
Note that all the image stimuli generated via a replicator have identical parameters (position, size, etc.). If you want to vary the parameters of each stimulus independently, you’ll have to create them individually, without using a replicator.
Since a range replicator iterates over a sequence of integers, using it as described above requires that your images have names of the form
<index> is one of the integers generated by the replicator, and
<suffix> are identical for all images (e.g.
image_2.jpg, …). You can avoid this restriction on image file names by using a list replicator and the “filenames” directive.
The example experiment list_rep_example.xml demonstrates how you can load the same set of seven images using a list replicator. The “values” parameter of the replicator contains the expression
filenames(images/*), which is expanded at parse time into the list “images/1.png, images/2.png, … images/7.png”.
The general syntax of the “filenames” directive is
glob_expr is a shell-style file name pattern that must match one or more files. Both absolute and relative paths are acceptable. If
glob_expr matches no files, the parser raises an error.
Note that the “values” parameter can contain more than one “filenames” directive, and “filenames” directives can be mixed with other items. For example, here’s another way to replicate over the same seven images: