ChannelFacetScalar.H

Go to the documentation of this file.
00001 /*!@file Channels/ChannelFacetScalar.H ChannelFacet that contains scalars */
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/Channels/ChannelFacetScalar.H $
00035 // $Id: ChannelFacetScalar.H 14376 2011-01-11 02:44:34Z pez $
00036 //
00037 
00038 #ifndef CHANNELS_CHANNELFACETSCALAR_H_DEFINED
00039 #define CHANNELS_CHANNELFACETSCALAR_H_DEFINED
00040 
00041 #include<vector>
00042 
00043 #include "Channels/ChannelFacet.H"
00044 #include "Image/LevelSpec.H"
00045 
00046 class SingleChannel;
00047 class ComplexChannel;
00048 
00049 /// ChannelFacet that contains one scalar value per feature map
00050 /** This is a simple derivation of ChannelFacet to add one scalar
00051     value to each feature map of a SingleChannel, or to each
00052     subchannel of a ComplexChannel. ChannelFacetScalar is a virtual
00053     base that cannot be implemented because it inherits pure virtual
00054     readFrom() and writeTo() from ChannelFacet, see
00055     ChannelFacetScalarSingle and ChannelFacetScalarComplex for
00056     implementable derivations.  This class is used, e.g., to store a
00057     weighing (gain) coefficient for each submap, or the mean or std
00058     submap values, for either targets or distractors, etc. */
00059 class ChannelFacetScalar : public ChannelFacet
00060 {
00061 public:
00062   /// Virtual destructor for safe inheritance
00063   virtual ~ChannelFacetScalar();
00064 
00065 protected:
00066   /// Constructor
00067   ChannelFacetScalar(const uint siz, const double initval);
00068 
00069   //!< Our data values
00070   std::vector<double> itsVals;
00071 };
00072 
00073 // ######################################################################
00074 /// Specialization of ChannelFacetScalar for SingleChannel
00075 /** This class holds one scalar parameter per feature map of the
00076     SingleChannel.  Note that since the LevelSpec is used internally
00077     at constructions to determine how many feature maps are in each
00078     SingleChannel, this should not be constructed until after the
00079     model has been start()'ed so that the LevelSpec is
00080     valid. Typically, PreFrontalCortex would be in charge of
00081     installing these facets by using a ChannelVisitor depending on the
00082     type of extra top-down attention components being used. */
00083 class ChannelFacetScalarSingle : public ChannelFacetScalar
00084 {
00085 public:
00086   /// Destructor
00087   virtual ~ChannelFacetScalarSingle();
00088 
00089   /// Set a value
00090   void setVal(const uint clev, const uint slev, const double val);
00091 
00092   /// Set a value
00093   void setVal(const uint idx, const double val);
00094 
00095   /// Get a value
00096   double getVal(const uint clev, const uint slev) const;
00097 
00098   /// Get a value
00099   double getVal(const uint idx) const;
00100 
00101   /// Write our data out to a ParamMap
00102   virtual void writeTo(ParamMap& pmap) const;
00103 
00104   /// Read our data back in from a ParamMap
00105   virtual void readFrom(const ParamMap& pmap);
00106 
00107 protected:
00108   /// Constructor
00109   ChannelFacetScalarSingle(const SingleChannel& chan, const double initval);
00110 
00111   const LevelSpec itsLevelSpec; //!< Keep track of our channel's info
00112 };
00113 
00114 // ######################################################################
00115 /// Specialization of ChannelFacetScalar for ComplexChannel
00116 /** This class holds one or more named scalar parameters per
00117      subchannel of the ComplexChannel.  Note that this should be
00118      called after the model has been start()'ed since we will in our
00119      constructor query the ComplexChannel to determine how many
00120      subchannels it has. Typically, PreFrontalCortex would be in
00121      charge of installing these facets by using a ChannelVisitor
00122      depending on the type of extra top-down attention components
00123      being used. */
00124 class ChannelFacetScalarComplex : public ChannelFacetScalar
00125 {
00126 public:
00127   /// Destructor
00128   virtual ~ChannelFacetScalarComplex();
00129 
00130   /// Set a value
00131   void setVal(const uint subchan, const double val);
00132 
00133   /// Get a value
00134   double getVal(const uint subchan) const;
00135 
00136   /// Write our data out to a ParamMap
00137   virtual void writeTo(ParamMap& pmap) const;
00138 
00139   /// Read our data back in from a ParamMap
00140   virtual void readFrom(const ParamMap& pmap);
00141 
00142 protected:
00143   /// Constructor
00144   ChannelFacetScalarComplex(const ComplexChannel& chan, const double initval);
00145 };
00146 
00147 // ######################################################################
00148 /* So things look consistent in everyone's emacs... */
00149 /* Local Variables: */
00150 /* mode: c++ */
00151 /* indent-tabs-mode: nil */
00152 /* End: */
00153 
00154 #endif // CHANNELS_CHANNELFACETSCALAR_H_DEFINED
Generated on Sun May 8 08:40:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3