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 NEURO_NEUROSIMEVENTS_H_DEFINED
00039 #define NEURO_NEUROSIMEVENTS_H_DEFINED
00040
00041 #include "Channels/InputFrame.H"
00042 #include "Neuro/WTAwinner.H"
00043 #include "Neuro/SaccadeBodyPart.H"
00044 #include "Neuro/SaccadeController.H"
00045 #include "Simulation/SimEvent.H"
00046 #include "Simulation/SimReq.H"
00047 #include "Util/TransientStatus.H"
00048 #include "Channels/ChannelVisitor.H"
00049
00050 class EyeData;
00051 class ParamMap;
00052 class RawVisualCortex;
00053 class IntegerRawVisualCortex;
00054 class EnvVisualCortex2;
00055 class ChannelMaps;
00056 class VisualCortexEyeMvt;
00057
00058
00059
00060 class SimEventWTAwinner : public SimEvent {
00061 public:
00062
00063 SimEventWTAwinner(SimModule* src, const WTAwinner w, const uint shiftnum);
00064
00065
00066 virtual ~SimEventWTAwinner();
00067
00068
00069
00070 virtual std::string toString() const;
00071
00072
00073 const WTAwinner& winner() const;
00074
00075
00076 uint shiftNum() const;
00077
00078 private:
00079 const WTAwinner itsWinner;
00080 const uint itsShiftNum;
00081 };
00082
00083
00084
00085 class SimEventTargetsHit : public SimEvent {
00086 public:
00087
00088 SimEventTargetsHit(SimModule* src, const int numhit);
00089
00090
00091 virtual ~SimEventTargetsHit();
00092
00093
00094
00095 virtual std::string toString() const;
00096
00097
00098 int numHits() const;
00099
00100 private:
00101 const int itsNumHits;
00102 };
00103
00104
00105
00106 class SimEventRetinaImage : public SimEvent {
00107 public:
00108
00109 SimEventRetinaImage(SimModule* src, const InputFrame& ifr,
00110 const Rectangle& rawinprect,
00111 const Point2D<int> offset);
00112
00113
00114 virtual ~SimEventRetinaImage();
00115
00116
00117 virtual std::string toString() const;
00118
00119
00120 const InputFrame& frame() const;
00121
00122
00123 const Rectangle& rawInputRectangle() const;
00124
00125
00126 virtual Point2D<int> rawToRetinal(const Point2D<int>& rawpos) const;
00127
00128
00129 virtual Point2D<int> retinalToRaw(const Point2D<int>& retpos) const;
00130
00131
00132 virtual Point2D<int> center() const;
00133
00134
00135
00136 const Point2D<int>& offset() const;
00137
00138 private:
00139 const InputFrame itsFrame;
00140 const Rectangle itsRawInputRectangle;
00141 const Point2D<int> itsOffset;
00142 };
00143
00144
00145
00146 class SimEventVisualCortexOutput : public SimEvent {
00147 public:
00148
00149 SimEventVisualCortexOutput(SimModule* src, const Image<float>& vcout);
00150
00151
00152 virtual ~SimEventVisualCortexOutput();
00153
00154
00155 virtual std::string toString() const;
00156
00157
00158
00159
00160
00161 const Image<float> vco(const float factor = 1.0F) const;
00162
00163 private:
00164 const Image<float> itsMap;
00165 };
00166
00167
00168
00169 class SimEventSaliencyMapOutput : public SimEvent {
00170 public:
00171
00172 SimEventSaliencyMapOutput(SimModule* src, const Image<float>& smout);
00173
00174
00175 virtual ~SimEventSaliencyMapOutput();
00176
00177
00178 virtual std::string toString() const;
00179
00180
00181
00182
00183
00184 const Image<float> sm(const float factor = 1.0F) const;
00185
00186 private:
00187 const Image<float> itsMap;
00188 };
00189
00190
00191
00192 class SimEventGistOutput : public SimEvent {
00193 public:
00194
00195 SimEventGistOutput(SimModule* src, const Image<float>& gout);
00196
00197
00198 virtual ~SimEventGistOutput();
00199
00200
00201 virtual std::string toString() const;
00202
00203
00204 const Image<float> gv() const;
00205
00206 private:
00207 const Image<float> itsGistVector;
00208 };
00209
00210
00211
00212 class SimEventTaskRelevanceMapOutput : public SimEvent {
00213 public:
00214
00215 SimEventTaskRelevanceMapOutput(SimModule* src, const Image<float>& smout);
00216
00217
00218 virtual ~SimEventTaskRelevanceMapOutput();
00219
00220
00221 virtual std::string toString() const;
00222
00223
00224
00225
00226
00227 const Image<float> trm(const float factor = 1.0F) const;
00228
00229 private:
00230 const Image<float> itsMap;
00231 };
00232
00233
00234
00235 class SimEventAttentionGuidanceMapOutput : public SimEvent {
00236 public:
00237
00238 SimEventAttentionGuidanceMapOutput(SimModule* src,
00239 const Image<float>& agmout);
00240
00241
00242 virtual ~SimEventAttentionGuidanceMapOutput();
00243
00244
00245 virtual std::string toString() const;
00246
00247
00248
00249
00250
00251 const Image<float> agm(const float factor = 1.0F) const;
00252
00253 private:
00254 const Image<float> itsMap;
00255 };
00256
00257
00258
00259 class SimEventAttentionGateOutput : public SimEvent {
00260 public:
00261
00262 SimEventAttentionGateOutput(SimModule* src,
00263 const Image<float>& agmout,
00264 const Image<float>& lamout,
00265 const Image<float>& camout,
00266 const unsigned int lamframe);
00267
00268
00269 virtual ~SimEventAttentionGateOutput();
00270
00271
00272 virtual std::string toString() const;
00273
00274
00275 const Image<float> ag(const float factor = 1.0F) const;
00276
00277
00278 const Image<float> lam(const float factor = 1.0F) const;
00279
00280
00281 const Image<float> cam(const float factor = 1.0F) const;
00282
00283
00284 const unsigned int lamFrame() const;
00285 private:
00286 const Image<float> itsMap;
00287 const Image<float> itsLastAttMap;
00288 const Image<float> itsCurrAttMap;
00289 const unsigned int itsLastFrame;
00290 };
00291
00292
00293 struct SimEventAttentionGateStageTwoObjects
00294 {
00295 int n;
00296 Image<int> segments;
00297 Image<float> fdistance;
00298 std::vector<int> x;
00299 std::vector<int> y;
00300 std::vector<int> id;
00301 std::vector<float> val;
00302 std::vector<std::vector<float> > features;
00303 };
00304
00305 class SimEventAttentionGateStageTwoSegments : public SimEvent {
00306 public:
00307
00308 SimEventAttentionGateStageTwoSegments(SimModule* src,
00309 const Image<bool>& candidates,
00310 const SimEventAttentionGateStageTwoObjects& obj,
00311 const int segnum);
00312
00313
00314 ~SimEventAttentionGateStageTwoSegments();
00315
00316
00317 const Image<bool> candidates() const;
00318
00319
00320 const SimEventAttentionGateStageTwoObjects obj() const;
00321
00322
00323 const int segnum() const;
00324
00325 private:
00326 const Image<bool> itsCandidates;
00327 const SimEventAttentionGateStageTwoObjects itsObjects;
00328 const int itsSegmentNum;
00329 };
00330
00331
00332
00333 class SimEventShapeEstimatorOutput : public SimEvent {
00334 public:
00335
00336 SimEventShapeEstimatorOutput(SimModule* src,
00337 const Image<float>& winmap,
00338 const Image<byte>& objmask,
00339 const Image<byte>& iormask,
00340 const Image<float>& smoothmask,
00341 const Image<float>& cumsmoothmask,
00342 const std::string& winlabel,
00343 const bool isshaped);
00344
00345
00346 virtual ~SimEventShapeEstimatorOutput();
00347
00348
00349 virtual std::string toString() const;
00350
00351
00352 const Image<float>& winningMap() const;
00353
00354
00355
00356
00357
00358
00359 const Image<byte>& objectMask() const;
00360
00361
00362
00363
00364
00365
00366
00367 const Image<byte>& iorMask() const;
00368
00369
00370
00371
00372
00373 const Image<float>& smoothMask() const;
00374
00375
00376
00377
00378 Image<float> cumSmoothMask() const;
00379
00380
00381 Image<float> negCumSmoothMask() const;
00382
00383
00384 const std::string& winningLabel() const;
00385
00386
00387 uint objectArea() const;
00388
00389
00390
00391
00392
00393
00394
00395 bool isShaped() const;
00396
00397 private:
00398 const Image<float> itsWinningMap;
00399 const Image<byte> itsObjMask;
00400 const Image<byte> itsIORmask;
00401 const Image<float> itsSmoothMask;
00402 const Image<float> itsCumSmoothMask;
00403 const std::string itsWinLabel;
00404 const bool itsIsShaped;
00405 };
00406
00407
00408
00409
00410
00411
00412 class SimEventSaccadeStatus : public SimEvent {
00413 public:
00414
00415 SimEventSaccadeStatus(SimModule* src, const Point2D<int>& pos,
00416 const SaccadeState state,
00417 const SaccadeState prevState,
00418 const bool blinkState,
00419 const bool prevBlinkState);
00420
00421
00422 virtual ~SimEventSaccadeStatus();
00423
00424
00425 virtual std::string toString() const;
00426
00427
00428 const Point2D<int>& position() const;
00429
00430
00431 TransientStatus unknownStatus() const;
00432
00433
00434 TransientStatus fixationStatus() const;
00435
00436
00437 TransientStatus saccadeStatus() const;
00438
00439
00440 TransientStatus blinkStatus() const;
00441
00442
00443 TransientStatus smoothPursuitStatus() const;
00444
00445
00446 virtual SaccadeBodyPart bodyPart() const = 0;
00447
00448 private:
00449 const Point2D<int> itsPosition;
00450 const SaccadeState itsState;
00451 const SaccadeState itsPrevState;
00452 const bool itsBlinkState;
00453 const bool itsPrevBlinkState;
00454 };
00455
00456
00457
00458 class SimEventSaccadeStatusEye : public SimEventSaccadeStatus {
00459 public:
00460
00461 SimEventSaccadeStatusEye(SimModule* src, const Point2D<int>& pos,
00462 const SaccadeState state,
00463 const SaccadeState prevState,
00464 const bool blinkState,
00465 const bool prevBlinkState);
00466
00467
00468 virtual ~SimEventSaccadeStatusEye();
00469
00470
00471 SaccadeBodyPart bodyPart() const;
00472 };
00473
00474
00475
00476 class SimEventSaccadeStatusHead : public SimEventSaccadeStatus {
00477 public:
00478
00479 SimEventSaccadeStatusHead(SimModule* src, const Point2D<int>& pos,
00480 const SaccadeState state,
00481 const SaccadeState prevState,
00482 const bool blinkState,
00483 const bool prevBlinkState);
00484
00485
00486 virtual ~SimEventSaccadeStatusHead();
00487
00488
00489 SaccadeBodyPart bodyPart() const;
00490 };
00491
00492
00493
00494 class SimEventEyeTrackerData : public SimEvent {
00495 public:
00496
00497 SimEventEyeTrackerData(SimModule* src, rutz::shared_ptr<EyeData> d,
00498 const uint trackernum,
00499 const std::string& trackerfname,
00500 const PixRGB<byte>& trackercolor);
00501
00502
00503 virtual ~SimEventEyeTrackerData();
00504
00505
00506 rutz::shared_ptr<EyeData> data() const;
00507
00508
00509 uint trackerNum() const;
00510
00511
00512 std::string trackerFilename() const;
00513
00514
00515 PixRGB<byte> trackerColor() const;
00516
00517 private:
00518 rutz::shared_ptr<EyeData> itsData;
00519 const uint itsTrackerNum;
00520 const std::string itsTrackerFname;
00521 const PixRGB<byte> itsTrackerColor;
00522 };
00523
00524
00525
00526
00527
00528
00529 class SimEventMyCoordinates : public SimEvent {
00530 public:
00531
00532 SimEventMyCoordinates(SimModule* src, const int UTM,
00533 const double heading, const double pitch,
00534 const double range,
00535 const std::vector<std::vector<int> >& local,
00536 const std::vector<double>& gaze,
00537 const std::vector<std::vector<double> >& eye);
00538
00539
00540 virtual ~SimEventMyCoordinates();
00541
00542
00543 int getSignedUTMzone() const;
00544
00545
00546 double getHeading() const;
00547
00548
00549 double getPitch() const;
00550
00551
00552 double getRange() const;
00553
00554
00555
00556
00557 const std::vector<std::vector<int> > getLocalCoords() const;
00558
00559
00560 const std::vector<double> getCenterOfGaze() const;
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570 const std::vector<std::vector<double> > getEye() const;
00571
00572 private:
00573
00574 const int itsSignedUTMzone;
00575
00576 const double itsHeading;
00577
00578 const double itsPitch;
00579
00580 const double itsRange;
00581
00582
00583
00584
00585 const std::vector<std::vector<int> > itsLocalCoords;
00586
00587
00588 const std::vector<double> itsCenterOfGaze;
00589
00590
00591
00592
00593
00594
00595 const std::vector<std::vector<double> > itsEye;
00596 };
00597
00598
00599
00600 class SimEventRetinaCoordMap : public SimEvent {
00601 public:
00602 SimEventRetinaCoordMap(SimModule* src, const Image<PixRGB<float> > loc);
00603
00604 virtual ~SimEventRetinaCoordMap();
00605
00606 Image<PixRGB<float> > getItsLocationMap() const;
00607 private:
00608
00609 const Image<PixRGB<float> > itsLocationMap;
00610 };
00611
00612
00613
00614
00615
00616
00617
00618
00619 class SimEventSaliencyCoordMap : public SimEvent {
00620 public:
00621 SimEventSaliencyCoordMap(SimModule* src,
00622 const Image<PixHyper<float,4> > loc,
00623 const std::vector<int> msc,
00624 const float val);
00625
00626 virtual ~SimEventSaliencyCoordMap();
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638 Image<PixHyper<float,4> > getItsLocationMap() const;
00639
00640
00641
00642
00643
00644 std::vector<int> getMaxSalCurrent() const;
00645
00646
00647 float getMaxSalValue() const;
00648
00649 private:
00650
00651 const Image<PixHyper<float,4> > itsLocationMap;
00652
00653
00654
00655
00656 const std::vector<int> itsMaxSalCurrent;
00657
00658 const float itsMaxSalValue;
00659 };
00660
00661
00662
00663
00664
00665
00666 class SimReqVCXchanVis : public SimReq {
00667 public:
00668
00669 SimReqVCXchanVis(SimModule* src, rutz::shared_ptr<ChannelVisitor> vis);
00670
00671
00672 virtual ~SimReqVCXchanVis();
00673
00674
00675
00676 virtual void preProcessing(RawVisualCortex *vcx);
00677
00678
00679 rutz::shared_ptr<ChannelVisitor> visitor() const;
00680
00681
00682
00683 virtual void postProcessing(RawVisualCortex *vcx);
00684
00685 private:
00686 rutz::shared_ptr<ChannelVisitor> itsVisitor;
00687 };
00688
00689
00690
00691 class SimEventObjectToBias : public SimEvent {
00692 public:
00693 SimEventObjectToBias(SimModule* src, const std::string& objName);
00694
00695 virtual ~SimEventObjectToBias();
00696
00697 const std::string& name() const;
00698
00699 private:
00700 const std::string itsObjName;
00701 };
00702
00703
00704
00705 class SimEventTargetMask : public SimEvent {
00706 public:
00707
00708 SimEventTargetMask(SimModule* src, const Image<byte>& tmask);
00709
00710
00711 virtual ~SimEventTargetMask();
00712
00713
00714 virtual std::string toString() const;
00715
00716
00717 const Image<byte> mask() const;
00718
00719 private:
00720 const Image<byte> itsMask;
00721 };
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732 class SimReqVCXfeatures : public SimReq {
00733 public:
00734
00735 SimReqVCXfeatures(SimModule* src, const Point2D<int>& p);
00736
00737
00738 virtual ~SimReqVCXfeatures();
00739
00740
00741 virtual std::string toString() const;
00742
00743
00744 const Point2D<int>& loc() const;
00745
00746
00747 std::vector<float>& features();
00748
00749 private:
00750 const Point2D<int> itsLoc;
00751 std::vector<float> itsFeatures;
00752 };
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764 class SimReqVCXmaps : public SimReq {
00765 public:
00766
00767 SimReqVCXmaps(SimModule* src);
00768
00769
00770 virtual ~SimReqVCXmaps();
00771
00772
00773 rutz::shared_ptr<ChannelMaps> channelmaps() const;
00774
00775 private:
00776 rutz::shared_ptr<ChannelMaps> itsChannelMaps;
00777
00778 friend class VisualCortexStd;
00779 friend class VisualCortexInt;
00780 friend class VisualCortexEnv;
00781 friend class VisualCortexEyeMvt;
00782 void populateChannelMaps(RawVisualCortex *vcx);
00783 void populateChannelMaps(IntegerRawVisualCortex *vcx);
00784 void populateChannelMaps(EnvVisualCortex2 *vcx);
00785 void populateChannelMaps(VisualCortexEyeMvt *vcx);
00786 };
00787
00788
00789
00790 class SimEventVisualBufferOutput : public SimEvent {
00791 public:
00792
00793 SimEventVisualBufferOutput(SimModule* src, const Image<float>& buf,
00794 const int smlev, const Dims& smdims, const Point2D<int>& retoff);
00795
00796
00797 virtual ~SimEventVisualBufferOutput();
00798
00799
00800 virtual std::string toString() const;
00801
00802
00803 const Image<float>& buffer() const;
00804
00805
00806 Point2D<int> retinalToBuffer(const Point2D<int>& p) const;
00807
00808
00809 Point2D<int> bufferToRetinal(const Point2D<int>& p) const;
00810
00811
00812 const Dims& smdims() const;
00813
00814
00815 int smlev() const;
00816
00817 private:
00818 const Image<float> itsVisualBuffer;
00819 const int itsSMlev;
00820 const Dims itsSMdims;
00821 const Point2D<int> itsRetinaOffset;
00822 };
00823
00824
00825
00826
00827
00828
00829
00830
00831 #endif // NEURO_NEUROSIMEVENTS_H_DEFINED