This class provides interface with vision and NerdCam. More...
#include <Neuro/SimulationViewerNerdCam.H>
Public Member Functions | |
Constructors and destructors | |
SimulationViewerNerdCam (OptionManager &mgr, const std::string &descrName="NerdCam Interface", const std::string &tagName="NerdCam") | |
Constructor. See ModelComponent.H. | |
virtual | ~SimulationViewerNerdCam () |
Destructor. | |
virtual void | reset1 () |
Reset SimulationViewerNerdCam. | |
void | init (const ushort baseSizeX, const ushort baseSizeY) |
basic init method | |
Protected Member Functions | |
SIMCALLBACK_DECLARE (SimulationViewerNerdCam, SimEventInputFrame) | |
Callback for when a new input image is available. | |
SIMCALLBACK_DECLARE (SimulationViewerNerdCam, SimEventClockTick) | |
Callback for every clock tick. | |
SIMCALLBACK_DECLARE (SimulationViewerNerdCam, SimEventWTAwinner) | |
Callback for when a new attention shift occurs. | |
SIMCALLBACK_DECLARE (SimulationViewerNerdCam, SimEventSaveOutput) | |
Callback for every time we should save our outputs. | |
virtual void | save1 (const ModelComponentSaveInfo &sinfo) |
Save our various results. | |
Image< PixRGB< byte > > | getTraj (SimEventQueue &q) |
Get the attention/eye/head trajectory image. | |
void | saveResults (const nub::ref< FrameOstream > &ofs, SimEventQueue &q) |
Called by saveOutput(). | |
virtual void | start2 () |
Get started: | |
void | writeStatusPage () const |
write a basic status page out | |
void | writeChannelPage () const |
write a basic status page out | |
void | drawTime (Image< PixRGB< byte > > &image) const |
Draw current time onto given image. | |
void | lockFile (const std::string fileName, int &fd, struct flock &fl) const |
apply an advisory lock on a file | |
void | unlockFile (const std::string fileName, const int fd, struct flock &fl) const |
remove an advisory lock on a file | |
void | nlog (const std::string logData) const |
log data to standard log file | |
void | drawDateTime (Image< PixRGB< byte > > &image) const |
Draw the date and time onto an image. | |
void | drawFOA () |
Draw the focus of covert attention. | |
void | linkFOAs () |
Link previous focus of attention to current one. | |
Image< PixRGB< byte > > | drawMegaCombo (SimEventQueue &q) const |
draw the mega combo | |
void | drawMaskOutline (Image< PixRGB< byte > > &traj, const Image< byte > mask, const PixRGB< byte > &col, const int thick, const Point2D< int > &pos, const int radius) const |
Draw outline of a mask (used by drawFOA). | |
Protected Attributes | |
nub::ref< SpatialMetrics > | itsMetrics |
metrics that depend on the input size: | |
NModelParam< PixRGB< byte > > | itsColorBoring |
drawing color selection parameter | |
NModelParam< PixRGB< byte > > | itsColorLink |
drawing color selection parameter | |
NModelParam< PixRGB< byte > > | itsColorNormal |
drawing color selection parameter | |
OModelParam< std::string > | itsConfigFile |
config file to open | |
OModelParam< Dims > | itsCropFOA |
OModelParam< bool > | itsDisplayAdditive |
OModelParam< bool > | itsDisplayBoring |
OModelParam< bool > | itsDisplayFOA |
OModelParam< bool > | itsDisplayFOALinks |
OModelParam< bool > | itsDisplayHighlights |
OModelParam< bool > | itsDisplayPatch |
OModelParam< bool > | itsDisplaySMmodulate |
OModelParam< bool > | itsDisplayTime |
NModelParam< int > | itsFOApsiz |
half-size of (filled square) FOA patch | |
NModelParam< int > | itsFOAthick |
line thickness for FOA outline | |
NModelParam< int > | itsFOAlinkThick |
line thickness for links bewteen FOAs | |
OModelParam< bool > | itsMegaCombo |
NModelParam< float > | itsWarp3Dpitch |
NModelParam< float > | itsWarp3Dyaw |
NModelParam< float > | itsWarp3DpitchRate |
NModelParam< float > | itsWarp3DyawRate |
NModelParam< float > | itsWarp3DpitchMax |
NModelParam< float > | itsWarp3DyawMax |
OModelParam< bool > | itsUseLargerDrawings |
use larger drawings? |
This class provides interface with vision and NerdCam.
This simulation viewer is designed to take brain and VisualCortex information and process it for use with the nerd cam web page. For instance we can control file locking, motion noticing and file saving. We use a SimulationViewer to standardize its workings with ezvision.
Definition at line 74 of file SimulationViewerNerdCam.H.
SimulationViewerNerdCam::SimulationViewerNerdCam | ( | OptionManager & | mgr, | |
const std::string & | descrName = "NerdCam Interface" , |
|||
const std::string & | tagName = "NerdCam" | |||
) |
Constructor. See ModelComponent.H.
mgr | our ModelManager (see ModelManager.H) | |
descrName | descriptive name for human usage | |
tagName | name for ParamMap usage |
Definition at line 74 of file SimulationViewerNerdCam.C.
References ModelComponent::addSubComponent(), itsMetrics, and nlog().
SimulationViewerNerdCam::~SimulationViewerNerdCam | ( | ) | [virtual] |
Draw the date and time onto an image.
Definition at line 957 of file SimulationViewerNerdCam.C.
References image, and writeText().
void SimulationViewerNerdCam::drawFOA | ( | ) | [protected] |
Draw the focus of covert attention.
Definition at line 966 of file SimulationViewerNerdCam.C.
References WTAwinner::boring, drawMaskOutline(), drawPatch(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), WTAwinner::isValid(), itsColorBoring, itsColorNormal, itsFOApsiz, itsFOAthick, itsMetrics, and WTAwinner::p.
Referenced by getTraj().
void SimulationViewerNerdCam::drawMaskOutline | ( | Image< PixRGB< byte > > & | traj, | |
const Image< byte > | mask, | |||
const PixRGB< byte > & | col, | |||
const int | thick, | |||
const Point2D< int > & | pos, | |||
const int | radius | |||
) | const [protected] |
Draw outline of a mask (used by drawFOA).
Definition at line 1133 of file SimulationViewerNerdCam.C.
References contour2D(), drawDisk(), Image< T >::getVal(), Point2D< T >::i, and inplaceLowThresh().
Referenced by drawFOA().
Image< PixRGB< byte > > SimulationViewerNerdCam::drawMegaCombo | ( | SimEventQueue & | q | ) | const [protected] |
draw the mega combo
Definition at line 999 of file SimulationViewerNerdCam.C.
References SimEventQueue::check(), Image< T >::getHeight(), SimulationViewer::getMap(), Image< T >::getWidth(), inplaceClamp(), inplaceEmbed(), inplacePaste(), makeRGB(), NO_INIT, rescale(), Image< T >::resize(), SEQ_ANY, Rectangle::tlbrI(), writeText(), and ZEROS.
Referenced by saveResults().
Draw current time onto given image.
Definition at line 884 of file SimulationViewerNerdCam.C.
References image, SimTime::msecs(), and writeText().
Referenced by getTraj().
Image< PixRGB< byte > > SimulationViewerNerdCam::getTraj | ( | SimEventQueue & | q | ) | [protected] |
Get the attention/eye/head trajectory image.
Definition at line 295 of file SimulationViewerNerdCam.C.
References drawFOA(), drawTime(), OModelParam< T >::getVal(), Dims::h(), Point2D< T >::i, Image< T >::initialized(), Dims::isNonEmpty(), SimEventQueue::now(), WTAwinner::p, Rectangle::tlbrI(), and Dims::w().
Referenced by saveResults().
basic init method
Definition at line 130 of file SimulationViewerNerdCam.C.
References configFile, readConfig::getItemValueF(), readConfig::getItemValueS(), OModelParam< T >::getVal(), itsConfigFile, nlog(), and readConfig::openFile().
void SimulationViewerNerdCam::linkFOAs | ( | ) | [protected] |
Link previous focus of attention to current one.
Definition at line 984 of file SimulationViewerNerdCam.C.
References Point2D< T >::distance(), drawArrow(), NModelParam< T >::getVal(), WTAwinner::isValid(), itsColorLink, itsFOAlinkThick, and WTAwinner::p.
void SimulationViewerNerdCam::lockFile | ( | const std::string | fileName, | |
int & | fd, | |||
struct flock & | fl | |||
) | const [protected] |
apply an advisory lock on a file
Definition at line 891 of file SimulationViewerNerdCam.C.
Referenced by nlog(), saveResults(), writeChannelPage(), and writeStatusPage().
void SimulationViewerNerdCam::nlog | ( | const std::string | logData | ) | const [protected] |
log data to standard log file
Definition at line 941 of file SimulationViewerNerdCam.C.
References lockFile(), and unlockFile().
Referenced by init(), reset1(), saveResults(), SimulationViewerNerdCam(), and ~SimulationViewerNerdCam().
void SimulationViewerNerdCam::reset1 | ( | ) | [virtual] |
Reset SimulationViewerNerdCam.
See the base function in ModelComponent.H for info.
Reimplemented from ModelComponent.
Definition at line 174 of file SimulationViewerNerdCam.C.
References Image< T >::freeMem(), nlog(), ImageSet< T >::reset(), and SimTime::ZERO().
void SimulationViewerNerdCam::save1 | ( | const ModelComponentSaveInfo & | sinfo | ) | [protected, virtual] |
Save our various results.
Reimplemented from ModelComponent.
Definition at line 477 of file SimulationViewerNerdCam.C.
References saveResults().
void SimulationViewerNerdCam::saveResults | ( | const nub::ref< FrameOstream > & | ofs, | |
SimEventQueue & | q | |||
) | [protected] |
Called by saveOutput().
Definition at line 342 of file SimulationViewerNerdCam.C.
References drawMegaCombo(), drawRect(), Image< T >::getHeight(), SimulationViewer::getMap(), getMinMaxAvg(), getTraj(), NModelParam< T >::getVal(), Image< T >::getWidth(), Image< T >::initialized(), itsColorNormal, lockFile(), max(), min(), SimTime::msecs(), nlog(), rescale(), Rectangle::tlbrI(), unlockFile(), warp3Dmap(), writeChannelPage(), Raster::WriteRGB(), and writeStatusPage().
Referenced by save1().
SimulationViewerNerdCam::SIMCALLBACK_DECLARE | ( | SimulationViewerNerdCam | , | |
SimEventSaveOutput | ||||
) | [protected] |
Callback for every time we should save our outputs.
SimulationViewerNerdCam::SIMCALLBACK_DECLARE | ( | SimulationViewerNerdCam | , | |
SimEventWTAwinner | ||||
) | [protected] |
Callback for when a new attention shift occurs.
SimulationViewerNerdCam::SIMCALLBACK_DECLARE | ( | SimulationViewerNerdCam | , | |
SimEventClockTick | ||||
) | [protected] |
Callback for every clock tick.
Note: this is only being used by warp3d right now and should go away.
SimulationViewerNerdCam::SIMCALLBACK_DECLARE | ( | SimulationViewerNerdCam | , | |
SimEventInputFrame | ||||
) | [protected] |
Callback for when a new input image is available.
void SimulationViewerNerdCam::start2 | ( | ) | [protected, virtual] |
Get started:
Reimplemented from ModelComponent.
Definition at line 193 of file SimulationViewerNerdCam.C.
References OModelParam< T >::getVal(), itsFOApsiz, itsUseLargerDrawings, and NModelParam< T >::setVal().
void SimulationViewerNerdCam::unlockFile | ( | const std::string | fileName, | |
const int | fd, | |||
struct flock & | fl | |||
) | const [protected] |
remove an advisory lock on a file
Definition at line 924 of file SimulationViewerNerdCam.C.
Referenced by nlog(), saveResults(), writeChannelPage(), and writeStatusPage().
void SimulationViewerNerdCam::writeChannelPage | ( | ) | const [protected] |
write a basic status page out
Definition at line 613 of file SimulationViewerNerdCam.C.
References in, lockFile(), and unlockFile().
Referenced by saveResults().
void SimulationViewerNerdCam::writeStatusPage | ( | ) | const [protected] |
write a basic status page out
Definition at line 491 of file SimulationViewerNerdCam.C.
References findMax(), findMin(), findPeaks(), getMinMaxAvg(), Image< T >::getWidth(), Point2D< T >::i, in, lockFile(), stdev(), and unlockFile().
Referenced by saveResults().
NModelParam< PixRGB<byte> > SimulationViewerNerdCam::itsColorBoring [protected] |
drawing color selection parameter
Definition at line 157 of file SimulationViewerNerdCam.H.
Referenced by drawFOA().
NModelParam< PixRGB<byte> > SimulationViewerNerdCam::itsColorLink [protected] |
drawing color selection parameter
Definition at line 159 of file SimulationViewerNerdCam.H.
Referenced by linkFOAs().
NModelParam< PixRGB<byte> > SimulationViewerNerdCam::itsColorNormal [protected] |
drawing color selection parameter
Definition at line 161 of file SimulationViewerNerdCam.H.
Referenced by drawFOA(), and saveResults().
OModelParam<std::string> SimulationViewerNerdCam::itsConfigFile [protected] |
NModelParam<int> SimulationViewerNerdCam::itsFOAlinkThick [protected] |
line thickness for links bewteen FOAs
Definition at line 181 of file SimulationViewerNerdCam.H.
Referenced by linkFOAs().
NModelParam<int> SimulationViewerNerdCam::itsFOApsiz [protected] |
half-size of (filled square) FOA patch
Definition at line 177 of file SimulationViewerNerdCam.H.
NModelParam<int> SimulationViewerNerdCam::itsFOAthick [protected] |
line thickness for FOA outline
Definition at line 179 of file SimulationViewerNerdCam.H.
Referenced by drawFOA().
nub::ref<SpatialMetrics> SimulationViewerNerdCam::itsMetrics [protected] |
metrics that depend on the input size:
Definition at line 154 of file SimulationViewerNerdCam.H.
Referenced by drawFOA(), and SimulationViewerNerdCam().
OModelParam<bool> SimulationViewerNerdCam::itsUseLargerDrawings [protected] |
use larger drawings?
Definition at line 190 of file SimulationViewerNerdCam.H.
Referenced by start2().