26 #ifndef __HistogramImage_HH__
27 #define __HistogramImage_HH__
29 #include <Base/Common/BIASpragmaStart.hh>
33 #include <Base/Image/Image.hh>
34 #include <Base/Math/Math.hh>
37 #define D_HIST_VEC 0x8000000
84 void SetBinCount(
unsigned int bincount);
87 {
return BinCount_; };
90 {
return HistCount_; };
94 void SetFactor(
unsigned short Factor);
103 void SetHistCount(
unsigned int histcount);
108 int InitHist(
unsigned int bincount = 256,
unsigned int histcount = 1);
115 float CalcShannonEntropy(
unsigned int hist=0);
119 float CalcRenyiEntropy(
unsigned int hist=0,
double alpha=1.0);
125 template <
class StorageType>
133 template <
class DataType>
134 int AddHist(
const std::vector<DataType>& data,
unsigned int hist = 0);
140 template <
class DataType>
141 int AddHist(
const std::vector<DataType>& data, DataType min, DataType max,
142 unsigned int hist = 0);
146 template <
class DataType>
147 int AddWeightedHist(
const std::vector<DataType>& data,
148 const std::vector<double>& weight,
unsigned int hist = 0);
151 int SetColor(
unsigned char R,
unsigned char G,
unsigned char B,
152 unsigned int hist = 0);
156 inline void GetDataRange(
double& min,
double& max,
unsigned int hist = 0)
157 { min=MinBinVal_[hist] ; max=MaxBinVal_[hist]; }
161 { maxentry=MaxHistEntry_[hist]; }
166 { ScaleYToMaxEntry_ = s; }
176 int ZeroHist(
unsigned int hist = 0);
179 double GetBin(
unsigned int bin,
unsigned int hist=0);
182 int SetBin(
unsigned int bin,
double value,
unsigned int hist=0);
184 void Dump(std::ostream& os=std::cout);
187 void WriteASCII(std::ostream& os=std::cout);
190 int WriteASCII(
const std::string& filename);
194 void CooTransf(
double datacoo[2],
double imcoo[2],
unsigned hist=0);
197 void CooTransf(
double datacoo[2],
unsigned imcoo[2],
unsigned hist=0);
223 int RedrawHist_(
unsigned int hist);
226 int DeleteHist_(
unsigned int hist);
229 int DrawHist_(
unsigned int hist);
232 int DrawHistLog_(
unsigned int hist);
234 int CalcAverage_(
unsigned int hist);
245 void SetColorModel();
248 void SetFactor(
unsigned short Factor);
250 void InitHist(
unsigned xbincount=256,
unsigned ybincount=256);
252 template <
class DataType>
253 void AddHist(
const std::vector<DataType>& xdata,
const std::vector<DataType>& ydata);
261 void Dump(std::ostream& os=std::cout);
264 void WriteASCII(std::ostream& os=std::cout);
268 void CooTransf(
double datacoo[2],
double imcoo[2]);
271 void CooTransf(
double datacoo[2],
unsigned imcoo[2]);
277 double XMinBinVal_, XMaxBinVal_, XBinSize_,
YMinBinVal_, YMaxBinVal_,
289 #include <Base/Common/BIASpragmaEnd.hh>
291 #endif // __HistogramImage_HH__
unsigned int GetHistCount()
unsigned char _ucBorderColor
void SetScaleYToMaxEntry(bool s)
if true, the upper border of histogram is MaxHistEntry, otherwise the upper border of histogram k is ...
unsigned short int Factor_
unsigned short int Factor_
The image template class for specific storage types.
Class for easy histogram image generation.
void GetMaxHistEntry(double &maxentry, unsigned int hist=0)
returns the biggest bin in histogram hist
void GetDataRange(double &min, double &max, unsigned int hist=0)
returns the range of the histogram, i.e.
void SetDrawMode(HistMode m)
Select drawing style. Default is HIST_POINTS.
unsigned char _ucBorderColor
unsigned short int HistCount_
unsigned int GetBinCount()