Skip to content

Tokenized Image Stimulus

A tokenized-image stimulus is similar to the tokenized text stimulus, except that the token is an image instead of a text segment. A tokenized-image stimulus is primarily intended for creating GIF-like stimuli with precise timing control of each token (i.e., “frame”). At the time being, only automated presentation is supported.

Required Properties

type

  • Definition: The type of stimulus (text, tokenized_text, image, etc.)
  • Possible values: For a tokenized-image stimulus, type must be specified as tokenized_image.
{
  "type": "tokenized_image",
  "content": ["a.jpg", "b.jpg", "c.jpg"]
}

content

  • Definition: A list consisting of the file names of the list of images to be displayed
  • Possible values: Must be the file names of the image files (e.g. ["a.jpg", "b.jpg", "c.jpg"])
{
  "type": "tokenized_image",
  "content": ["a.jpg", "b.jpg", "c.jpg"]
}

Optional Properties

barrier

  • Definition: If set to true, then all subsequent stimuli and responses will not be displayed until this tokenized image stimulus displays all its images.
  • Possible values: true or false
  • Default: true

{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "barrier": false
}
In trials using the above stimulus code, other stimuli and responses will be displayed at the same time as the tokenized image.
{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "barrier": true
}
In trials using the above stimulus code, the tokenized image will play before other stimuli and responses are displayed. This code is equivalent to code where the barrier property is not specified.

delay

Info

This property is used for presenting multiple stimuli on a trial in a sequence. To implement inter-trial intervals, see the delay parameter in trial templates instead.

Warning

The delaying of multiple stimuli on a trial does NOT have a chain effect. That is, the delay of any stimulus on a trial is always relative to the onset of that trial or the end of the last stimulus acting as a barrier.

  • Definition: Delay the onset of a stimulus by a certain number of seconds, relative to (1) the onset of a trial if there are no stimuli acting as barriers or (2) the end of the last stimulus acting as a barrier.
  • Possible values: A number in seconds (decimals are supported)
  • Default: 0 (no delay)

mode

  • Definition: The mode in which the tokenized image stimulus is displayed
  • Possible values: "plain" (a sequence of images unfolding from left to right) or "singleton" (i.e., GIF-like stimulus)
  • Default: singleton
{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "mode": "singleton"
}

token_duration

  • Definition: The speed, in seconds per token, at which each token image in a tokenized image stimulus is presented.
  • Possible values: A number of seconds per token (i.e. 2) to be displayed, or a list of values specifying the duration of each token (i.e., [1, 2, 3]).

{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "self_paced": false,
  "token_duration": 2 // or [1, 2, 3]
}
In this sample code, a new token will be displayed every 2 seconds.

width

  • Definition: The width at which the image is displayed
  • Possible values: A number; percentages (e.g., "50%"), pixels (e.g., "200px"), and other CSS width control units are supported.
  • Default (by omission): The actual width of the image
{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "width": "200px"
}

height

  • Definition: The height to display all image tokens in, if a uniform height is desirable.
  • Possible values: A number; percentages (e.g., "50%"), pixels (e.g., "200px"), and other CSS width control units are supported.
  • Default (by omission): The actual height of the image
{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "height": "200px"
}

keep_last

  • Definition: Whether to keep the last token on display after the stimulus completes presenting (only relevant when "mode" is "singleton").
  • Possible values: true or false
  • Default: false
{
  "type": "tokenized_image",
  "content": ["a.jpg”, "b.jpg", "c.jpg"],
  "mode": "singleton",
  "keep_last": true
}

See Also

Image Stimulus, Tokenized Text