picture

 element objects

One or more images from image files (jpeg, bmp, etc.) or MATLAB image arrays. In addition to the usual options all visual elements have, picture property imageCode allows applying any MATLAB code to transform the image(s).

To show multiple pictures in a sequence, use a sequence element. To show multiple pictures as frames of a movie, use tool images2movie in <PsychBench folder>/tools to render them into a movie file and show it using a movie element.

▸ Object ends on its own?

"Ends on its own" means ends automatically at that point. If an element can end on its own, you don't need to set end conditions for it in property end (unless you want it to maybe end earlier).

No—runs until any condition you set in property end.

Input properties
Record properties
picture
elements (see below)

fileName
dataExpr
bitDepth
crop
height
grayscale
imageCode
positions
rotations

All visual elements
position
depth

nn_eyes
rotation
flipHorz
flipVert

colorMask
alpha
intensity
contrastMult
convolution
shader
filterOrder
filterGrayscale
filterResolutionMult
filterGamma

channelResolution
backColor
addDisplay

All visual elements
position

All adjuster elements have
adjust

All elements
start
end

startBuffer
endBuffer

vary
staircase

All objects
report
info

fileName
dataExpr

No defaults

fileName is a string that is name of an image file to show. Include path if the file is not in the MATLAB current folder or search path (or not the first file with that name on the search path). File can be any format MATLAB imread accepts. Default <cd>[]<cd> = get image using dataExpr instead.

OR

dataExpr: Use this to get the image from an image matrix in the base MATLAB workspace. This can be just a variable name, or it can include indexes, field names, etc.

e.g.
<cds>"pictureData"<cds>
<cds>"pictures{5}"<cds>
<cds>"albums.cats(2).pic"<cds>

An image matrix has dimensions height px (rows) × width px (columns) × 1/2/3/4 (1 = L, 2 = LA, 3 = RGB, 4 = RGBA). By default values should be 0–255 (i.e. 8 bits/channel), but you can change this using bitDepth below. Default <cd>[]<cd> = get image using fileName instead.

Or if you use positions below to show multiple images, you can use a string or cell array for either/both of fileName and dataExpr to set different values for different images.

bitDepth

Default: automatic for most images loaded from files, else 8 bits/channel

PsychBench automatically detects this for most images loaded from files. If it can't, or if you use dataExpr above to get the image from an image array, then you can specify bits per pixel channel (e.g. R, G, B) here. Usually leave at default = 8 (pixel channel values between 0–255).

Or if you use positions below to show multiple images, you can use a vector for different bit depths.

crop

Default: show whole image

A 1×4 vector [x_tl y_tl x_br y_br] setting part of the image to show. +x = right, +y = down, <cd>[0 0]<cd> = top left of image. Units are px in the image file (independent of your screen or the size you show the image at). For right and bottom you can use <cd>inf<cd> to mean that edge of the image, e.g. <cd>[0 0 inf inf]<cd> = show whole image. Note other properties like height below are applied after crop.

Or if you use positions below to show multiple images, you can use an n×4 matrix for different crops.

height

Default: 1 px in image = 1 px on screen

A number that is height on screen to show at (deg).

OR a string setting overall size of the image on screen:

<cds>"fit"  <cds> – fit to window
<cds>"fitw" <cds> – fit width to window
<cds>"fith" <cds> – fit height to window
<cds>"fill" <cds> – fill window
<cds>"px"   <cds> – native resolution: 1 pixel in image = 1 pixel on screen (scaled down if you use a partial screen window)

All the fit and fill options assume the image is centered in the window.

Or if you use positions below to show multiple images, you can use a vector, string array, or cell array of numbers and strings for different sizes.

grayscale

Default: show in color (for a color image)

<cd>true<cd>/<cd>false<cd>: show image in grayscale. Or if you use positions below to show multiple images, you can use a 1×n array for different grayscale settings.

imageCode

Default: no custom transformation

You can set this to a string that is the name of a MATLAB script for PsychBench to run to apply custom transformation(s) to the image. The code must reference a variable image, which will contain the image matrix loaded by fileName/dataExpr above, and possibly reduced by properties crop and grayscale. The one difference is that all values in image will be normalized to 0 = min / 1 = max (instead of e.g. 0–255). The same variable image must contain the transformed image matrix (also using range 0–1) at the end of the code.

image is an m × n × 1–4 L/LA/RGB/RGBA matrix:

L (luminance) = grayscale
LA (luminance alpha) = grayscale with transparency
RGB (red green blue) = color
RGBA (red green blue alpha) = color with transparency

Tip: If in doubt, you can include a <cd>size(image)<cd> statement with no semicolon in the code, quit the experiment (Ctrl+Esc), and check the output in the MATLAB command window.

Default <cd>[]<cd> = none.

Or if you use positions below to show multiple images, you can use a string or cell array for different custom code.

positions

Default: show one image centered at element position

If you want to show multiple images at the same time, you can set that here. This is more efficient than using multiple picture elements. positions is a 2-column matrix setting centers for the images, with rows corresponding to images and columns to [x y] coordinates (deg). + = right⁠/⁠down and positions are relative to element position, which you can set in position (default relative to screen center). Images are also layered front to back in the order you list them.

If you show multiple images then for each of the other properties above and below you can set one value for all of them, or different values for different images using a vector or matrix (see property).

rotations

Default: no rotation of each image

If you use positions above to show multiple images, you can apply rotation to each one here. This is rotation clockwise (from +x to +y screen axis, with +y down) about respective image center (deg). Or you can use a vector for different rotations. Note you can still use property rotation to rotate the whole element display, i.e. all the images as a set.

Adjustable properties

You can vary or allow the subject to adjust the following properties of an object of this type when it's running. If you need to make other properties adjustable, you can edit the element type code—see Element Type Programming Manual.

Adjustable properties

Adjustable properties

position
nn_eyes
rotation
colorMask
alpha
intensity
contrastMult
drawCodeVars

(None)

(None)

Input properties
Record properties

PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.

picture
elements (see below)

All elements
startTime
endTime
duration
n_startFrame
n_endFrame
startLatencyBufferable
endLatencyBufferable