CARLsim  3.0.3
CARLsim: a GPU-accelerated SNN simulator
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
visual_stimulus.h
Go to the documentation of this file.
1 #ifndef _VISUAL_STIMULUS_H_
2 #define _VISUAL_STIMULUS_H_
3 
4 #include <string>
5 class PoissonRate;
6 
41 public:
42  // +++++ PUBLIC METHODS: CONSTRUCTOR / DESTRUCTOR / MEMBERS +++++++++++++++++++++++++++++++++++++++++++++++++++++ //
43 
53  VisualStimulus(std::string fileName, bool wrapAroundEOF=true);
54 
57 
66 
67 
68  // +++++ PUBLIC METHODS: READING FRAMES +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
69 
82  unsigned char* readFrame();
83 
101  PoissonRate* readFrame(float maxPoisson);
102 
109  void rewind();
110 
111 
112  // +++++ PUBLIC METHODS: GETTERS / SETTERS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
113 
114  int getStimulusWidth() { return stimWidth_; }
115  int getStimulusHeight() { return stimHeight_; }
116  int getStimulusLength() { return stimLength_; }
117  int getStimulusChannels() { return stimChannels_; }
118  stimType_t getStimulusType() { return stimType_; }
119 
120  unsigned char* getCurrentFrameChar() { return stimFrame_; }
121  PoissonRate* getCurrentFramePoisson() { return stimFramePoiss_; }
122  int getCurrentFrameNumber() { return stimFrameNr_; }
123 
124 private:
125  // +++++ PRIVATE METHODS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
126 
127  void readFramePrivate();
128  void readHeader();
129 
130 
131  // +++++ PRIVATE MEMBERS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
132 
133  FILE* fileId_;
134  std::string fileName_;
135  int fileSignature_;
136 
137  long fileHeaderSize_;
138  bool wrapAroundEOF_;
139 
140  unsigned char* stimFrame_;
141  int stimFrameNr_;
142 
143  PoissonRate* stimFramePoiss_;
144 
145  int stimWidth_;
146  int stimHeight_;
147  int stimLength_;
148 
149  int stimChannels_;
150  stimType_t stimType_;
151 };
152 
153 #endif
Class for generating Poisson spike trains.
Definition: poisson_rate.h:84
PoissonRate * getCurrentFramePoisson()
returns PoissonRate object of current frame
VisualStimulus(std::string fileName, bool wrapAroundEOF=true)
Default constructor.
int getStimulusChannels()
returns the number of channels (1=grayscale, 3=RGB)
int getCurrentFrameNumber()
unsigned char * readFrame()
Reads the next image frame and returns a pointer to the char array.
void rewind()
Rewinds the file pointer to the top.
~VisualStimulus()
default destructor
unsigned char * getCurrentFrameChar()
returns char array of current frame
int getStimulusWidth()
returns the stimulus width (number of pixels)
stimType_t
List of stimulus file types.
stimType_t getStimulusType()
returns the stimulus type (STIM_GRAY, STIM_RGB, etc.)
int getStimulusHeight()
returns the stimulus height (number of pixels)
Class to integrate CARLsim with a stimulus created using VisualStimulus.m Version: 4/11/14 Author: Mi...
int getStimulusLength()
returns the stimulus length (number of frames)