00001 /*!@file Psycho/EyesalData.H Simple struct for eyesal output files data */ 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: David Berg <dberg@usc.edu> 00034 // 00035 00036 #ifndef PSYCHO_EYESALDATA_H_DEFINED 00037 00038 #include "Image/Pixels.H" 00039 #include "Psycho/EyeData.H" 00040 #include "Util/SimTime.H" 00041 #include "rutz/shared_ptr.h" 00042 00043 #include <string> 00044 #include <vector> 00045 00046 00047 //! Simple class for an eyesal output file data, represents data and I/O 00048 class EyesalData { 00049 public: 00050 // ###################################################################### 00051 /*! @name Constructors, destructor and initialization */ 00052 //@{ 00053 00054 //! Emtpy Constructor for compatibility 00055 EyesalData(); 00056 00057 //! Constructor from a file on disk 00058 EyesalData(const std::string& filename); 00059 00060 00061 //@} 00062 00063 // ###################################################################### 00064 /*! @name Data access functions */ 00065 //@{ 00066 00067 //! reset the file data 00068 void setFile(const std::string& filename); 00069 00070 //! Do we have a sample for the given index? 00071 /*! This will return true as long as the index is not past the 00072 available amount of data. */ 00073 bool hasData(const size_t index) const; 00074 00075 //!return the normalized saliency values 00076 std::vector<float> getNormSal() const; 00077 00078 //! return the normalized random value at index(usually 1:100) 00079 std::vector<float> getNormRand(const size_t index) const; 00080 00081 //! return all the normalized random values 00082 std::vector< std::vector<float> > getAllNormRand() const; 00083 00084 //! return all the normalized random values Transposed 00085 std::vector< std::vector<float> > getAllNormRandT() const; 00086 00087 //!return the x and y position at the specified index 00088 Point2D<int> getXYpos(const size_t index) const; 00089 00090 //!return the x and y positions as a vector 00091 std::vector<Point2D<int> > getXYpos() const; 00092 00093 //!return the time at which the saccade landed at its target 00094 float getTime(const size_t index) const; 00095 00096 //!return the times of saccadic endpoints as a vector 00097 std::vector<float> getTime() const; 00098 00099 //!return the filename that the saccade at index occurred in 00100 std::string getFileName(const size_t index) const; 00101 00102 //!return the filnames as a vector of string 00103 std::vector<std::string> getFileName() const; 00104 00105 //! Get number of saccades in file 00106 size_t size() const; 00107 00108 //@} 00109 00110 // ###################################################################### 00111 /*! @name Metadata access functions */ 00112 //@{ 00113 00114 //! Get filename 00115 std::string filename() const; 00116 00117 //! Get filename, without extension if any 00118 std::string basename() const; 00119 00120 //@} 00121 00122 // ###################################################################### 00123 /*! @name Computations */ 00124 //@{ 00125 00126 //! get AUC of the data 00127 float getAUC() const; 00128 00129 //@} 00130 00131 private: 00132 // forbid assignment and copy-construction: 00133 EyesalData& operator=(const EyesalData& e); 00134 EyesalData(const EyesalData& e); 00135 00136 00137 std::string itsFilename; 00138 // for internal use only! 00139 //Eyesal format: 00140 // x,y,fovx,fovy,pupil,amp,duration,sactime,val,min,max,avg,100 random 00141 struct RawEyesalData { 00142 std::string Filename; 00143 int x, y, fovx, fovy; 00144 float pupil, amp, duration, sactime,val,min,max,avg; 00145 float rand[300]; 00146 }; 00147 std::vector<RawEyesalData> itsData; 00148 }; 00149 00150 00151 00152 00153 #define PSYCHO_EYESALDATA_H_DEFINED 00154 00155 // ###################################################################### 00156 /* So things look consistent in everyone's emacs... */ 00157 /* Local Variables: */ 00158 /* mode: c++ */ 00159 /* indent-tabs-mode: nil */ 00160 /* End: */ 00161 00162 #endif // PSYCHO_EYESALDATA_H_DEFINED