00001 /* 00002 * 00003 * Copyright (C) 1996-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmimgle 00015 * 00016 * Author: Joerg Riesmeier 00017 * 00018 * Purpose: DicomBaseLUT (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:25 $ 00022 * CVS/RCS Revision: $Revision: 1.18 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DIBASLUT_H 00031 #define DIBASLUT_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 #include "dcmtk/ofstd/ofstring.h" 00035 #include "dcmtk/ofstd/ofcast.h" 00036 00037 #include "dcmtk/dcmimgle/diutils.h" 00038 00039 00040 /*---------------------* 00041 * macro definitions * 00042 *---------------------*/ 00043 00044 #define MIN_TABLE_ENTRY_SIZE 8 00045 #define MAX_TABLE_ENTRY_SIZE 16 00046 #define MAX_TABLE_ENTRY_COUNT 65536 00047 00048 00049 /*---------------------* 00050 * class declaration * 00051 *---------------------*/ 00052 00055 class DiBaseLUT 00056 { 00057 00058 public: 00059 00065 DiBaseLUT(const Uint32 count = 0, 00066 const Uint16 bits = 0); 00067 00070 virtual ~DiBaseLUT(); 00071 00076 inline Uint32 getCount() const 00077 { 00078 return Count; 00079 } 00080 00085 inline Uint16 getBits() const 00086 { 00087 return Bits; 00088 } 00089 00098 inline Uint32 getFirstEntry(const Uint32 = 0) const 00099 { 00100 return FirstEntry; 00101 } 00102 00111 inline Sint32 getFirstEntry(const Sint32) const 00112 { 00113 return OFstatic_cast(Sint16, FirstEntry); 00114 } 00115 00124 inline Uint32 getLastEntry(const Uint32 = 0) const 00125 { 00126 return FirstEntry + Count - 1; 00127 } 00128 00137 inline Sint32 getLastEntry(const Sint32) const 00138 { 00139 return OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry)) + Count - 1; 00140 } 00141 00148 inline Uint16 getValue(const Uint16 pos) const 00149 { 00150 return Data[pos]; 00151 } 00152 00161 inline Uint16 getValue(const Uint32 pos) const 00162 { 00163 return Data[pos - FirstEntry]; 00164 } 00165 00174 inline Uint16 getValue(const Sint32 pos) const 00175 { 00176 return Data[pos - OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry))]; 00177 } 00178 00183 inline Uint16 getFirstValue() const 00184 { 00185 return Data[0]; 00186 } 00187 00192 inline Uint16 getLastValue() const 00193 { 00194 return Data[Count - 1]; 00195 } 00196 00201 inline const Uint16 *getData() const 00202 { 00203 return Data; 00204 } 00205 00210 inline Uint16 getMinValue() const 00211 { 00212 return MinValue; 00213 } 00214 00219 inline Uint16 getMaxValue() const 00220 { 00221 return MaxValue; 00222 } 00223 00229 inline Uint32 getAbsMaxRange() const 00230 { 00231 return DicomImageClass::maxval(Bits, 0); 00232 } 00233 00238 inline int isValid() const 00239 { 00240 return Valid; 00241 } 00242 00247 inline const char *getExplanation() const 00248 { 00249 return (Explanation.empty()) ? OFstatic_cast(const char *, NULL) : Explanation.c_str(); 00250 } 00251 00258 virtual OFBool operator==(const DiBaseLUT &lut); 00259 00260 00261 protected: 00262 00269 DiBaseLUT(Uint16 *buffer, 00270 const Uint32 count = 0, 00271 const Uint16 bits = 0); 00272 00282 int compare(const DiBaseLUT *lut); 00283 00285 Uint32 Count; 00287 Uint16 FirstEntry; 00289 Uint16 Bits; 00290 00292 Uint16 MinValue; 00294 Uint16 MaxValue; 00295 00297 int Valid; 00298 00300 OFString Explanation; 00301 00303 const Uint16 *Data; 00305 Uint16 *DataBuffer; 00306 00307 00308 private: 00309 00310 // --- declarations to avoid compiler warnings 00311 00312 DiBaseLUT(const DiBaseLUT &); 00313 DiBaseLUT &operator=(const DiBaseLUT &); 00314 }; 00315 00316 00317 #endif 00318 00319 00320 /* 00321 * 00322 * CVS/RCS Log: 00323 * $Log: dibaslut.h,v $ 00324 * Revision 1.18 2010-10-14 13:16:25 joergr 00325 * Updated copyright header. Added reference to COPYRIGHT file. 00326 * 00327 * Revision 1.17 2010-10-05 15:26:28 joergr 00328 * Fixed various Doxygen API documentation issues. 00329 * 00330 * Revision 1.16 2005/12/08 16:47:32 meichel 00331 * Changed include path schema for all DCMTK header files 00332 * 00333 * Revision 1.15 2003/12/08 18:40:32 joergr 00334 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00335 * Removed leading underscore characters from preprocessor symbols (reserved 00336 * symbols). Updated CVS header. 00337 * 00338 * Revision 1.14 2003/06/12 15:08:34 joergr 00339 * Fixed inconsistent API documentation reported by Doxygen. 00340 * 00341 * Revision 1.13 2001/06/01 15:49:39 meichel 00342 * Updated copyright header 00343 * 00344 * Revision 1.12 2000/03/08 16:24:13 meichel 00345 * Updated copyright header. 00346 * 00347 * Revision 1.11 2000/03/06 18:17:59 joergr 00348 * Moved get-method to base class and made method virtual to avoid hiding of 00349 * methods (reported by Sun CC 4.2). 00350 * 00351 * Revision 1.10 1999/10/20 10:34:43 joergr 00352 * Enhanced method invertTable to distinguish between copy of LUT data and 00353 * original (referenced) LUT data. 00354 * 00355 * Revision 1.9 1999/09/30 11:37:08 joergr 00356 * Added methods to compare two lookup tables. 00357 * 00358 * Revision 1.8 1999/09/17 12:07:23 joergr 00359 * Added/changed/completed DOC++ style comments in the header files. 00360 * 00361 * Revision 1.7 1999/09/08 15:19:24 joergr 00362 * Completed implementation of setting inverse presentation LUT as needed 00363 * e.g. for DICOM print (invert 8->12 bits PLUT). 00364 * 00365 * Revision 1.6 1999/07/23 13:51:44 joergr 00366 * Changed comments/formatting. 00367 * 00368 * Revision 1.5 1999/05/03 11:09:27 joergr 00369 * Minor code purifications to keep Sun CC 2.0.1 quiet. 00370 * 00371 * Revision 1.4 1999/03/24 17:19:58 joergr 00372 * Added/Modified comments and formatting. 00373 * 00374 * Revision 1.3 1999/03/03 11:46:26 joergr 00375 * Added method to invert lookup table data (used for presentation state LUTs). 00376 * 00377 * Revision 1.2 1999/02/11 15:42:49 joergr 00378 * Removed unnecessary include statement. 00379 * 00380 * Revision 1.1 1999/02/03 17:45:38 joergr 00381 * Added base class for look-up tables (moved main functionality of class 00382 * DiLookupTable to DiBaseLUT). 00383 * 00384 * 00385 */