CINNIC2.H

Go to the documentation of this file.
00001 /*!@file CINNIC/CINNIC2.H Test binary for CINNIC neuron */
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/CINNIC/CINNIC2.H $
00036 // $Id: CINNIC2.H 6003 2005-11-29 17:22:45Z rjpeters $
00037 //
00038 
00039 #ifndef CINNIC2_H_DEFINED
00040 #define CINNIC2_H_DEFINED
00041 
00042 #include "Util/readConfig.H"
00043 #include "Util/log.H"
00044 
00045 #include "VFAT/readMatrix.H"
00046 
00047 #include "CINNIC/contourRun2.H"
00048 #include "CINNIC/contourDefine.H"
00049 #include "CINNIC/CINNICstatsRun.H"
00050 #include "Image/ConvolutionMap.H"
00051 
00052 //this is a simple testing alg. for CINNIC
00053 
00054 
00055 // ############################################################
00056 // ############################################################
00057 // ##### ---CINNIC2---
00058 // ##### Contour Integration:
00059 // ##### T. Nathan Mundhenk nathan@mundhenk.com
00060 // ############################################################
00061 // ############################################################
00062 
00063 #define CINNIC2_DEC template <unsigned short kernelSize,   \
00064                               unsigned short scales,       \
00065                               unsigned short orientations, \
00066                               unsigned short iterations,   \
00067                               class FLOAT, class INT>
00068 
00069 #define CINNIC2_CLASS CINNIC2<kernelSize,scales,orientations, \
00070                                        iterations,FLOAT,INT>
00071 
00072 //! Main class to run an image in CINNICtest for contours
00073 /*! This is the central class at this point for running CINNIC.
00074   It works by creating a CINNIC template for neuron connections
00075   in contourNeuron. It then imports an image as defines from
00076   the command line. The image is processed for orientations
00077   using the orientedFilter in Image as well as a few other
00078   processes. The image is then reduced and a 3D map of the
00079   image created and stored in ImageMap. This map and the
00080   neuron are then fed into contourRun which runs the 3D image
00081   against the template neuron. Output is produced in many ways
00082   including several raw data dumps and image dumps.
00083 */
00084 CINNIC2_DEC
00085 class CINNIC2
00086 {
00087 private:
00088   //! set true if using frames
00089   bool CINuseFrameSeries;
00090   bool CINuseMaps;
00091   unsigned int CINframe;
00092   INT CINedgeAtten,CINGnum;
00093   INT CINlPass,CINgroupSize;
00094   INT CINstoreArraySize;
00095   INT CINbaseSize;
00096   INT CINorignalImageSizeX, CINorignalImageSizeY;
00097   FLOAT CINGroupTop;
00098   std::string CINlogto;
00099   std::string CINsaveto;
00100   INT CINscaleSize[scales];
00101   FLOAT CINscaleBias[scales];
00102   std::vector<Image<FLOAT> > CINFinput;
00103   std::vector<Image<FLOAT> > CINgroup;
00104   std::vector<Image<FLOAT> > CINresults;
00105   std::vector< std::vector< Image<FLOAT> > > CINIresults;
00106   std::vector< std::vector< Image<FLOAT> > > CINVFinput;
00107   std::vector<INT> CINgroupCount;
00108   std::vector<FLOAT> CINgroupTopVec;
00109   std::vector<
00110        contourRun2<kernelSize,scales,orientations,iterations,FLOAT,INT> >
00111        CINcontourRun;
00112   Image<byte>  CINcombinedSalMap;
00113   convolutionMap<FLOAT> CINcMap;
00114 public:
00115   const static unsigned short CINkernelSize   = kernelSize;
00116   const static unsigned short CINscales       = scales;
00117   const static unsigned short CINorientations = orientations;
00118   const static unsigned short CINiterations   = iterations;
00119   const static FLOAT          CINsmallNumber  = 0.001F;
00120   //! default constructor
00121   CINNIC2();
00122   ~CINNIC2();
00123   //! turn on using movie frames
00124   void CINtoggleFrameSeries(bool toggle);
00125   //! load configuration file params
00126   void CINconfigLoad(readConfig &config);
00127   //! run an image in CINNIC2 with a neuron template
00128   void CINrunSimpleImage(const ContourNeuronCreate<FLOAT> &NeuronTemplate,
00129                          const char fileName[100], unsigned int frame,
00130                          Image<byte> &input,
00131                          readConfig &config);
00132   //! get the orientation filtered pre version of the input image
00133   void CINgetOrientFiltered(Image<byte> &input);
00134   //! get the orientation filtered version, but use convolution maps
00135   void CINgetOrientFilteredMap(Image<byte> &input);
00136   //! get the scaled representations of the image
00137   void CINgetScaled();
00138   //! initalize parameters to run CINNIC2
00139   void CINinitCINNIC(const std::vector< std::vector<Image<FLOAT> > > &input,
00140                      readConfig &config,
00141                      const INT sizeX,
00142                      const INT sizeY);
00143   //! initalize groups to run CINNIC2
00144   void CINcomputeGroups(const std::vector< std::vector<Image<FLOAT> > > &input);
00145   //! call contourRun2 for each iteration and scale
00146   void CINrunImage(const ContourNeuronCreate<FLOAT> &NeuronTemplate,
00147                    const std::vector< std::vector<Image<FLOAT> > > &input,
00148                    readConfig &config,
00149                    const std::vector<FLOAT> &GTV);
00150   //! call contourRun2 for each iteration and scale
00151   void CINrunImageFrames(const ContourNeuronCreate<FLOAT> &NeuronTemplate,
00152                          const std::vector< std::vector<Image<FLOAT> > > &input,
00153                          readConfig &config,
00154                          const std::vector<FLOAT> &GTV);
00155 
00156 };
00157 
00158 #endif
00159 
00160 // ######################################################################
00161 /* So things look consistent in everyone's emacs... */
00162 /* Local Variables: */
00163 /* indent-tabs-mode: nil */
00164 /* End: */
Generated on Sun May 8 08:40:22 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3