SimulationViewerEyeHand.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 #ifndef SIMULATIONVIEWEREYEHAND_H_DEFINED
00039 #define SIMULATIONVIEWEREYEHAND_H_DEFINED
00040
00041 #include "Component/ModelParam.H"
00042 #include "Image/ImageCache.H"
00043 #include "Image/ImageSet.H"
00044 #include "Image/LevelSpec.H"
00045 #include "Neuro/SimulationViewer.H"
00046 #include "Simulation/SimEvents.H"
00047
00048 #include <map>
00049 #include<vector>
00050
00051 class EyeData;
00052 class HandData;
00053 class SpatialMetrics;
00054 class ofstream;
00055 class SimTime;
00056
00057 typedef Point2D<int> (*Point2DTransform)(Point2D<int> P);
00058
00059
00060 class SimulationViewerEyeHand : public SimulationViewer {
00061 public:
00062
00063
00064
00065
00066
00067 SimulationViewerEyeHand(OptionManager& mgr,
00068 const std::string& descrName =
00069 "EyeHand Simulation Viewer",
00070 const std::string& tagName =
00071 "SimulationViewerEyeHand");
00072
00073
00074 virtual ~SimulationViewerEyeHand();
00075
00076
00077
00078 protected:
00079
00080 SIMCALLBACK_DECLARE(SimulationViewerEyeHand, SimEventClockTick);
00081
00082
00083 SIMCALLBACK_DECLARE(SimulationViewerEyeHand, 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
00094 OModelParam<bool> itsSaveTraj;
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<int> itsNumRandomSamples;
00110 OModelParam<int> itsMaxComboWidth;
00111 OModelParam<uint> itsSMhistoryQlen;
00112
00113 OModelParam<bool> itsDisplayHand;
00114 OModelParam<bool> itsSaveCombo;
00115
00116 virtual void start1();
00117 virtual void stop1();
00118
00119 virtual void drawEye(const rutz::shared_ptr<EyeData> data,
00120 const uint trackerNum);
00121 virtual void drawHand(const rutz::shared_ptr<HandData> data,
00122 const uint trackerNum);
00123 virtual void drawFOA(const Point2D<int> target,
00124 const uint trackerNum);
00125
00126
00127 virtual std::string craftSVEMOutput(const std::string TrackerNum,
00128 const rutz::shared_ptr<EyeData> data);
00129
00130
00131 virtual void extraSampleProcessing(const rutz::shared_ptr<EyeData>);
00132 virtual void extraSampleProcessing(const rutz::shared_ptr<HandData>);
00133
00134
00135 std::string craftModelFreeOutput(const rutz::shared_ptr<EyeData> data);
00136 std::string craftSMSamples(const rutz::shared_ptr<EyeData> data,
00137 Image<float> smap);
00138 std::string craftSMHistory(const rutz::shared_ptr<EyeData> data,
00139 Image<float> smap);
00140 void writeHeader();
00141
00142
00143 ImageCacheMinMax<float> itsDelayCache;
00144 ImageCacheMinMax<float> itsMaxCache;
00145
00146
00147 Image<float> itsHeadSM;
00148
00149 Image< PixRGB<byte> > itsDrawings;
00150
00151
00152
00153 SimTime itsCurrTime;
00154 uint itsFrameNumber;
00155
00156 bool itsHeaderCrafted;
00157 std::vector<std::string> itsOutFields;
00158
00159
00160
00161 Point2D<int> rawToRet(Point2D<int> P) const {return P+itsRawToRetOffset;}
00162
00163
00164 struct GEyeFormat {
00165 PixRGB<byte> col;
00166 std::string label;
00167 int pSize;
00168
00169 };
00170 std::vector<GEyeFormat> itsEyeStyles;
00171
00172
00173 struct GHandFormat {
00174 PixRGB<byte> col;
00175 std::string label;
00176 int pSize;
00177
00178 };
00179 std::vector<GHandFormat> itsHandStyles;
00180
00181 private:
00182
00183 inline Dims getGridCoord(Dims src, int W_, int H_) {
00184 Dims dst (src.w() * W_, src.h() * H_);
00185 return dst;
00186 };
00187
00188 std::map<int, rutz::shared_ptr<EyeData> > itsEyeTargets;
00189 std::map<int, rutz::shared_ptr<HandData> > itsHandTargets;
00190 std::vector<Point2D<int> > randPoints;
00191 ImageCache<float> itsSMhistory;
00192
00193 std::ofstream *itsOutFile;
00194 std::ifstream *itsRandFile;
00195 Point2D<int> itsRawToRetOffset;
00196 };
00197
00198 #endif
00199
00200
00201
00202
00203
00204