A class for to represent a stimulus. More...
#include <Transport/Stimulus2D.H>
Public Member Functions | |
Stimulus2D (OptionManager &mgr, const std::string &descrName="Stimulus2D Stream", const std::string &tagName="Stim2DStream") | |
void | setConfigInfo (const std::string &cfg) |
set the filename and load the data in this case. | |
bool | setFrameNumber (int n) |
set the frame number | |
GenericFrameSpec | peekFrameSpec () |
Return the specifications of the next frame. | |
SimTime | getNaturalFrameTime () const |
Get the natural inter-frame time for this frame source. | |
GenericFrame | readFrame () |
Read a frame from the input source. | |
const SimTime | getTime () const |
get the current time into the stimulus | |
const SimTime | getTotalTime () const |
get the total time of the stimulus | |
const SimTime | getSR () const |
get the stimulus sampling rate | |
const Dims | getDims () const |
get the size of the image the stimulus will be rendered to | |
Image< float > | next (const int radius) |
create and return the next image by drawing a disk, increment counters | |
bool | skipTo (SimTime time) |
skip to this time step |
A class for to represent a stimulus.
Definition at line 48 of file Stimulus2D.H.
Stimulus2D::Stimulus2D | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Stimulus2D Stream" , |
|||
const std::string & | tagName = "Stim2DStream" | |||
) |
Class to read a text file of 2d time varying input
File must have the following format: Sampling rate Image Size X Y VALUE ....repeat for multiple locations X Y VALUE .... The first line is the Sampling period (eg .001s). The second line is the image size (e.g. 640x480) Remaining lines are time steps. The number of columns in each line will be a multiple of three. Each triplit will represent the horizontal (integer), vertical (integer) and intensity (float) of a stimulus. So two triplets, or six columns, would represent 2 stimuli.
Definition at line 73 of file Stimulus2D.C.
const Dims Stimulus2D::getDims | ( | ) | const |
get the size of the image the stimulus will be rendered to
Definition at line 224 of file Stimulus2D.C.
Referenced by peekFrameSpec().
SimTime Stimulus2D::getNaturalFrameTime | ( | ) | const [virtual] |
Get the natural inter-frame time for this frame source.
Reimplemented from FrameIstream.
Definition at line 192 of file Stimulus2D.C.
References getSR().
const SimTime Stimulus2D::getSR | ( | ) | const |
get the stimulus sampling rate
Definition at line 218 of file Stimulus2D.C.
Referenced by getNaturalFrameTime(), and peekFrameSpec().
const SimTime Stimulus2D::getTime | ( | ) | const |
get the current time into the stimulus
Definition at line 204 of file Stimulus2D.C.
const SimTime Stimulus2D::getTotalTime | ( | ) | const |
get the total time of the stimulus
Definition at line 210 of file Stimulus2D.C.
References Image< T >::getDims(), Dims::h(), SimTime::secs(), and SimTime::SECS().
Referenced by skipTo().
Image< float > Stimulus2D::next | ( | const int | radius | ) |
create and return the next image by drawing a disk, increment counters
Definition at line 230 of file Stimulus2D.C.
References drawDisk(), Image< T >::getDims(), Image< T >::getVal(), Image< T >::initialized(), SimTime::secs(), Dims::w(), and ZEROS.
Referenced by readFrame().
GenericFrameSpec Stimulus2D::peekFrameSpec | ( | ) | [virtual] |
Return the specifications of the next frame.
Implements FrameIstream.
Definition at line 170 of file Stimulus2D.C.
References FLOAT_NORM_PRESERVE, getDims(), getSR(), GenericFrame::GRAY_F32, SimTime::hertz(), and Image< T >::initialized().
GenericFrame Stimulus2D::readFrame | ( | ) | [virtual] |
Read a frame from the input source.
Implements FrameIstream.
Definition at line 198 of file Stimulus2D.C.
References FLOAT_NORM_PRESERVE, OModelParam< T >::getVal(), and next().
void Stimulus2D::setConfigInfo | ( | const std::string & | cfg | ) | [virtual] |
set the filename and load the data in this case.
Reimplemented from FrameIstream.
Definition at line 82 of file Stimulus2D.C.
References Dims::h(), SimTime::SECS(), Image< T >::setVal(), split(), Dims::w(), and ZEROS.
bool Stimulus2D::setFrameNumber | ( | int | n | ) | [virtual] |
set the frame number
Reimplemented from FrameIstream.
Definition at line 164 of file Stimulus2D.C.
References SimTime::secs(), SimTime::SECS(), and skipTo().
bool Stimulus2D::skipTo | ( | SimTime | time | ) |
skip to this time step
Definition at line 254 of file Stimulus2D.C.
References getTotalTime().
Referenced by setFrameNumber().