dcmimage/include/diqtstab.h

00001 /* 00002 * 00003 * Copyright (C) 2002-2003, 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 DcmQuantScaleTable 00023 * 00024 * Last Update: $Author: joergr $ 00025 * Update Date: $Date: 2003/12/23 12:20:44 $ 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 DIQTSTAB_H 00035 #define DIQTSTAB_H 00036 00037 00038 #include "osconfig.h" 00039 #include "ofcast.h" 00040 #include "diqttype.h" /* for DcmQuantComponent */ 00041 00042 #define INCLUDE_CSTDLIB 00043 #define INCLUDE_CASSERT 00044 #include "ofstdinc.h" 00045 00046 00052 class DcmQuantScaleTable 00053 { 00054 public: 00055 00057 DcmQuantScaleTable() 00058 : table(NULL) 00059 , numEntries(0) 00060 { 00061 } 00062 00064 ~DcmQuantScaleTable() 00065 { 00066 cleanup(); 00067 } 00068 00075 inline DcmQuantComponent operator[](unsigned int idx) const 00076 { 00077 #ifdef DEBUG 00078 assert(idx < numEntries); 00079 #endif 00080 return table[idx]; 00081 } 00082 00087 void createTable( 00088 unsigned long oldmaxval, 00089 unsigned long newmaxval) 00090 { 00091 cleanup(); 00092 00093 table = new DcmQuantComponent[oldmaxval+1]; 00094 if (table) 00095 { 00096 numEntries = OFstatic_cast(unsigned int, oldmaxval) + 1; 00097 for (unsigned int i=0; i < numEntries; i++) 00098 table[i] = OFstatic_cast(DcmQuantComponent, (OFstatic_cast(unsigned long, i) * newmaxval + oldmaxval/2) / oldmaxval); 00099 } 00100 } 00101 00102 private: 00103 00105 inline void cleanup() 00106 { 00107 delete[] table; 00108 table = NULL; 00109 numEntries = 0; 00110 } 00111 00113 DcmQuantScaleTable(const DcmQuantScaleTable& src); 00114 00116 DcmQuantScaleTable& operator=(const DcmQuantScaleTable& src); 00117 00119 DcmQuantComponent *table; 00120 00122 unsigned int numEntries; 00123 }; 00124 00125 00126 #endif 00127 00128 00129 /* 00130 * CVS/RCS Log: 00131 * $Log: diqtstab.h,v $ 00132 * Revision 1.3 2003/12/23 12:20:44 joergr 00133 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00134 * Updated copyright header. 00135 * 00136 * Revision 1.2 2002/11/27 14:16:56 meichel 00137 * Adapted module dcmimage to use of new header file ofstdinc.h 00138 * 00139 * Revision 1.1 2002/01/25 13:32:07 meichel 00140 * Initial release of new color quantization classes and 00141 * the dcmquant tool in module dcmimage. 00142 * 00143 * 00144 */


Generated on 4 Nov 2004 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.3.8