SVChanLevels.H

Go to the documentation of this file.
00001 /*!@file SpaceVariant/SVChanLevels.H Class to represent a location in a
00002    StrucureModule or Layer. */
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: David Berg <dberg@usc.edu>
00035 // $HeadURL: svn://isvn.usc.edu:/software/invt/trunk/saliency/src/SpaceVariant/SVChanLevels.H $
00036 
00037 #ifndef SPACEVARIANT_SVCHANLEVELS_H_DEFINED
00038 #define SPACEVARIANT_SVCHANLEVELS_H_DEFINED
00039 
00040 #include "Util/log.H"
00041 #include <vector>
00042 
00043 // ######################################################################
00044 // hold channel level info
00045 // ######################################################################
00046 class SVChanLevels 
00047 {
00048 public:
00049   SVChanLevels() { };
00050 
00051   //!set SVChanLevels for various levels
00052   SVChanLevels(const std::vector<float>& levels);
00053 
00054   //!destructor
00055   ~SVChanLevels() { };
00056 
00057   //operator ==
00058   bool operator==(const SVChanLevels& rhs);
00059 
00060   //!get the number of dimensions
00061   uint numLevels() const;
00062 
00063   //!get the value at N'th pos
00064   float getVariance(const uint pos) const;
00065 
00066   //!get the value at N'th pos
00067   float getMaxVariance() const;
00068 
00069 private:
00070   std::vector<float> itsLevels;
00071 };
00072 
00073 // ######################################################################
00074 // free functions
00075 // ######################################################################
00076 //! format is "[<float>,<float>..."
00077 std::string convertToString(const SVChanLevels& val);
00078 
00079 //! format is "[<float>,<float>..."
00080 void convertFromString(const std::string& str, SVChanLevels& val);
00081 
00082 
00083 // ######################################################################
00084 // implementation of location
00085 // ######################################################################
00086 inline
00087 SVChanLevels::SVChanLevels(const std::vector<float>& levels) : itsLevels(levels)
00088 { }
00089 
00090 // ######################################################################
00091 inline
00092 bool SVChanLevels::operator==(const SVChanLevels& rhs)
00093 {
00094   return (itsLevels == rhs.itsLevels) ? true : false;
00095 }
00096 
00097 // ######################################################################
00098 inline
00099 uint SVChanLevels::numLevels() const
00100 {
00101   return (uint)itsLevels.size();
00102 }
00103 
00104 // ###################################################################### 
00105 inline
00106 float SVChanLevels::getVariance(const uint pos) const
00107 {
00108   return itsLevels[pos];
00109 }
00110 
00111 // ###################################################################### 
00112 inline
00113 float SVChanLevels::getMaxVariance() const
00114 {
00115   return itsLevels[numLevels()-1];
00116 }
00117 
00118 #endif
00119 // ######################################################################
00120 /* So things look consistent in everyone's emacs... */
00121 /* Local Variables: */
00122 /* indent-tabs-mode: nil */
00123 /* End: */
Generated on Sun May 8 08:42:18 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3