This class provides a standard set of visualization tools. More...
#include <Neuro/SimulationViewerStd.H>
Public Member Functions | |
Constructors and destructors | |
SimulationViewerStd (OptionManager &mgr, const std::string &descrName="Simulation Viewer Std", const std::string &tagName="SimulationViewerStd") | |
Constructor. See ModelComponent.H. | |
virtual | ~SimulationViewerStd () |
Destructor. | |
Protected Member Functions | |
SIMCALLBACK_DECLARE (SimulationViewerStd, SimEventSaccadeStatusEye) | |
Callback for when the eye moves. | |
SIMCALLBACK_DECLARE (SimulationViewerStd, SimEventSaccadeStatusHead) | |
Callback for when the head moves. | |
SIMCALLBACK_DECLARE (SimulationViewerStd, SimEventSaveOutput) | |
Callback for every time we should save our outputs. | |
SIMCALLBACK_DECLARE (SimulationViewerStd, SimEventITOutput) | |
Callbacks for when a IT Output is available. | |
virtual void | doEventRetinaImage (SimEventQueue &q, rutz::shared_ptr< SimEventRetinaImage > &e) |
process retinal images | |
virtual void | doEventWTAwinner (SimEventQueue &q, rutz::shared_ptr< SimEventWTAwinner > &e) |
virtual void | start2 () |
Get started: | |
virtual void | reset1 () |
Reset SimulationViewerStd. | |
virtual void | save1 (const ModelComponentSaveInfo &sinfo) |
Save our various results. | |
Image< PixRGB< byte > > | getTraj (SimEventQueue &q) |
Get the attention/eye/head trajectory image. | |
Derived classes should overload those to fit their cosmetic needs | |
void | drawFOA () |
Draw the focus of covert attention. | |
void | linkFOAs () |
Link previous focus of attention to current one. | |
void | drawEye () |
Draw current eye position. | |
void | linkEyes () |
Link previous eye position to current one. | |
void | drawHead () |
Draw current head position. | |
void | linkHeads () |
Link previous head position to current one. | |
void | drawTime (Image< PixRGB< byte > > &image) |
Draw current time onto given image. | |
void | drawHighlights () |
Draw highlights around a given position. | |
Image< PixRGB< byte > > | drawMegaCombo (SimEventQueue &q, const Image< PixRGB< byte > > &in) |
Draw mega combo for X display. | |
Image< PixRGB< byte > > | drawMotionSixPack (const Image< PixRGB< byte > > &in) |
Draw motion sixpack. | |
void | drawMaskOutline (Image< PixRGB< byte > > &traj, const Image< byte > mask, const PixRGB< byte > &col, const int thick, const Point2D< int > &pos, const int radius) |
Draw outline of a mask (used by drawFOA, drawEye, etc). | |
void | getMegaComboMaps (const rutz::shared_ptr< ChannelMaps > &chm, ImageSet< PixRGB< byte > > &cmaps, const uint depth=0) |
recurse to get all maps to display in a megacombo | |
Image< PixRGB< byte > > | prepMapForDisplay (const NamedImage< float > &m) const |
Prepare a map for display. | |
Protected Attributes | |
OModelParam< SimTime > | itsTimeStep |
Simulation time step. | |
OModelParam< LevelSpec > | itsLevelSpec |
the model's LevelSpec | |
nub::ref< SpatialMetrics > | itsMetrics |
metrics that depend on the input size: | |
OModelParam< uint > | itsFontSize |
OModelParam< bool > | itsSaveTraj |
OModelParam< bool > | itsSaveXcombo |
OModelParam< bool > | itsSaveYcombo |
OModelParam< bool > | itsSaveTRMXcombo |
OModelParam< bool > | itsSaveTRMYcombo |
OModelParam< bool > | itsSaveTRMmegaCombo |
OModelParam< bool > | itsWarp3D |
OModelParam< bool > | itsMegaCombo |
OModelParam< uint > | itsMegaComboZoom |
OModelParam< bool > | itsMegaComboTopCMapsOnly |
OModelParam< Dims > | itsCropFOA |
OModelParam< bool > | itsFoveateTraj |
OModelParam< bool > | itsDisplayFOA |
OModelParam< bool > | itsDisplayPatch |
OModelParam< bool > | itsDisplayFOAnum |
OModelParam< bool > | itsDisplayFOALinks |
OModelParam< bool > | itsDisplayEye |
OModelParam< bool > | itsDisplayEyeLinks |
OModelParam< bool > | itsDisplayHead |
OModelParam< bool > | itsDisplayHeadLinks |
OModelParam< bool > | itsDisplayTime |
OModelParam< bool > | itsDisplayAdditive |
OModelParam< bool > | itsDisplayHighlights |
OModelParam< bool > | itsDisplaySMmodulate |
OModelParam< bool > | itsDisplayBoring |
NModelParam< bool > | itsDisplayShapeEstimator |
NModelParam< PixRGB< byte > > | itsColorNormal |
NModelParam< PixRGB< byte > > | itsColorBoring |
subtracted when boring | |
NModelParam< PixRGB< byte > > | itsColorBlink |
NModelParam< PixRGB< byte > > | itsColorSaccade |
NModelParam< PixRGB< byte > > | itsColorSmoothPursuit |
NModelParam< PixRGB< byte > > | itsColorLink |
NModelParam< PixRGB< byte > > | itsColorText |
NModelParam< int > | itsHighlightMax |
NModelParam< float > | itsShapeEstimatorBaseContrast |
NModelParam< int > | itsShapeEstimatorBaseBright |
NModelParam< float > | itsWarp3Dpitch |
NModelParam< float > | itsWarp3Dyaw |
NModelParam< float > | itsWarp3DpitchRate |
NModelParam< float > | itsWarp3DyawRate |
NModelParam< float > | itsWarp3DpitchMax |
NModelParam< float > | itsWarp3DyawMax |
OModelParam< int > | itsHeadRadius |
OModelParam< int > | itsMultiRetinaDepth |
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 | |
NModelParam< int > | itsFOVpsiz |
half-size of (hollow square) FOV patch | |
NModelParam< int > | itsFOVpthick |
line thickness for FOV patch | |
NModelParam< int > | itsFOVthick |
line thickness for FOV outline | |
NModelParam< int > | itsFOVlinkThick |
line thickness for links btw FOVs | |
NModelParam< int > | itsHEDpsiz |
half-size of (hollow-square) head patch | |
NModelParam< int > | itsHEDpthick |
line thickness for head patch | |
NModelParam< int > | itsHEDthick |
line thickness for head outline | |
NModelParam< int > | itsHEDlinkThick |
line thickness for links btw heads | |
OModelParam< bool > | itsUseLargerDrawings |
use larger drawings? | |
OModelParam< bool > | itsObsolete1 |
Friends | |
class | SimulationViewerEyeSim |
This class provides a standard set of visualization tools.
Its typical usage is with a model that generates shifts of attention, eye and head movements. This class will handle visualizing those events. There are three ways of customizing it to your specific needs: 1) by changing the values of some of its internal ModelParam parameters, either via the command-line or via a config file for those that do not have command-line options; 2) by overloading (in a derived class) the low-level drawing functions in the protected section of the class definition; 3) by overloading the trigger functions in the public section of the class definition.
Definition at line 63 of file SimulationViewerStd.H.
SimulationViewerStd::SimulationViewerStd | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Simulation Viewer Std" , |
|||
const std::string & | tagName = "SimulationViewerStd" | |||
) |
Constructor. See ModelComponent.H.
mgr | our ModelManager (see ModelManager.H) | |
descrName | descriptive name for human usage | |
tagName | name for ParamMap usage |
Definition at line 66 of file SimulationViewerStd.C.
References ModelComponent::addSubComponent(), and itsMetrics.
SimulationViewerStd::~SimulationViewerStd | ( | ) | [virtual] |
Destructor.
Definition at line 165 of file SimulationViewerStd.C.
void SimulationViewerStd::doEventRetinaImage | ( | SimEventQueue & | q, | |
rutz::shared_ptr< SimEventRetinaImage > & | e | |||
) | [protected, virtual] |
process retinal images
Reimplemented from SimulationViewerAdapter.
Definition at line 219 of file SimulationViewerStd.C.
References buildPyrGaussian(), Image< T >::getDims(), OModelParam< T >::getVal(), and Image< T >::resize().
void SimulationViewerStd::drawEye | ( | ) | [protected] |
Draw current eye position.
Definition at line 634 of file SimulationViewerStd.C.
References WTAwinner::boring, drawMaskOutline(), drawRect(), Image< T >::getBounds(), Rectangle::getOverlap(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Point2D< T >::i, Point2D< T >::isValid(), itsColorBoring, itsFOVpsiz, itsFOVpthick, itsFOVthick, itsMetrics, and Rectangle::tlbrI().
Referenced by getTraj().
void SimulationViewerStd::drawFOA | ( | ) | [protected] |
Draw the focus of covert attention.
Definition at line 590 of file SimulationViewerStd.C.
References WTAwinner::boring, drawMaskOutline(), drawPatch(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), WTAwinner::isValid(), itsColorBoring, itsFOApsiz, itsFOAthick, itsMetrics, WTAwinner::p, sformat(), SimpleFont::w(), and writeText().
Referenced by getTraj().
void SimulationViewerStd::drawHead | ( | ) | [protected] |
Draw current head position.
Definition at line 675 of file SimulationViewerStd.C.
References WTAwinner::boring, drawMaskOutline(), drawRect(), Image< T >::getBounds(), Rectangle::getOverlap(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Point2D< T >::i, Point2D< T >::isValid(), itsColorBoring, itsHEDpsiz, itsHEDpthick, itsHEDthick, and Rectangle::tlbrI().
Referenced by getTraj().
void SimulationViewerStd::drawHighlights | ( | ) | [protected] |
Draw highlights around a given position.
void SimulationViewerStd::drawMaskOutline | ( | Image< PixRGB< byte > > & | traj, | |
const Image< byte > | mask, | |||
const PixRGB< byte > & | col, | |||
const int | thick, | |||
const Point2D< int > & | pos, | |||
const int | radius | |||
) | [protected] |
Draw outline of a mask (used by drawFOA, drawEye, etc).
if the mask is initialized, revert to drawing a circle centered at "pos" an of radius "radius"
Definition at line 859 of file SimulationViewerStd.C.
References contour2D(), drawDisk(), Image< T >::getVal(), Point2D< T >::i, and inplaceLowThresh().
Referenced by drawEye(), drawFOA(), and drawHead().
Image< PixRGB< byte > > SimulationViewerStd::drawMegaCombo | ( | SimEventQueue & | q, | |
const Image< PixRGB< byte > > & | in | |||
) | [protected] |
Draw mega combo for X display.
Definition at line 722 of file SimulationViewerStd.C.
References SimEventQueue::check(), Image< T >::clear(), composite(), drawRect(), SimpleFont::FIXED(), Image< T >::getDims(), SimulationViewer::getMap(), getMegaComboMaps(), getMinMax(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), inplaceClamp(), inplaceNormalize(), SimulationViewerAdapter::inverseMap(), SimulationViewer::itsDisplayInterp, SimulationViewer::itsMapFactor, SimulationViewer::itsMapType, makeRGB(), SimEventQueue::request(), Image< T >::resize(), SEQ_ANY, sformat(), ImageSet< T >::size(), and writeText().
Referenced by getTraj().
Image< PixRGB<byte> > SimulationViewerStd::drawMotionSixPack | ( | const Image< PixRGB< byte > > & | in | ) | [protected] |
Draw motion sixpack.
Draw current time onto given image.
Definition at line 714 of file SimulationViewerStd.C.
References image, SimTime::msecs(), sformat(), and writeText().
Referenced by getTraj().
void SimulationViewerStd::getMegaComboMaps | ( | const rutz::shared_ptr< ChannelMaps > & | chm, | |
ImageSet< PixRGB< byte > > & | cmaps, | |||
const uint | depth = 0 | |||
) | [protected] |
recurse to get all maps to display in a megacombo
Definition at line 810 of file SimulationViewerStd.C.
References OModelParam< T >::getVal(), Image< T >::initialized(), SimulationViewerAdapter::inverseMap(), prepMapForDisplay(), and Image< T >::resize().
Referenced by drawMegaCombo().
Image< PixRGB< byte > > SimulationViewerStd::getTraj | ( | SimEventQueue & | q | ) | [protected] |
Get the attention/eye/head trajectory image.
Definition at line 375 of file SimulationViewerStd.C.
References SimEventQueue::check(), colColCombo(), colGreyCombo(), composite(), SimTime::computeDeltaT(), contrastModulate(), drawEye(), drawFOA(), drawHead(), drawMegaCombo(), drawRect(), drawTime(), foveate(), Image< T >::getDims(), Image< T >::getHeight(), SimulationViewer::getMap(), getMinMax(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Image< T >::getWidth(), Dims::h(), highlightRegions(), Point2D< T >::i, Image< T >::initialized(), SimulationViewerAdapter::inverseMap(), Dims::isNonEmpty(), SimulationViewer::itsDisplayInterp, itsTimeStep, SimEventQueue::now(), WTAwinner::p, Image< T >::resize(), SimTime::secs(), SEQ_ANY, NModelParam< T >::setVal(), Rectangle::tlbrI(), toRGB(), Dims::w(), and warp3Dmap().
Referenced by save1().
void SimulationViewerStd::linkEyes | ( | ) | [protected] |
Link previous eye position to current one.
Definition at line 662 of file SimulationViewerStd.C.
References NModelParam< T >::getVal(), Point2D< T >::isValid(), and itsFOVlinkThick.
void SimulationViewerStd::linkFOAs | ( | ) | [protected] |
Link previous focus of attention to current one.
Definition at line 620 of file SimulationViewerStd.C.
References Point2D< T >::distance(), drawArrow(), NModelParam< T >::getVal(), WTAwinner::isValid(), itsFOAlinkThick, and WTAwinner::p.
void SimulationViewerStd::linkHeads | ( | ) | [protected] |
Link previous head position to current one.
Definition at line 701 of file SimulationViewerStd.C.
References NModelParam< T >::getVal(), Point2D< T >::isValid(), and itsHEDlinkThick.
Image< PixRGB< byte > > SimulationViewerStd::prepMapForDisplay | ( | const NamedImage< float > & | m | ) | const [protected] |
Prepare a map for display.
Definition at line 829 of file SimulationViewerStd.C.
References drawRect(), SimpleFont::FIXED(), Image< T >::getDims(), Image< T >::getHeight(), getMinMax(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Image< T >::getWidth(), SimpleFont::h(), inplaceNormalize(), SimulationViewer::itsDisplayInterp, NamedImage< T >::name(), sformat(), split(), and writeText().
Referenced by getMegaComboMaps().
void SimulationViewerStd::reset1 | ( | ) | [protected, virtual] |
Reset SimulationViewerStd.
See the base function in ModelComponent.H for info.
Reimplemented from SimulationViewerAdapter.
Definition at line 169 of file SimulationViewerStd.C.
References Image< T >::freeMem(), ImageSet< T >::reset(), and SimTime::ZERO().
void SimulationViewerStd::save1 | ( | const ModelComponentSaveInfo & | sinfo | ) | [protected, virtual] |
Save our various results.
Reimplemented from ModelComponent.
Definition at line 565 of file SimulationViewerStd.C.
References getTraj(), OModelParam< T >::getVal(), and SRC_POS.
SimulationViewerStd::SIMCALLBACK_DECLARE | ( | SimulationViewerStd | , | |
SimEventITOutput | ||||
) | [protected] |
Callbacks for when a IT Output is available.
SimulationViewerStd::SIMCALLBACK_DECLARE | ( | SimulationViewerStd | , | |
SimEventSaveOutput | ||||
) | [protected] |
Callback for every time we should save our outputs.
SimulationViewerStd::SIMCALLBACK_DECLARE | ( | SimulationViewerStd | , | |
SimEventSaccadeStatusHead | ||||
) | [protected] |
Callback for when the head moves.
SimulationViewerStd::SIMCALLBACK_DECLARE | ( | SimulationViewerStd | , | |
SimEventSaccadeStatusEye | ||||
) | [protected] |
Callback for when the eye moves.
void SimulationViewerStd::start2 | ( | ) | [protected, virtual] |
Get started:
Reimplemented from ModelComponent.
Definition at line 202 of file SimulationViewerStd.C.
References SimpleFont::fixedMaxWidth(), OModelParam< T >::getVal(), itsFOApsiz, itsFOVpsiz, itsFOVpthick, itsHEDpsiz, itsHEDpthick, itsUseLargerDrawings, and NModelParam< T >::setVal().
NModelParam< PixRGB<byte> > SimulationViewerStd::itsColorBoring [protected] |
subtracted when boring
Definition at line 136 of file SimulationViewerStd.H.
Referenced by drawEye(), drawFOA(), and drawHead().
NModelParam<int> SimulationViewerStd::itsFOAlinkThick [protected] |
line thickness for links bewteen FOAs
Definition at line 162 of file SimulationViewerStd.H.
Referenced by linkFOAs().
NModelParam<int> SimulationViewerStd::itsFOApsiz [protected] |
half-size of (filled square) FOA patch
Definition at line 160 of file SimulationViewerStd.H.
NModelParam<int> SimulationViewerStd::itsFOAthick [protected] |
line thickness for FOA outline
Definition at line 161 of file SimulationViewerStd.H.
Referenced by drawFOA().
NModelParam<int> SimulationViewerStd::itsFOVlinkThick [protected] |
line thickness for links btw FOVs
Definition at line 166 of file SimulationViewerStd.H.
Referenced by linkEyes().
NModelParam<int> SimulationViewerStd::itsFOVpsiz [protected] |
half-size of (hollow square) FOV patch
Definition at line 163 of file SimulationViewerStd.H.
NModelParam<int> SimulationViewerStd::itsFOVpthick [protected] |
line thickness for FOV patch
Definition at line 164 of file SimulationViewerStd.H.
NModelParam<int> SimulationViewerStd::itsFOVthick [protected] |
line thickness for FOV outline
Definition at line 165 of file SimulationViewerStd.H.
Referenced by drawEye().
NModelParam<int> SimulationViewerStd::itsHEDlinkThick [protected] |
line thickness for links btw heads
Definition at line 170 of file SimulationViewerStd.H.
Referenced by linkHeads().
NModelParam<int> SimulationViewerStd::itsHEDpsiz [protected] |
half-size of (hollow-square) head patch
Definition at line 167 of file SimulationViewerStd.H.
Referenced by drawHead(), and start2().
NModelParam<int> SimulationViewerStd::itsHEDpthick [protected] |
line thickness for head patch
Definition at line 168 of file SimulationViewerStd.H.
Referenced by drawHead(), and start2().
NModelParam<int> SimulationViewerStd::itsHEDthick [protected] |
line thickness for head outline
Definition at line 169 of file SimulationViewerStd.H.
Referenced by drawHead().
OModelParam<LevelSpec> SimulationViewerStd::itsLevelSpec [protected] |
the model's LevelSpec
Definition at line 98 of file SimulationViewerStd.H.
nub::ref<SpatialMetrics> SimulationViewerStd::itsMetrics [protected] |
metrics that depend on the input size:
Definition at line 101 of file SimulationViewerStd.H.
Referenced by drawEye(), drawFOA(), and SimulationViewerStd().
OModelParam<SimTime> SimulationViewerStd::itsTimeStep [protected] |
OModelParam<bool> SimulationViewerStd::itsUseLargerDrawings [protected] |