StimMaker.H

Go to the documentation of this file.
00001 /*!@file Psycho/StimMaker.H make different kind of visual test stimuli
00002  */
00003 
00004 // //////////////////////////////////////////////////////////////////// //
00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00006 // University of Southern California (USC) and the iLab at USC.         //
00007 // See http://iLab.usc.edu for information about this project.          //
00008 // //////////////////////////////////////////////////////////////////// //
00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00011 // in Visual Environments, and Applications'' by Christof Koch and      //
00012 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00013 // pending; application number 09/912,225 filed July 23, 2001; see      //
00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00015 // //////////////////////////////////////////////////////////////////// //
00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00017 //                                                                      //
00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00019 // redistribute it and/or modify it under the terms of the GNU General  //
00020 // Public License as published by the Free Software Foundation; either  //
00021 // version 2 of the License, or (at your option) any later version.     //
00022 //                                                                      //
00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00026 // PURPOSE.  See the GNU General Public License for more details.       //
00027 //                                                                      //
00028 // You should have received a copy of the GNU General Public License    //
00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00031 // Boston, MA 02111-1307 USA.                                           //
00032 // //////////////////////////////////////////////////////////////////// //
00033 //
00034 // Primary maintainer for this file: T. Nathan Mundhenk <mundhenk@usc.edu>
00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Psycho/StimMaker.H $
00036 // $Id: StimMaker.H 6262 2006-02-17 22:40:07Z rjpeters $
00037 //
00038 
00039 #ifndef STIM_MAKER_H_DEFINED
00040 #define STIM_MAKER_H_DEFINED
00041 
00042 #include "Psycho/StimMakerParam.H"
00043 
00044 //! class for making visual stimuli
00045 class StimMaker
00046 {
00047 public:
00048   //! Init the stim maker with the image size and number of frames
00049   StimMaker(const unsigned short ImageSizeX,
00050             const unsigned short ImageSizeY,
00051             const unsigned short frameCount,
00052             const char bgColor);
00053   //! default destructor
00054   ~StimMaker();
00055   //! re-init the frames to the background color
00056   /*!This should be called every time you want a completely new stim */
00057   void SM_init(const char bgColor);
00058   //! reset the frames and back ground truth to the background color
00059   void SM_setStandardBackGround(const unsigned char bgColor);
00060   //! override the built in blink rates of stimuli
00061   void SM_overRideRates(const unsigned char slowRate,
00062                         const unsigned char fastRate,
00063                         const unsigned char stopRate);
00064   //! overide the built in color sets for target and distractors
00065   void SM_setCustomColors(const PixRGB<float> BGcolor,
00066                           const PixRGB<float> TargetColor,
00067                           const PixRGB<float> DistColor);
00068   //! check if we need to speed up the blink rate
00069   inline ushort SM_speedUpCheck(ushort currBlinkRate,
00070                                 const ushort frame,
00071                                 const ushort changeFrame,
00072                                 const unsigned char stimRate,
00073                                 const unsigned char useSmoothRateChange) const;
00074   //! check if we need to slow down the blink rate
00075   inline ushort SM_speedDownCheck(ushort currBlinkRate,
00076                                   const ushort frame,
00077                                   const ushort changeFrame,
00078                                   const unsigned char stimRate,
00079                                   const unsigned char useSmoothRateChange) const;
00080   //! draw a steady patch where the ground truth is
00081   inline void SM_drawGroundTruth(const ushort frame,
00082                                  const unsigned char stimSizeX,
00083                                  const unsigned char stimSizeY,
00084                                  const ushort PosX,
00085                                  const ushort PosY,
00086                                  const bool targetOn);
00087 
00088   //! draw a single object in the frame and ground truth image
00089   inline void SM_drawSingleTarget(const ushort frame,
00090                                const unsigned char stimShape,
00091                                const unsigned char stimColor,
00092                                const unsigned char stimSizeX,
00093                                const unsigned char stimSizeY,
00094                                const ushort PosX,
00095                                const ushort PosY,
00096                                const float stimOri,
00097                                const float shapePositionJitter,
00098                                const float shapeOrientationJitter,
00099                                const bool target);
00100   //! create a new stim movie with the provided params
00101   /*! This will create a stimulus movie with one target and nxm-1
00102       distractors. The shape and color of the target and distractors can
00103       be specified or they can be randomly chosen by the algorith. Additionally
00104       you can select whether to offset the blinking of stims or just start
00105       each one uniform at the start.
00106   */
00107   void SM_makeUniformStim(const StimMakerParam &stim);
00108   //! get the stim series back
00109   std::vector<Image<PixRGB<float> > > SM_getStim() const;
00110   //! get back the ground truth image
00111   std::vector<Image<PixRGB<float> > > SM_getGroundTruth() const;
00112 private:
00113   bool           itsUseCustomColors;
00114   unsigned char  itsBGcolor;
00115   unsigned char  itsSlowRate;
00116   unsigned char  itsFastRate;
00117   unsigned char  itsStopRate;
00118   unsigned short itsSizeX;
00119   unsigned short itsSizeY;
00120   unsigned short itsFrameCount;
00121   unsigned int   itsRandomSeed;
00122   PixRGB<float>  itsRed;
00123   PixRGB<float>  itsOrange;
00124   PixRGB<float>  itsYellow;
00125   PixRGB<float>  itsGreen;
00126   PixRGB<float>  itsBlue;
00127   PixRGB<float>  itsPurple;
00128   PixRGB<float>  itsBlack;
00129   PixRGB<float>  itsWhite;
00130   PixRGB<float>  itsCustomBG;
00131   PixRGB<float>  itsCustomTarg;
00132   PixRGB<float>  itsCustomDist;
00133   PixRGB<float>  itsGTtargetColor;
00134   PixRGB<float>  itsGTtargetColorPatch1;
00135   PixRGB<float>  itsGTtargetColorPatch2;
00136   PixRGB<float>  itsGTtargetColorPatch1off;
00137   PixRGB<float>  itsGTtargetColorPatch2off;
00138   PixRGB<float>  itsGTdistColor;
00139   std::vector<PixRGB<float> >         itsColorVec;
00140   std::vector<Image<PixRGB<float> > > itsFrames;
00141   std::vector<Image<PixRGB<float> > > itsGroundTruth;
00142 };
00143 
00144 #endif // STIM_MAKER_H_DEFINED
Generated on Sun May 8 08:41:13 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3