|
Wavelet and Image class library
1.3.2
|
00001 /* 00002 * class ImageInformation 00003 * 00004 * $Date$ 00005 * $Revision$ 00006 * 00007 */ 00008 00009 #ifndef IMAGE_INFORMATION_HH__ 00010 #define IMAGE_INFORMATION_HH__ 00011 00012 #include "WImage/CoeffInformation.hh" 00013 #include "WImage/Image.hh" 00014 00020 typedef 00021 bool (*cipredicate) (const CoeffInformation *c1, const CoeffInformation *c2); 00022 00023 #define PII_YPOS(info,pos) (((info)->at (pos)).ypos ()) 00024 #define PII_XPOS(info,pos) (((info)->at (pos)).xpos ()) 00025 #define PII_XYPOS(info,pos) (((info)->at (pos)).xypos ()) 00026 #define II_YPOS(info,pos) (((info).at (pos)).ypos ()) 00027 #define II_XPOS(info,pos) (((info).at (pos)).xpos ()) 00028 #define II_XYPOS(info,pos) (((info).at (pos)).xypos ()) 00029 00035 class 00036 ImageInformation 00037 { 00038 public: 00041 ImageInformation (int size = 0); 00045 ImageInformation (Image &img); 00047 ~ImageInformation (void); 00051 inline int size (void) const { return m_size; } 00057 ImageInformation *head (int n); 00063 ImageInformation *tail (int n); 00069 ImageInformation *append (ImageInformation &ii); 00073 inline ImageInformation *clone (void) { 00074 return head (m_size); 00075 //ImageInformation *ret = new ImageInformation (0); 00076 //ret->m_coeffs = new CoeffInformation [m_size]; 00077 //ret->m_size = m_size; 00078 //for (int i = 0; i < m_size; i++) 00079 // { 00080 // ret->m_coeffs[i] = m_coeffs[i]; 00081 // } 00082 //return ret; 00083 } 00090 void shrink (int newsize, bool leavehead = true); 00097 bool equals (ImageInformation &ii); 00103 inline CoeffInformation &at (int pos) { return m_coeffs[pos]; } 00109 inline void to (CoeffInformation &c, int pos) { m_coeffs[pos] = c; } 00115 inline void to (const CoeffInformation &c, int pos) { m_coeffs[pos] = c; } 00118 void resize (int size); 00124 void swap (int pos1, int pos2); 00125 00129 void gensort (cipredicate isless); 00131 void ssort (void); 00133 void asort (void); 00135 void psort (void); 00137 void yxsort (void); 00139 void xysort (void); 00141 void isort (void); 00143 void shuffle (void); 00147 bool ssorted (void) const; 00151 bool asorted (void) const; 00155 bool psorted (void) const; 00159 bool isorted (void) const; 00163 inline bool isIn (int abs) const { return locate (abs) >= 0; } 00168 inline bool isIn (int y, int x) const { return locate (y, x) >= 0; } 00173 int locate (int abs) const; 00179 int locate (int y, int x) const; 00183 coeff amax (void); 00187 coeff smax (void); 00191 coeff amin (void); 00195 coeff smin (void); 00196 00197 #ifndef _WIN32_WCE 00198 00202 void dump (const char *delim = " ", const char *file = "") const; 00203 #endif 00204 00207 coeff aaverage (void) const; 00208 00211 coeff saverage (void) const; 00212 00215 double sqvariance (void) const; 00216 00220 double variance (bool abs = false) const; 00221 00225 double sdeviation (bool abs = false) const; 00226 00227 #ifdef USE_DEPRECATED_API 00228 00234 inline bool equals (ImageInformation *ii) { return equals (*ii); } 00235 #endif 00236 protected: 00238 CoeffInformation *m_coeffs; 00240 int m_size; 00249 void copyCoeffs (CoeffInformation *coeffs, int size, bool head); 00258 ImageInformation *subimage (int size, bool head); 00266 int randint (int from, int to); 00276 void quicksort (int from, int to, cipredicate isless); 00277 00278 }; /* class ImageInformation */ 00279 00282 #endif /* IMAGE_INFORMATION_HH__ */ 00283
1.7.6.1