Previous topic

ShapeStim

Next topic

TextStim

This Page

Quick links

SimpleImageStim

class psychopy.visual.SimpleImageStim(win, image='', units='', pos=(0.0, 0.0), contrast=1.0, opacity=1.0, flipHoriz=False, flipVert=False, name='', autoLog=True)

A simple stimulus for loading images from a file and presenting at exactly the resolution and color in the file (subject to gamma correction if set).

Unlike the PatchStim, this type of stimulus cannot be rescaled, rotated or masked (although flipping horizontally or vertically is possible). Drawing will also tend to be marginally slower, because the image isn’t preloaded to the graphics card. The advantage, however is that the stimulus will always be in its original aspect ratio, with no interplotation or other transformation.

SimpleImageStim does not support a depth parameter (the OpenGL method that draws the pixels does not support it). Simple images will obscure any other stimulus type.

Parameters :
win :

a Window object (required)

image :

The filename, including relative or absolute path. The image can be any format that the Python Imagin Library can import (which is almost all).

units : None, ‘height’, ‘norm’, ‘cm’, ‘deg’ or ‘pix’

If None then the current units of the Window will be used. See Units for the window and stimuli for explanation of other options.

pos :

a tuple (0.0,0.0) or a list [0.0,0.0] for the x and y of the centre of the stimulus. The origin is the screen centre, the units are determined by units (see above). Stimuli can be position beyond the window!

contrast :

How far the stimulus deviates from the middle grey. Contrast can vary -1:1 (this is a multiplier for the values given in the color description of the stimulus)

opacity :

1.0 is opaque, 0.0 is transparent

name : string

The name of the object to be using during logged messages about this stim

draw(win=None)

Draw the stimulus in its relevant window. You must call this method after every MyWin.flip() if you want the stimulus to appear on that frame and then update the screen again.

setDepth(newDepth, operation='')
setFlipHoriz(newVal=True)

If set to True then the image will be flipped horiztonally (left-to-right). Note that this is relative to the original image, not relative to the current state.

setFlipVert(newVal=True)

If set to True then the image will be flipped vertically (top-to-bottom). Note that this is relative to the original image, not relative to the current state.

setImage(filename=None)

Set the image to be drawn.

Parameters :
  • filename:

    The filename, including relative or absolute path if necessary. Can actually also be an image loaded by PIL.

setPos(newPos, operation='', units=None)
setUseShaders(val=True)

Set this stimulus to use shaders if possible.