... | @@ -2,12 +2,12 @@ |
... | @@ -2,12 +2,12 @@ |
|
|
|
|
|
## loadImage
|
|
## loadImage
|
|
|
|
|
|
function: image = loadImage(filename)
|
|
function: image = [loadImage(filename)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/loadImage.m)
|
|
|
|
|
|
**Description**
|
|
**Description**
|
|
Loads an image for use with the OTBR Toolbox. Call imformats to see a list of supported formats and their file extensions.
|
|
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.
|
|
Make sure [initWindow](/Stimuli-Display#initwindow) is already called. Otherwise this function will fail.
|
|
|
|
|
|
**Inputs**
|
|
**Inputs**
|
|
~~~
|
|
~~~
|
... | @@ -20,25 +20,25 @@ Make sure initWindow is already called. Otherwise this function will fail. |
... | @@ -20,25 +20,25 @@ Make sure initWindow is already called. Otherwise this function will fail. |
|
~~~
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
**Examples**
|
|
~~~
|
|
~~~matlab
|
|
1. im = loadImage('d:\Exp\pic1.jpg');
|
|
1. im = loadImage('d:\Exp\pic1.jpg');
|
|
~~~
|
|
~~~
|
|
|
|
|
|
**See also**
|
|
**See also**
|
|
initWindow, showStimuli, rotateStimuli
|
|
[initWindow](/Stimuli-Display#initwindow), [showStimuli](/Image-display#showstimuli), rotateStimuli
|
|
|
|
|
|
## showStimuli
|
|
## showStimuli
|
|
|
|
|
|
function: rect = showStimuli(im, position, varargin)
|
|
function: rect = [showStimuli(im, position, varargin)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/showStimuli.m)
|
|
|
|
|
|
**Description**
|
|
**Description**
|
|
Displays previously loaded image(s) on the monitor. This functions can be used in two different modes:
|
|
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 1: second argument is a scalar/number that is linked to the previously defined "response keys" in the file [myParadigmSetup.m](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/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).
|
|
Mode 2: the position of the stimulus can be positioned individually 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 call of [showStimuli](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/showStimuli.m) requires a call of [initOTBR](/Initialization#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.
|
|
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**
|
|
**Inputs**
|
... | @@ -66,7 +66,30 @@ The position of the image is defined by the position of the InputKey(s) or by th |
... | @@ -66,7 +66,30 @@ The position of the image is defined by the position of the InputKey(s) or by th |
|
~~~
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
**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.).
|
|
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.](/Getting-started#setup-an-experiment)).
|
|
|
|
|
|
|
|
~~~matlab
|
|
|
|
% initialize toolbox (internal call of myHardwareSetup and myParadigmSetup)
|
|
|
|
initOTBR;
|
|
|
|
|
|
|
|
% initialize presentation window on your device's second monitor
|
|
|
|
initWindow(2);
|
|
|
|
|
|
|
|
% load an image contained in your stimuli folder
|
|
|
|
image=loadImage('D:\myExperiment\Stimuli\Example.png');
|
|
|
|
|
|
|
|
% present the image the position 5 (middle of the screen)
|
|
|
|
rect=showStimuli(image, 5);
|
|
|
|
|
|
|
|
% wait for 1 second
|
|
|
|
WaitSecs(1);
|
|
|
|
|
|
|
|
% close the presentation window
|
|
|
|
closeWindow;
|
|
|
|
|
|
|
|
% stop the experiment and close the toolbox
|
|
|
|
stopExperiment;
|
|
|
|
~~~
|
|
|
|
|
|
![image](uploads/80e72408fb6f82a2d297607a0ee6115b/image.png)
|
|
![image](uploads/80e72408fb6f82a2d297607a0ee6115b/image.png)
|
|
|
|
|
... | @@ -75,54 +98,61 @@ Using these commands will lead to the following presentation screen: |
... | @@ -75,54 +98,61 @@ Using these commands will lead to the following presentation screen: |
|
![image](uploads/54bdfba2debbcfc80f45b19c426a129a/image.png)
|
|
![image](uploads/54bdfba2debbcfc80f45b19c426a129a/image.png)
|
|
|
|
|
|
**Examples**
|
|
**Examples**
|
|
~~~
|
|
~~~matlab
|
|
1. Displays image go at position 1 (previously defined in myParadigmSetup.m)
|
|
1. showStimuli(go , 1);
|
|
showStimuli(go , 1);
|
|
% Displays image go at position 1 (previously defined in myParadigmSetup.m)
|
|
|
|
|
|
2. Displays two images go and nogo at position 2 and 4
|
|
2. showStimuli([go nogo] , [2 4]);
|
|
showStimuli([go nogo] , [2 4]);
|
|
% Displays two images go and nogo at position 2 and 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
|
|
3. showStimuli(stimulus1, 'x', 10, 'y', 15);
|
|
showStimuli(stimulus1, 'x', 10, 'y', 15);
|
|
% 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
|
|
|
|
|
|
4. Display image independently of predefined key positions! Stimulus 2 is presented at the center of the screen (no additional arguments required)
|
|
4. showStimuli(stimulus2);
|
|
showStimuli(stimulus2);
|
|
% Display image independently of predefined key positions! Stimulus 2 is presented at the
|
|
|
|
% center of the screen (no additional arguments required)
|
|
|
|
|
|
5. Display two images at the same time independently of predefined keys positions! The optional argument 'dontFlip' is needed to allow multiple other stimuli.
|
|
5. showStimuli(stimulus1, 'x', 50, 'y', 75, 'dontFlip');
|
|
showStimuli(stimulus1, 'x', 50, 'y', 75, 'dontFlip');
|
|
showStimuli(stimulus2, 'x', 70, 'y', 10);
|
|
showStimuli(stimulus2, 'x', 70, 'y', 10);
|
|
% Display two images at the same time independently of predefined keys positions!
|
|
|
|
% The optional argument 'dontFlip' is needed to allow multiple other stimuli.
|
|
|
|
|
|
6. Displays image go at position 2 and rotated by 75°
|
|
6. showStimuli(go , 2, 'rotation', 75);
|
|
showStimuli(go , 2, 'rotation', 75);
|
|
% Displays image go at position 2 and rotated by 75°
|
|
|
|
|
|
7. Displays image go at position 2 and with 75% transparency
|
|
7. showStimuli(go , 2, 'transparency', 75);
|
|
showStimuli(go , 2, 'transparency', 75);
|
|
% Displays image go at position 2 and with 75% transparency
|
|
|
|
|
|
8. Displays image go at position 1 (normal oriented) and nogo at position 2 (rotated by 215 degree)
|
|
8. showStimuli([go nogo] , [1 2] , 'rotation', [0 215]);
|
|
showStimuli([go nogo] , [1 2] , 'rotation', [0 215]);
|
|
% Displays image go at position 1 (normal oriented) and nogo at position 2 (rotated by 215
|
|
|
|
% degree)
|
|
|
|
|
|
9. Displays image go at position 1 (with 80% transparency) and nogo at position 2 (transparency 10%)
|
|
9. showStimuli([go nogo], [1 2], 'transparency', [80 10]);
|
|
showStimuli([go nogo], [1 2], 'transparency', [80 10]);
|
|
% Displays image go at position 1 (with 80% transparency) and nogo at position 2
|
|
|
|
% (transparency 10%)
|
|
|
|
|
|
10. Displays image go and a white bar on top of the screen
|
|
10. showStimuli(go , 2, 'ephys');
|
|
showStimuli(go , 2, 'ephys');
|
|
% Displays image go and a white bar on top of the screen
|
|
|
|
|
|
11. This will clear the display window (delete the stimuli)
|
|
11. showStimuli;
|
|
showStimuli;
|
|
% This will clear the display window (delete the stimuli)
|
|
|
|
|
|
12. Display image at a given position in pixel (coordinates are in psychtoolbox format!) This is for advanced users mostly!
|
|
12. showStimuli(go, 'rect', [10 10 310 110]);
|
|
showStimuli(go, 'rect', [10 10 310 110]);
|
|
% Display image at a given position in pixel (coordinates are in psychtoolbox format!)
|
|
|
|
% This is for advanced users mostly!
|
|
|
|
|
|
13. Display more images at given positions in pixel (coordinates are in psychtoolbox format!) This is for advanced users mostly!
|
|
13. showStimuli([go nogo], 'rect', [10 10 100 100; 210 410 310 510]);
|
|
showStimuli([go nogo], 'rect', [10 10 100 100; 210 410 310 510]);
|
|
% Display more images at given positions in pixel (coordinates are in psychtoolbox format!)
|
|
|
|
% This is for advanced users mostly!
|
|
~~~
|
|
~~~
|
|
|
|
|
|
## showManyStimuli
|
|
## showManyStimuli
|
|
|
|
|
|
function: rect = showManyStimuli(image, varargin)
|
|
function: rect = [showManyStimuli(image, varargin)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/showManyStimuli.m)
|
|
|
|
|
|
**Description**
|
|
**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.
|
|
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](/How-tos#flip-dontFlip) option (advanced users). For this option please read the [chapter 2.1. Flip/dontFlip](/How-tos#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**
|
|
**Inputs**
|
|
~~~
|
|
~~~
|
... | @@ -145,9 +175,10 @@ Use this function to display many stimuli on the stimulus screen at the same tim |
... | @@ -145,9 +175,10 @@ Use this function to display many stimuli on the stimulus screen at the same tim |
|
~~~
|
|
~~~
|
|
|
|
|
|
**Examples**
|
|
**Examples**
|
|
~~~
|
|
~~~matlab
|
|
1. showManyStimuli(goStimulus);
|
|
1. showManyStimuli(goStimulus);
|
|
% Shows the image goStimulus in the middle of the screen. Use showStimuli to do % that!!!
|
|
% 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]);
|
|
2. showManyStimuli([go nogo], 'x',[10 20] , 'y', [10 30]);
|
|
% Shows the image go and nogo on the left upper corner of the screen.
|
|
% Shows the image go and nogo on the left upper corner of the screen.
|
... | @@ -158,4 +189,4 @@ Use this function to display many stimuli on the stimulus screen at the same tim |
... | @@ -158,4 +189,4 @@ Use this function to display many stimuli on the stimulus screen at the same tim |
|
4. showManyStimuli(goStimulus,'dontFlip');
|
|
4. showManyStimuli(goStimulus,'dontFlip');
|
|
showManyStimuli(nogo, 'x','left', 'y','top');
|
|
showManyStimuli(nogo, 'x','left', 'y','top');
|
|
% Shows both images on the screen at the same time.
|
|
% Shows both images on the screen at the same time.
|
|
~~~ |
|
~~~ |
|
|
|
\ No newline at end of file |