diqthitl.h

00001 /*
00002  *
00003  *  Copyright (C) 2002-2005, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module:  dcmimage
00019  *
00020  *  Author:  Marco Eichelberg
00021  *
00022  *  Purpose: class DcmQuantHistogramItemList
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2005/12/08 16:01:49 $
00026  *  CVS/RCS Revision: $Revision: 1.3 $
00027  *  Status:           $State: Exp $
00028  *
00029  *  CVS/RCS Log at end of file
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"    /* for OFList */
00040 #include "dcmtk/dcmimage/diqthitm.h"  /* for DcmQuantHistogramItem */
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     // not found in list, create new entry
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  * CVS/RCS Log:
00145  * $Log: diqthitl.h,v $
00146  * Revision 1.3  2005/12/08 16:01:49  meichel
00147  * Changed include path schema for all DCMTK header files
00148  *
00149  * Revision 1.2  2003/12/17 16:57:55  joergr
00150  * Renamed parameters/variables "list" to avoid name clash with STL class.
00151  *
00152  * Revision 1.1  2002/01/25 13:32:05  meichel
00153  * Initial release of new color quantization classes and
00154  *   the dcmquant tool in module dcmimage.
00155  *
00156  *
00157  */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5