Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Histogram1dSet.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Histogram_Histogram1dSet_h
00002 #define Impala_Core_Histogram_Histogram1dSet_h
00003 
00004 #include <iostream>
00005 #include "Core/Vector/VectorSet.h"
00006 #include "Core/Histogram/Histogram1dTem.h"
00007 #include "Core/Array/SetVal.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Histogram
00014 {
00015 
00016 
00017 template <class ArrayT>
00018 class Histogram1dSet : public Vector::VectorSet<ArrayT>
00019 {
00020 public:
00021 
00022     typedef typename ArrayT::StorType ElemT;
00023     typedef Histogram1dTem<ElemT> HistT;
00024 
00025     Histogram1dSet(ElemT low, ElemT high, int binCount, int nrHist)
00026         : Vector::VectorSet<ArrayT>(true, binCount, nrHist)
00027     {
00028         mLow = new ElemT[nrHist];
00029         mHigh = new ElemT[nrHist];
00030         for (int i=0 ; i<nrHist ; i++)
00031         {
00032             mLow[i] = low;
00033             mHigh[i] = high;
00034         }
00035         mBinCount = binCount;
00036         mOutliers = new ElemT[nrHist];
00037         ArrayT* storage = this->GetStorage();
00038         Array::SetVal(storage, storage, 0);
00039     }
00040 
00041     virtual ~Histogram1dSet()
00042     {
00043         delete mLow;
00044         delete mHigh;
00045         delete mOutliers;
00046     }
00047 
00048     ElemT
00049     GetLow(int i)
00050     {
00051         return mLow[i];
00052     }
00053 
00054     void
00055     SetLow(int i, ElemT low)
00056     {
00057         mLow[i] = low;
00058     }
00059 
00060     ElemT
00061     GetHigh(int i)
00062     {
00063         return mHigh[i];
00064     }
00065 
00066     void
00067     SetHigh(int i, ElemT high)
00068     {
00069         mHigh[i] = high;
00070     }
00071 
00072     void
00073     SetRange(int i, ElemT low, ElemT high)
00074     {
00075         mLow[i] = low;
00076         mHigh[i] = high;
00077     }
00078 
00079     int
00080     GetBinCount()
00081     {
00082         return mBinCount;
00083     }
00084 
00085     void
00086     Clear()
00087     {
00088         Array::SetVal(this->GetStorage(), this->GetStorage(), 0);
00089     }
00090 
00091     Histogram1dTem<ElemT>
00092     Hist(int i)
00093     {
00094         return Histogram1dTem<ElemT>(mLow[i], mHigh[i], mBinCount, &(mOutliers[i]),
00095                                      this->GetVectorData(i));
00096     }
00097 
00098 private:
00099 
00100     ElemT* mLow;
00101     ElemT* mHigh;
00102     int    mBinCount;
00103     ElemT* mOutliers;
00104 
00105 };
00106 
00107 } // namespace Histogram
00108 } // namespace Core
00109 } // namespace Impala
00110 
00111 #endif

Generated on Fri Mar 19 09:31:10 2010 for ImpalaSrc by  doxygen 1.5.1