CARLsim
5.0.0
CARLsim: a GPU-accelerated SNN simulator
|
Class to integrate CARLsim with a stimulus created using VisualStimulus.m Version: 4/11/14 Author: Michael Beyeler mbeye ler@ uci.e duMore...
#include <visual_stimulus.h>
Classes | |
class | Impl |
Public Member Functions | |
VisualStimulus (std::string fileName, bool wrapAroundEOF=true) | |
Default constructor. More... | |
~VisualStimulus () | |
default destructor More... | |
int | getChannels () |
returns the number of channels (1=grayscale, 3=RGB) More... | |
unsigned char * | getCurrentFrameChar () |
returns char array of current frame More... | |
int | getCurrentFrameNumber () |
PoissonRate * | getCurrentFramePoisson () |
returns PoissonRate object of current frame More... | |
int | getHeight () |
returns the stimulus height (number of pixels) More... | |
int | getLength () |
returns the stimulus length (number of frames) More... | |
stimType_t | getType () |
returns the stimulus type (STIM_GRAY, STIM_RGB, etc.) More... | |
int | getWidth () |
returns the stimulus width (number of pixels) More... | |
void | print () |
unsigned char * | readFrameChar () |
Reads the next image frame and returns a pointer to the char array. More... | |
PoissonRate * | readFramePoisson (float maxPoisson, float minPoisson=0.0f) |
Reads the next image frame and returns a pointer to a PoissonRate object. More... | |
void | rewind () |
Rewinds the file pointer to the top. More... | |
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:
* >> VS = VisualStimulus(32,32); * >> VS.addSinGrating * >> VS.saveToFile *Successfully saved stimulus to file "inpGrating_gray_32x32x80.dat"
Definition at line 56 of file visual_stimulus.h.
VisualStimulus | ( | std::string | fileName, |
bool | wrapAroundEOF = true |
||
) |
Instantiates an VisualStimulus object.
[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 | ( | ) |
Definition at line 230 of file visual_stimulus.cpp.
int getChannels | ( | ) |
Definition at line 242 of file visual_stimulus.cpp.
unsigned char * getCurrentFrameChar | ( | ) |
Definition at line 244 of file visual_stimulus.cpp.
int getCurrentFrameNumber | ( | ) |
Definition at line 246 of file visual_stimulus.cpp.
PoissonRate * getCurrentFramePoisson | ( | ) |
Definition at line 245 of file visual_stimulus.cpp.
int getHeight | ( | ) |
Definition at line 240 of file visual_stimulus.cpp.
int getLength | ( | ) |
Definition at line 241 of file visual_stimulus.cpp.
stimType_t getType | ( | ) |
Definition at line 243 of file visual_stimulus.cpp.
int getWidth | ( | ) |
Definition at line 239 of file visual_stimulus.cpp.
void print | ( | ) |
Definition at line 237 of file visual_stimulus.cpp.
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.
Definition at line 232 of file visual_stimulus.cpp.
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.
[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. |
Definition at line 233 of file visual_stimulus.cpp.
void 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.