SimulationViewerEyeMvt.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef SIMULATIONVIEWEREYEMVT_H_DEFINED
00040 #define SIMULATIONVIEWEREYEMVT_H_DEFINED
00041
00042 #include "Component/ModelParam.H"
00043 #include "Image/ImageCache.H"
00044 #include "Image/ImageSet.H"
00045 #include "Image/LevelSpec.H"
00046 #include "Neuro/SimulationViewer.H"
00047 #include "Simulation/SimEvents.H"
00048
00049 #include <map>
00050 #include<vector>
00051
00052 class EyeData;
00053 class SpatialMetrics;
00054 class ofstream;
00055 class SimTime;
00056
00057 typedef Point2D<int> (*Point2DTransform)(Point2D<int> P);
00058
00059
00060 class SimulationViewerEyeMvt : public SimulationViewer {
00061 public:
00062
00063
00064
00065
00066
00067 SimulationViewerEyeMvt(OptionManager& mgr,
00068 const std::string& descrName =
00069 "EyeMvt Simulation Viewer",
00070 const std::string& tagName =
00071 "SimulationViewerEyeMvt");
00072
00073
00074 virtual ~SimulationViewerEyeMvt();
00075
00076
00077
00078 protected:
00079
00080 SIMCALLBACK_DECLARE(SimulationViewerEyeMvt, SimEventClockTick);
00081
00082
00083 SIMCALLBACK_DECLARE(SimulationViewerEyeMvt, SimEventSaveOutput);
00084
00085
00086 void save1(const ModelComponentSaveInfo& sinfo);
00087
00088
00089 virtual Image< PixRGB<byte> > getTraj(SimEventQueue& q);
00090
00091 nub::ref<SpatialMetrics> itsMetrics;
00092
00093 OModelParam<bool> itsSaveTraj;
00094 OModelParam<bool> itsSaveMegaCombo;
00095 OModelParam<int> itsDelayCacheSize;
00096 OModelParam<int> itsMaxCacheSize;
00097 OModelParam<bool> itsSampleAtStart;
00098 OModelParam<bool> itsDisplaySacNum;
00099 OModelParam<bool> itsDisplayPatch;
00100 OModelParam<int> itsPatchSize;
00101 OModelParam<bool> itsEraseMarker;
00102 OModelParam<bool> itsDisplayFOA;
00103 OModelParam<LevelSpec> itsLevelSpec;
00104 OModelParam<std::string> itsOutFname;
00105 OModelParam<std::string> itsPriorRandomDistro;
00106 OModelParam<bool> itsUseSaccadeInBlink;
00107 OModelParam<bool> itsUseDiagColor;
00108 OModelParam<bool> itsLabelEyePatch;
00109 OModelParam<bool> itsWriteFrameNum;
00110 OModelParam<int> itsNumRandomSamples;
00111 OModelParam<int> itsMaxComboWidth;
00112 OModelParam<uint> itsSMhistoryQlen;
00113
00114 virtual void start1();
00115 virtual void stop1();
00116
00117 virtual void drawEye(const rutz::shared_ptr<EyeData> data, const uint trackerNum);
00118 virtual void drawFOA(const Point2D<int> target, const uint trackerNum);
00119
00120
00121 virtual std::string craftSVEMOutput(const std::string TrackerNum,
00122 const rutz::shared_ptr<EyeData> data);
00123
00124
00125 virtual void extraSampleProcessing(const rutz::shared_ptr<EyeData>);
00126
00127
00128 std::string craftModelFreeOutput(const rutz::shared_ptr<EyeData> data);
00129 std::string craftSMSamples(const rutz::shared_ptr<EyeData> data, Image<float> smap);
00130 std::string craftSMHistory(const rutz::shared_ptr<EyeData> data, Image<float> smap);
00131 void writeHeader();
00132
00133
00134 ImageCacheMinMax<float> itsDelayCache;
00135 ImageCacheMinMax<float> itsMaxCache;
00136
00137
00138 Image<float> itsHeadSM;
00139
00140 Image< PixRGB<byte> > itsDrawings;
00141
00142
00143
00144 SimTime itsCurrTime;
00145 uint itsFrameNumber;
00146
00147 bool itsHeaderCrafted;
00148 std::vector<std::string> itsOutFields;
00149
00150
00151
00152 Point2D<int> rawToRet(Point2D<int> P) const {return P+itsRawToRetOffset;}
00153
00154 struct GEyeFormat {
00155 PixRGB<byte> col;
00156 std::string label;
00157 int pSize;
00158
00159 };
00160
00161 std::vector<GEyeFormat> itsEyeStyles;
00162 private:
00163 std::map<int, rutz::shared_ptr<EyeData> > itsTargets;
00164 std::vector<Point2D<int> > randPoints;
00165 ImageCache<float> itsSMhistory;
00166
00167 std::ofstream *itsOutFile;
00168 std::ifstream *itsRandFile;
00169 Point2D<int> itsRawToRetOffset;
00170 };
00171
00172 #endif
00173
00174
00175
00176
00177
00178