Package psychopy :: Module visual :: Class SimpleImageStim
[frames] | no frames]

Class SimpleImageStim

source code

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 gfx card. The advantage, however is that the stimulus will always be in its original aspect ratio, with no interplotation or other transformation. It is always

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.

Also, unlike the PatchStim (whose textures should be square and power-of-two in size, there is no restriction on the size of images for the SimpleImageStim

Instance Methods
 
__init__(self, win, image='', units='', pos=(0.0, 0.0), contrast=1.0, opacity=1.0, flipHoriz=False, flipVert=False)
:Parameters:
source code
 
setFlipHoriz(self, newVal=True)
If set to True then the image will be flipped horiztonally (left-to-right).
source code
 
setFlipVert(self, newVal=True)
If set to True then the image will be flipped vertically (top-to-bottom).
source code
 
setUseShaders(self, val=True)
Set this stimulus to use shaders if possible.
source code
 
draw(self, win=None)
Draw the stimulus in its relevant window.
source code
 
setPos(self, newPos, operation='', units=None) source code
 
setDepth(self, newDepth, operation='') source code
 
setImage(self, filename=None)
Set the image to be drawn.
source code
Method Details

__init__(self, win, image='', units='', pos=(0.0, 0.0), contrast=1.0, opacity=1.0, flipHoriz=False, flipVert=False)
(Constructor)

source code 

:Parameters:

    
    win :
        a :class:`~psychopy.visual.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**, 'norm', 'cm', 'deg' or 'pix'  
        If None then the current units of the :class:`~psychopy.visual.Window` will be used. 
        See :ref:`units` 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
        

setFlipHoriz(self, newVal=True)

source code 
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(self, newVal=True)

source code 
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.

draw(self, win=None)

source code 
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.

setImage(self, filename=None)

source code 
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.