MediaSimEvents.H

Go to the documentation of this file.
00001 /*!@file Media/MediaSimEvents.H SimEvent derivatives for media modules */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Media/MediaSimEvents.H $
00035 // $Id: MediaSimEvents.H 14286 2010-12-01 17:46:34Z sophie $
00036 //
00037 
00038 #ifndef MEDIA_MEDIASIMEVENTS_H_DEFINED
00039 #define MEDIA_MEDIASIMEVENTS_H_DEFINED
00040 
00041 #include "Raster/GenericFrame.H"
00042 #include "Simulation/SimEvent.H"
00043 #include "Transport/FrameInfo.H"
00044 #include "Media/TestImages.H"
00045 #include "Media/FrameRange.H"
00046 
00047 class FrameOstream;
00048 
00049 // ######################################################################
00050 //! A new input frame is available
00051 /*! InputFrameSeries posts this event each time a new input frame has
00052   become available. */
00053 class SimEventInputFrame : public SimEvent {
00054 public:
00055   //! Constuctor
00056   SimEventInputFrame(SimModule* src,
00057                      const GenericFrame& fram,
00058                      const int framenum);
00059 
00060   //! Destructor
00061   virtual ~SimEventInputFrame();
00062 
00063   //! Get a description for printing out
00064   virtual std::string toString() const;
00065 
00066   //! Get the frame
00067   const GenericFrame& frame() const;
00068 
00069   //! Get the frame number
00070   int frameNum() const;
00071 
00072 private:
00073   const GenericFrame itsFrame;
00074   const int itsFrameNum;
00075 };
00076 
00077 // ######################################################################
00078 //! Request that outputs be saved now
00079 /*! Normally, SimOutputFrameSeries will save outputs at a fixed
00080   rate. However, it can also operate in an event-driven mode if a
00081   framerate has not been specified on the command line. SimModule
00082   objects may post SimEventSaveOutput events each time they generate
00083   events which they think warrant saving the outputs should the output
00084   frame series operate in event-driven mode. Any SimEventSaveOutput
00085   will be ignored if the output frame series is operating at a fixed
00086   framerate. An example is that when WinnerTakeAll has a new covert
00087   shift of attention, it will post a SimEventSaveOutput. */
00088 class SimEventRequestSaveOutput : public SimEvent {
00089 public:
00090   //! Constuctor
00091   SimEventRequestSaveOutput(SimModule* src);
00092 
00093   //! Destructor
00094   virtual ~SimEventRequestSaveOutput();
00095 };
00096 
00097 // ######################################################################
00098 //! Send the user mouse and keyboard events
00099 class SimEventUserInput : public SimEvent {
00100 public:
00101   //! Constuctor
00102   SimEventUserInput(SimModule* src, const char* wname, const Point2D<int> clickLoc, const int key);
00103 
00104   //! Destructor
00105   virtual ~SimEventUserInput();
00106 
00107   //! get the window name that generated the event
00108   const char* getWinName() const;
00109 
00110   //! Get the mouse event
00111   Point2D<int> getMouseClick() const;
00112 
00113   //! get the keyboard input
00114   int getKey() const;
00115 
00116 private:
00117   const char* itsWname;
00118   const Point2D<int> itsClick;
00119   const int itsKey;
00120 
00121 };
00122 
00123 // ######################################################################
00124 //! Get a description of the current input
00125 /*! This message can be sent just after initialization so that downstream
00126     modules can be informed of the number of frames in the input, and the
00127     name of the input file. */
00128 class SimEventInputDescription : public SimEvent {
00129   public:
00130     //! Constructor
00131     SimEventInputDescription(SimModule* src, const FrameRange range, const std::string name);
00132 
00133     //! Destructor
00134     virtual ~SimEventInputDescription();
00135 
00136     //! Get the frame range for the input
00137     FrameRange getFrameRange() const;
00138 
00139     //! Get a description of the input (a filename, camera source, etc.)
00140     std::string getName() const;
00141 
00142   private:
00143     FrameRange itsFrameRange;
00144     std::string itsName;
00145 
00146 };
00147 
00148 // ######################################################################
00149 //! Request that the input module seek to a new frame
00150 class SimEventRequestFrameNum : public SimEvent {
00151   public:
00152     //! Constructor
00153     SimEventRequestFrameNum(SimModule* src, int frameNum);
00154 
00155     //! Destructor
00156     virtual ~SimEventRequestFrameNum();
00157 
00158     //! Get the requested frame number
00159     int getFrameNum() const;
00160 
00161   private:
00162     int itsFrameNum;
00163 };
00164 
00165 
00166 // ######################################################################
00167 //! A Description of the scene
00168 /*! Any module can use this event to post knowledge of the scene. For example gist recognition
00169   can determine the scene type and post this event. */
00170 class SimEventSceneDescription : public SimEvent {
00171 public:
00172   //! Constuctor
00173   SimEventSceneDescription(SimModule* src,
00174       const rutz::shared_ptr<TestImages::SceneData> sceneData);
00175 
00176   //! Destructor
00177   virtual ~SimEventSceneDescription();
00178 
00179   rutz::shared_ptr<TestImages::SceneData> getSceneData() const;
00180 private:
00181   rutz::shared_ptr<TestImages::SceneData> itsSceneData;
00182 };
00183 
00184 // ######################################################################
00185 //! A Description of an object
00186 /*! Any module can use this event to post knowledge of an object. For example IT
00187   can determine the object type and post this event. */
00188 class SimEventObjectDescription : public SimEvent {
00189 public:
00190   //! Constuctor
00191   SimEventObjectDescription(SimModule* src,
00192       const rutz::shared_ptr<TestImages::ObjData> objData);
00193 
00194   //! Destructor
00195   virtual ~SimEventObjectDescription();
00196 
00197   rutz::shared_ptr<TestImages::ObjData> getObjData() const;
00198 private:
00199   rutz::shared_ptr<TestImages::ObjData> itsObjData;
00200 };
00201 
00202 
00203 // ######################################################################
00204 //! The output of the IT cortex, i.e. information about the object
00205 /*! Any module can use this event to post knowledge of an object. For example IT
00206   can determine the object type and post this event. */
00207 class SimEventITOutput : public SimEvent {
00208 public:
00209   //! Constuctor
00210   SimEventITOutput(SimModule* src,
00211       const rutz::shared_ptr<TestImages::ObjData> objData);
00212 
00213   //! Destructor
00214   virtual ~SimEventITOutput();
00215 
00216   rutz::shared_ptr<TestImages::ObjData> getObjData() const;
00217 private:
00218   rutz::shared_ptr<TestImages::ObjData> itsObjData;
00219 };
00220 
00221 
00222 // ######################################################################
00223 /* So things look consistent in everyone's emacs... */
00224 /* Local Variables: */
00225 /* mode: c++ */
00226 /* indent-tabs-mode: nil */
00227 /* End: */
00228 
00229 #endif // MEDIA_MEDIASIMEVENTS_H_DEFINED
Generated on Sun May 8 08:41:01 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3