00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef DIQTHITL_H
00035 #define DIQTHITL_H
00036
00037
00038 #include "dcmtk/config/osconfig.h"
00039 #include "dcmtk/ofstd/oflist.h"
00040 #include "dcmtk/dcmimage/diqthitm.h"
00041
00042
00046 class DcmQuantHistogramItemList
00047 {
00048 public:
00049
00051 DcmQuantHistogramItemList();
00052
00054 ~DcmQuantHistogramItemList();
00055
00064 void moveto(DcmQuantHistogramItemPointer *array, unsigned long& counter, unsigned long numcolors);
00065
00071 inline int lookup(const DcmQuantPixel& colorP)
00072 {
00073 first = list_.begin();
00074 while (first != last)
00075 {
00076 if ((*first)->equals(colorP)) return (*first)->getValue();
00077 ++first;
00078 }
00079 return -1;
00080 }
00081
00089 inline unsigned long add(const DcmQuantPixel& colorP)
00090 {
00091 first = list_.begin();
00092 while (first != last)
00093 {
00094 if ((*first)->equals(colorP))
00095 {
00096 (*first)->incValue();
00097 return 0;
00098 }
00099 ++first;
00100 }
00101
00102
00103 list_.push_front(new DcmQuantHistogramItem(colorP, 1));
00104 return 1;
00105 }
00106
00111 inline void push_front(const DcmQuantPixel& colorP, int value)
00112 {
00113 list_.push_front(new DcmQuantHistogramItem(colorP, value));
00114 }
00115
00117 inline size_t size() const
00118 {
00119 return list_.size();
00120 }
00121
00122 private:
00123
00125 OFList<DcmQuantHistogramItem *> list_;
00126
00128 OFListIterator(DcmQuantHistogramItem *) first;
00129
00131 OFListIterator(DcmQuantHistogramItem *) last;
00132
00133 };
00134
00135
00137 typedef DcmQuantHistogramItemList *DcmQuantHistogramItemListPointer;
00138
00139
00140 #endif
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157