/usr/include/dcmtk/dcmimage/diqthitl.h is in libdcmtk-dev 3.6.2-3build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /*
*
* Copyright (C) 2002-2014, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmimage
*
* Author: Marco Eichelberg
*
* Purpose: class DcmQuantHistogramItemList
*
*/
#ifndef DIQTHITL_H
#define DIQTHITL_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/oflist.h" /* for OFList */
#include "dcmtk/dcmimage/diqthitm.h" /* for DcmQuantHistogramItem */
/** this is a helper class used by class DcmQuantColorHashTable.
* It maintains a list of DcmQuantHistogramItem objects.
*/
class DCMTK_DCMIMAGE_EXPORT DcmQuantHistogramItemList
{
public:
/// constructor
DcmQuantHistogramItemList();
/// destructor. Destroys all objects pointed to by list.
~DcmQuantHistogramItemList();
/** this method moves the contents of this list into the given array.
* The list becomes empty if the array is large enough to contain all list members.
* @param array array of pointers to DcmQuantHistogramItem
* @param counter When called, contains the index of the array element
* into which the first member of the list will be moved. Must be < numcolors.
* Upon return, contains the array index of the last element moved + 1.
* @param numcolors number of elements in array
*/
void moveto(DcmQuantHistogramItemPointer *array, unsigned long& counter, unsigned long numcolors);
/** searches the list for an entry that equals the given pixel value.
* If found, the integer value assigned to that pixel is returned, otherwise returns -1.
* @param colorP pixel to lookup in list
* @return integer value for given color if found, -1 otherwise.
*/
inline int lookup(const DcmQuantPixel& colorP)
{
first = list_.begin();
while (first != last)
{
if ((*first)->equals(colorP)) return (*first)->getValue();
++first;
}
return -1;
}
/** adds the given pixel to the list. If the pixel is already
* contained in the list, it's integer value (counter) is increased
* and 0 is returned. Otherwise, a new entry with a counter of 1
* is created and 1 is returned.
* @param colorP pixel to add to the list
* @return 0 if pixel was already in list, 1 otherwise.
*/
inline unsigned long add(const DcmQuantPixel& colorP)
{
first = list_.begin();
while (first != last)
{
if ((*first)->equals(colorP))
{
(*first)->incValue();
return 0;
}
++first;
}
// not found in list, create new entry
list_.push_front(new DcmQuantHistogramItem(colorP, 1));
return 1;
}
/** inserts a new DcmQuantHistogramItem at the beginning of the list.
* @param colorP pixel value assigned to the new object in the list
* @param value integer value assigned to the new object in the list
*/
inline void push_front(const DcmQuantPixel& colorP, int value)
{
list_.push_front(new DcmQuantHistogramItem(colorP, value));
}
/// returns current number of objects in the list
inline size_t size() const
{
return list_.size();
}
private:
/// list of (pointers to) DcmQuantHistogramItem objects
OFList<DcmQuantHistogramItem *> list_;
/// temporary iterator used in various methods; declared here for efficiency reasons only.
OFListIterator(DcmQuantHistogramItem *) first;
/// constant iterator which always contains list_.end(); declared here for efficiency reasons only.
OFListIterator(DcmQuantHistogramItem *) last;
};
/// typedef for a pointer to a DcmQuantHistogramItemList object
typedef DcmQuantHistogramItemList *DcmQuantHistogramItemListPointer;
#endif
|