... | ... | @@ -2,6 +2,160 @@ |
|
|
|
|
|
## loadImage
|
|
|
|
|
|
function: image = loadImage(filename)
|
|
|
|
|
|
**Description**
|
|
|
Loads an image for use with the OTBR Toolbox. Call imformats to see a list of supported formats and their file extensions.
|
|
|
|
|
|
Make sure initWindow is already called. Otherwise this function will fail.
|
|
|
|
|
|
**Inputs**
|
|
|
~~~
|
|
|
filename path and name of the image-file
|
|
|
~~~
|
|
|
|
|
|
**Outputs**
|
|
|
~~~
|
|
|
image the image-object
|
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
|
~~~
|
|
|
1. im = loadImage('d:\Exp\pic1.jpg');
|
|
|
~~~
|
|
|
|
|
|
**See also**
|
|
|
initWindow, showStimuli, rotateStimuli
|
|
|
|
|
|
## showStimuli
|
|
|
|
|
|
## showManyStimuli |
|
|
\ No newline at end of file |
|
|
function: rect = showStimuli(im, position, varargin)
|
|
|
|
|
|
**Description**
|
|
|
Displays previously loaded image(s) on the monitor. This functions can be used in two different modes:
|
|
|
|
|
|
Mode 1: second argument is a scalar/number that is linked to the previously defined "response keys" in the file myParadigmSetup.m This mode allows to present a stimulus at a previously defined position by prividing a single number.
|
|
|
|
|
|
Mode 2: the position of the stimulus can be positioned indivisually by either defining the position of the left upper corner in percent or by defining a rect (see exampled below).
|
|
|
|
|
|
The call of showStimuli requires a call of initOTBR.
|
|
|
The position of the image is defined by the position of the InputKey(s) or by the x and y position in percent to position the stimulus freely on the presentation monitor.
|
|
|
|
|
|
**Inputs**
|
|
|
~~~
|
|
|
data : image object
|
|
|
~~~
|
|
|
|
|
|
**Inputs-optional**
|
|
|
~~~
|
|
|
position (as second argument, see examples): Position of the image (images),
|
|
|
scalar or vector or x and y position (see examples)
|
|
|
x x Position in percent (0 -> left, 100 -> right)
|
|
|
y y Position in percent (0 -> top, 100 -> bottom)
|
|
|
rotation Specifies a rotation angle in degree for rotated drawing of the texture
|
|
|
transparency Specifies the transparency of an image in percent. From 0 (fully opaque) to 100 (fully transparent)
|
|
|
ephys displays a white bar (usually on top of the monitor) to trigger a photo
|
|
|
diode. This is useful to get the exact timing when the stimulus was presented on the monitor.
|
|
|
rect Specifies the position of the stimulus in pixel
|
|
|
dontFlip Don't flip buffers (advanced users)
|
|
|
~~~
|
|
|
|
|
|
**Outputs**
|
|
|
~~~
|
|
|
rect returns the rect vector of the image
|
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
|
The following two screenshots show all commands necessary for showing one single simple image that has been stored in the stimuli folder before (see section 1.2.).
|
|
|
|
|
|
![image](uploads/80e72408fb6f82a2d297607a0ee6115b/image.png)
|
|
|
|
|
|
Using these commands will lead to the following presentation screen:
|
|
|
|
|
|
![image](uploads/54bdfba2debbcfc80f45b19c426a129a/image.png)
|
|
|
|
|
|
**Examples**
|
|
|
~~~
|
|
|
1. Displays image go at position 1 (previously defined in myParadigmSetup.m)
|
|
|
showStimuli(go , 1);
|
|
|
|
|
|
2. Displays two images go and nogo at position 2 and 4
|
|
|
showStimuli([go nogo] , [2 4]);
|
|
|
|
|
|
3. Display image independently of predefined key positions! Stimulus 1 is presented at the left upper corner of the screen. 10% in x direction and 15% in y directtion
|
|
|
showStimuli(stimulus1, 'x', 10, 'y', 15);
|
|
|
|
|
|
4. Display image independently of predefined key positions! Stimulus 2 is presented at the center of the screen (no additional arguments required)
|
|
|
showStimuli(stimulus2);
|
|
|
|
|
|
5. Display two images at the same time independently of predefined keys positions! The optional argument 'dontFlip' is needed to allow multiple other stimuli.
|
|
|
showStimuli(stimulus1, 'x', 50, 'y', 75, 'dontFlip');
|
|
|
showStimuli(stimulus2, 'x', 70, 'y', 10);
|
|
|
|
|
|
6. Displays image go at position 2 and rotated by 75°
|
|
|
showStimuli(go , 2, 'rotation', 75);
|
|
|
|
|
|
7. Displays image go at position 2 and with 75% transparency
|
|
|
showStimuli(go , 2, 'transparency', 75);
|
|
|
|
|
|
8. Displays image go at position 1 (normal oriented) and nogo at position 2 (rotated by 215 degree)
|
|
|
showStimuli([go nogo] , [1 2] , 'rotation', [0 215]);
|
|
|
|
|
|
9. Displays image go at position 1 (with 80% transparency) and nogo at position 2 (transparency 10%)
|
|
|
showStimuli([go nogo], [1 2], 'transparency', [80 10]);
|
|
|
|
|
|
10. Displays image go and a white bar on top of the screen
|
|
|
showStimuli(go , 2, 'ephys');
|
|
|
|
|
|
11. This will clear the display window (delete the stimuli)
|
|
|
showStimuli;
|
|
|
|
|
|
12. Display image at a given position in pixel (coordinates are in psychtoolbox format!) This is for advanced users mostly!
|
|
|
showStimuli(go, 'rect', [10 10 310 110]);
|
|
|
|
|
|
13. Display more images at given positions in pixel (coordinates are in psychtoolbox format!) This is for advanced users mostly!
|
|
|
showStimuli([go nogo], 'rect', [10 10 100 100; 210 410 310 510]);
|
|
|
~~~
|
|
|
|
|
|
## showManyStimuli
|
|
|
|
|
|
function: rect = showManyStimuli(image, varargin)
|
|
|
|
|
|
**Description**
|
|
|
Use this function to display many stimuli on the stimulus screen at the same time. The same can be achieved by displaying several stimuli with the ‘dontFlip’ option (advanced users). For this option please read the chapter 2.1. Flip/dontFlip. Also allows to merge two (or more) images into one if one of the two (or all except one) contains transparent backgrounds/ elements.
|
|
|
|
|
|
**Inputs**
|
|
|
~~~
|
|
|
image image loaded with loadImage
|
|
|
~~~
|
|
|
|
|
|
**Inputs-optional**
|
|
|
~~~
|
|
|
varargin ‘x’ x position in percent (0 -> left, 100 -> right)
|
|
|
x position as a string (left, center, right)
|
|
|
Use a vector for multiple stimuli
|
|
|
‘y’ y position in percent (0 -> top, 100 -> bottom)
|
|
|
y position as a string (top, center, bottom)
|
|
|
Use a vector for multiple stimuli
|
|
|
‘rect’ position as a rect. NOT in combination with x and y
|
|
|
(percentage), use pixel number as x and y coordinates
|
|
|
for the upper left and lower right corner (advanced users)
|
|
|
Use a matrix for multiple stimuli!!!
|
|
|
‘dontFlip’ don't flip buffers (advanced users)
|
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
|
~~~
|
|
|
1. showManyStimuli(goStimulus);
|
|
|
% Shows the image goStimulus in the middle of the screen. Use showStimuli to do % that!!!
|
|
|
|
|
|
2. showManyStimuli([go nogo], 'x',[10 20] , 'y', [10 30]);
|
|
|
% Shows the image go and nogo on the left upper corner of the screen.
|
|
|
|
|
|
3. showManyStimuli(go, 'y', 80);
|
|
|
% Shows the stimulus in the lower end of the screen and centered.
|
|
|
|
|
|
4. showManyStimuli(goStimulus,'dontFlip');
|
|
|
showManyStimuli(nogo, 'x','left', 'y','top');
|
|
|
% Shows both images on the screen at the same time.
|
|
|
~~~ |