Class to integrate CARLsim with a stimulus created using VisualStimulus.m Version: 4/11/14 Author: Michael Beyeler mbeye.nosp@m.ler@.nosp@m.uci.e.nosp@m.du
More...
#include <visual_stimulus.h>
This class provides a means to integrate CARLsim with a stimulus created using VisualStimulus.m. The class reads from binary file, and returns either the raw character array or a PoissonRate object with the same size as number of pixels in a stimulus frame.
Common workflow:
- 2. In your main_.cpp, read from binary file:
int videoLength = VS.getStimulusLength();
- 3. Assign each frame to a SpikeGenerator group and run network
for (int i=0; i<videoLength; i++) {
snn.setSpikeRate(g1, rates);
snn.runNetwork(1,0);
}
Definition at line 58 of file visual_stimulus.h.
◆ VisualStimulus()
Instantiates an VisualStimulus object.
- Parameters
-
[in] | fileName | path to binary file that was created using VisualStimulus.m |
[in] | wrapAroundEOF | after reaching the end of the file, whether to jump back to the top and start reading the first frame again. If this flag is false and the EOF is reached, a warning will be printed. Default: true. |
Definition at line 229 of file visual_stimulus.cpp.
◆ ~VisualStimulus()
◆ getChannels()
◆ getCurrentFrameChar()
unsigned char * getCurrentFrameChar |
( |
| ) |
|
◆ getCurrentFrameNumber()
int getCurrentFrameNumber |
( |
| ) |
|
◆ getCurrentFramePoisson()
◆ getHeight()
◆ getLength()
◆ getType()
◆ getWidth()
◆ print()
◆ readFrameChar()
unsigned char * readFrameChar |
( |
| ) |
|
Advances the frame index by 1 (getCurrentFrameNumber) and returns the raw grayscale values for each pixel. The char array will have a total of getStimulusWidth()*getStimulusHeight()*getStimulusChannels() entries. The order is columns first (so the first getStimulusWidth() number of pixels will correspond to the top image row). Currently, only grayscale images are supported. Note that this will advance the frame index. If you want to access the char array or PoissonRate object of a frame that has already been read, use getCurrentFrameChar() or getCurrentFramePoisson() instead.
- Returns
- pointer to the char array of raw grayscale values
Definition at line 232 of file visual_stimulus.cpp.
◆ readFramePoisson()
PoissonRate * readFramePoisson |
( |
float |
maxPoisson, |
|
|
float |
minPoisson = 0.0f |
|
) |
| |
Advances the frame index by 1 (getCurrentFrameNumber) and returns a pointer to a PoissonRate object. The object will have a total of getStimulusWidth()*getStimulusHeight()*getStimulusChannels() entries. The order is columns first (so the first getStimulusWidth() number of pixels will correspond to the top image row). The PoissonRate object can then be applied to a group: PoissonRate* rates = IS.readFrame(50.0f); snn.setSpikeRate(g1, rates); Currently, only grayscale images are supported.
- Parameters
-
[in] | maxPoisson | Maximum Poisson rate (must be positive). The range of grayscale values [0,255] will be linearly mapped to the range of Poisson rates [minPoisson,maxPoisson]. |
[in] | minPoisson | Maximum Poisson rate (must be non-negative). The range of grayscale values [0,255] will be linearly mapped to the range of Poisson rates [minPoisson,maxPoisson]. Default: 0 Hz. |
- Returns
- pointer to a PoissonRate object
- Note
- maxPoisson must be greater than minPoisson. Neither of them can be
- Attention
- Each call to readFrame() will advance the frame index. If you want to access the char array or PoissonRate object of a frame that has already been read, use getCurrentFrameChar() or getCurrentFramePoisson() instead.
Definition at line 233 of file visual_stimulus.cpp.
◆ rewind()
This function rewinds the file pointer back to the beginning of the file, so that the user can re-start reading the stimulus from the top.
Definition at line 236 of file visual_stimulus.cpp.
The documentation for this class was generated from the following files: