OFFIS DCMTK  Version 3.6.0
diqthitl.h
1 /*
2  *
3  * Copyright (C) 2002-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmimage
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose: class DcmQuantHistogramItemList
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:29 $
22  * CVS/RCS Revision: $Revision: 1.4 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIQTHITL_H
31 #define DIQTHITL_H
32 
33 
34 #include "dcmtk/config/osconfig.h"
35 #include "dcmtk/ofstd/oflist.h" /* for OFList */
36 #include "dcmtk/dcmimage/diqthitm.h" /* for DcmQuantHistogramItem */
37 
38 
43 {
44 public:
45 
48 
51 
60  void moveto(DcmQuantHistogramItemPointer *array, unsigned long& counter, unsigned long numcolors);
61 
67  inline int lookup(const DcmQuantPixel& colorP)
68  {
69  first = list_.begin();
70  while (first != last)
71  {
72  if ((*first)->equals(colorP)) return (*first)->getValue();
73  ++first;
74  }
75  return -1;
76  }
77 
85  inline unsigned long add(const DcmQuantPixel& colorP)
86  {
87  first = list_.begin();
88  while (first != last)
89  {
90  if ((*first)->equals(colorP))
91  {
92  (*first)->incValue();
93  return 0;
94  }
95  ++first;
96  }
97 
98  // not found in list, create new entry
99  list_.push_front(new DcmQuantHistogramItem(colorP, 1));
100  return 1;
101  }
102 
107  inline void push_front(const DcmQuantPixel& colorP, int value)
108  {
109  list_.push_front(new DcmQuantHistogramItem(colorP, value));
110  }
111 
113  inline size_t size() const
114  {
115  return list_.size();
116  }
117 
118 private:
119 
122 
125 
128 
129 };
130 
131 
134 
135 
136 #endif
137 
138 
139 /*
140  * CVS/RCS Log:
141  * $Log: diqthitl.h,v $
142  * Revision 1.4 2010-10-14 13:16:29 joergr
143  * Updated copyright header. Added reference to COPYRIGHT file.
144  *
145  * Revision 1.3 2005/12/08 16:01:49 meichel
146  * Changed include path schema for all DCMTK header files
147  *
148  * Revision 1.2 2003/12/17 16:57:55 joergr
149  * Renamed parameters/variables "list" to avoid name clash with STL class.
150  *
151  * Revision 1.1 2002/01/25 13:32:05 meichel
152  * Initial release of new color quantization classes and
153  * the dcmquant tool in module dcmimage.
154  *
155  *
156  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2