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