00001 /* 00002 * 00003 * Copyright (C) 1996-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: dcmimgle 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: DicomBaseLUT (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:47:32 $ 00026 * CVS/RCS Revision: $Revision: 1.16 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DIBASLUT_H 00035 #define DIBASLUT_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/ofstd/ofstring.h" 00039 #include "dcmtk/ofstd/ofcast.h" 00040 00041 #include "dcmtk/dcmimgle/diutils.h" 00042 00043 00044 /*---------------------* 00045 * macro definitions * 00046 *---------------------*/ 00047 00048 #define MIN_TABLE_ENTRY_SIZE 8 00049 #define MAX_TABLE_ENTRY_SIZE 16 00050 #define MAX_TABLE_ENTRY_COUNT 65536 00051 00052 00053 /*---------------------* 00054 * class declaration * 00055 *---------------------*/ 00056 00059 class DiBaseLUT 00060 { 00061 00062 public: 00063 00069 DiBaseLUT(const Uint32 count = 0, 00070 const Uint16 bits = 0); 00071 00074 virtual ~DiBaseLUT(); 00075 00080 inline Uint32 getCount() const 00081 { 00082 return Count; 00083 } 00084 00089 inline Uint16 getBits() const 00090 { 00091 return Bits; 00092 } 00093 00102 inline Uint32 getFirstEntry(const Uint32 = 0) const 00103 { 00104 return FirstEntry; 00105 } 00106 00115 inline Sint32 getFirstEntry(const Sint32) const 00116 { 00117 return OFstatic_cast(Sint16, FirstEntry); 00118 } 00119 00128 inline Uint32 getLastEntry(const Uint32 = 0) const 00129 { 00130 return FirstEntry + Count - 1; 00131 } 00132 00141 inline Sint32 getLastEntry(const Sint32) const 00142 { 00143 return OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry)) + Count - 1; 00144 } 00145 00152 inline Uint16 getValue(const Uint16 pos) const 00153 { 00154 return Data[pos]; 00155 } 00156 00165 inline Uint16 getValue(const Uint32 pos) const 00166 { 00167 return Data[pos - FirstEntry]; 00168 } 00169 00178 inline Uint16 getValue(const Sint32 pos) const 00179 { 00180 return Data[pos - OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry))]; 00181 } 00182 00187 inline Uint16 getFirstValue() const 00188 { 00189 return Data[0]; 00190 } 00191 00196 inline Uint16 getLastValue() const 00197 { 00198 return Data[Count - 1]; 00199 } 00200 00205 inline const Uint16 *getData() const 00206 { 00207 return Data; 00208 } 00209 00214 inline Uint16 getMinValue() const 00215 { 00216 return MinValue; 00217 } 00218 00223 inline Uint16 getMaxValue() const 00224 { 00225 return MaxValue; 00226 } 00227 00233 inline Uint32 getAbsMaxRange() const 00234 { 00235 return DicomImageClass::maxval(Bits, 0); 00236 } 00237 00242 inline int isValid() const 00243 { 00244 return Valid; 00245 } 00246 00251 inline const char *getExplanation() const 00252 { 00253 return (Explanation.empty()) ? OFstatic_cast(const char *, NULL) : Explanation.c_str(); 00254 } 00255 00262 virtual OFBool operator==(const DiBaseLUT &lut); 00263 00264 00265 protected: 00266 00273 DiBaseLUT(Uint16 *buffer, 00274 const Uint32 count = 0, 00275 const Uint16 bits = 0); 00276 00286 int compare(const DiBaseLUT *lut); 00287 00289 Uint32 Count; 00291 Uint16 FirstEntry; 00293 Uint16 Bits; 00294 00296 Uint16 MinValue; 00298 Uint16 MaxValue; 00299 00301 int Valid; 00302 00304 OFString Explanation; 00305 00307 const Uint16 *Data; 00309 Uint16 *DataBuffer; 00310 00311 00312 private: 00313 00314 // --- declarations to avoid compiler warnings 00315 00316 DiBaseLUT(const DiBaseLUT &); 00317 DiBaseLUT &operator=(const DiBaseLUT &); 00318 }; 00319 00320 00321 #endif 00322 00323 00324 /* 00325 * 00326 * CVS/RCS Log: 00327 * $Log: dibaslut.h,v $ 00328 * Revision 1.16 2005/12/08 16:47:32 meichel 00329 * Changed include path schema for all DCMTK header files 00330 * 00331 * Revision 1.15 2003/12/08 18:40:32 joergr 00332 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00333 * Removed leading underscore characters from preprocessor symbols (reserved 00334 * symbols). Updated CVS header. 00335 * 00336 * Revision 1.14 2003/06/12 15:08:34 joergr 00337 * Fixed inconsistent API documentation reported by Doxygen. 00338 * 00339 * Revision 1.13 2001/06/01 15:49:39 meichel 00340 * Updated copyright header 00341 * 00342 * Revision 1.12 2000/03/08 16:24:13 meichel 00343 * Updated copyright header. 00344 * 00345 * Revision 1.11 2000/03/06 18:17:59 joergr 00346 * Moved get-method to base class and made method virtual to avoid hiding of 00347 * methods (reported by Sun CC 4.2). 00348 * 00349 * Revision 1.10 1999/10/20 10:34:43 joergr 00350 * Enhanced method invertTable to distinguish between copy of LUT data and 00351 * original (referenced) LUT data. 00352 * 00353 * Revision 1.9 1999/09/30 11:37:08 joergr 00354 * Added methods to compare two lookup tables. 00355 * 00356 * Revision 1.8 1999/09/17 12:07:23 joergr 00357 * Added/changed/completed DOC++ style comments in the header files. 00358 * 00359 * Revision 1.7 1999/09/08 15:19:24 joergr 00360 * Completed implementation of setting inverse presentation LUT as needed 00361 * e.g. for DICOM print (invert 8->12 bits PLUT). 00362 * 00363 * Revision 1.6 1999/07/23 13:51:44 joergr 00364 * Changed comments/formatting. 00365 * 00366 * Revision 1.5 1999/05/03 11:09:27 joergr 00367 * Minor code purifications to keep Sun CC 2.0.1 quiet. 00368 * 00369 * Revision 1.4 1999/03/24 17:19:58 joergr 00370 * Added/Modified comments and formatting. 00371 * 00372 * Revision 1.3 1999/03/03 11:46:26 joergr 00373 * Added method to invert lookup table data (used for presentation state LUTs). 00374 * 00375 * Revision 1.2 1999/02/11 15:42:49 joergr 00376 * Removed unnecessary include statement. 00377 * 00378 * Revision 1.1 1999/02/03 17:45:38 joergr 00379 * Added base class for look-up tables (moved main functionality of class 00380 * DiLookupTable to DiBaseLUT). 00381 * 00382 * 00383 */