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: DicomLookupTable (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:26 $ 00022 * CVS/RCS Revision: $Revision: 1.26 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DILUPTAB_H 00031 #define DILUPTAB_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 #include "dcmtk/dcmdata/dctagkey.h" 00035 00036 #include "dcmtk/dcmimgle/dibaslut.h" 00037 #include "dcmtk/dcmimgle/diobjcou.h" 00038 00039 00040 /*------------------------* 00041 * forward declarations * 00042 *------------------------*/ 00043 00044 class DcmObject; 00045 class DcmUnsignedShort; 00046 class DcmLongString; 00047 class DiDocument; 00048 00049 00050 /*---------------------* 00051 * class declaration * 00052 *---------------------*/ 00053 00056 class DiLookupTable 00057 : public DiBaseLUT, 00058 public DiObjectCounter 00059 { 00060 00061 public: 00062 00072 DiLookupTable(const DiDocument *docu, 00073 const DcmTagKey &descriptor, 00074 const DcmTagKey &data, 00075 const DcmTagKey &explanation, 00076 const EL_BitsPerTableEntry descripMode = ELM_UseValue, 00077 EI_Status *status = NULL); 00078 00091 DiLookupTable(const DiDocument *docu, 00092 const DcmTagKey &sequence, 00093 const DcmTagKey &descriptor, 00094 const DcmTagKey &data, 00095 const DcmTagKey &explanation, 00096 const EL_BitsPerTableEntry descripMode = ELM_UseValue, 00097 const unsigned long pos = 0, 00098 unsigned long *card = NULL); 00099 00109 DiLookupTable(const DcmUnsignedShort &data, 00110 const DcmUnsignedShort &descriptor, 00111 const DcmLongString *explanation = NULL, 00112 const EL_BitsPerTableEntry descripMode = ELM_UseValue, 00113 const signed long first = -1, 00114 EI_Status *status = NULL); 00115 00122 DiLookupTable(Uint16 *buffer, 00123 const Uint32 count, 00124 const Uint16 bits); 00125 00128 virtual ~DiLookupTable(); 00129 00141 int invertTable(const int flag = 0x1); 00142 00155 int mirrorTable(const int flag = 0x1); 00156 00163 DiLookupTable *createInverseLUT() const; 00164 00175 int compareLUT(const DcmUnsignedShort &data, 00176 const DcmUnsignedShort &descriptor); 00177 00178 00185 virtual OFBool operator==(const DiBaseLUT &lut); 00186 00193 virtual OFBool operator==(const DiLookupTable &lut); 00194 00195 00196 protected: 00197 00208 void Init(const DiDocument *docu, 00209 DcmObject *obj, 00210 const DcmTagKey &descriptor, 00211 const DcmTagKey &data, 00212 const DcmTagKey &explanation, 00213 const EL_BitsPerTableEntry descripMode = ELM_UseValue, 00214 EI_Status *status = NULL); 00215 00223 void checkTable(unsigned long count, 00224 Uint16 bits, 00225 const EL_BitsPerTableEntry descripMode = ELM_UseValue, 00226 EI_Status *status = NULL); 00227 00238 void checkBits(const Uint16 bits, 00239 const Uint16 rightBits, 00240 const Uint16 wrongBits = 0, 00241 const EL_BitsPerTableEntry descripMode = ELM_UseValue); 00242 00243 private: 00244 00246 int OriginalBitsAllocated; 00248 void *OriginalData; 00249 00250 // --- declarations to avoid compiler warnings 00251 00252 DiLookupTable(const DiLookupTable &); 00253 DiLookupTable &operator=(const DiLookupTable &); 00254 }; 00255 00256 00257 #endif 00258 00259 00260 /* 00261 * 00262 * CVS/RCS Log: 00263 * $Log: diluptab.h,v $ 00264 * Revision 1.26 2010-10-14 13:16:26 joergr 00265 * Updated copyright header. Added reference to COPYRIGHT file. 00266 * 00267 * Revision 1.25 2007/03/16 11:56:06 joergr 00268 * Introduced new flag that allows to select how to handle the BitsPerTableEntry 00269 * value in the LUT descriptor (use, ignore or check). 00270 * 00271 * Revision 1.24 2005/12/08 16:47:45 meichel 00272 * Changed include path schema for all DCMTK header files 00273 * 00274 * Revision 1.23 2003/12/17 16:17:29 joergr 00275 * Added new compatibility flag that allows to ignore the third value of LUT 00276 * descriptors and to determine the bits per table entry automatically. 00277 * 00278 * Revision 1.22 2003/12/08 18:24:15 joergr 00279 * Removed leading underscore characters from preprocessor symbols (reserved 00280 * symbols). Updated CVS header. 00281 * 00282 * Revision 1.21 2003/06/12 15:08:34 joergr 00283 * Fixed inconsistent API documentation reported by Doxygen. 00284 * 00285 * Revision 1.20 2002/12/09 13:32:51 joergr 00286 * Renamed parameter/local variable to avoid name clashes with global 00287 * declaration left and/or right (used for as iostream manipulators). 00288 * 00289 * Revision 1.19 2001/06/01 15:49:43 meichel 00290 * Updated copyright header 00291 * 00292 * Revision 1.18 2000/07/07 13:42:30 joergr 00293 * Added support for LIN OD presentation LUT shape. 00294 * 00295 * Revision 1.17 2000/03/08 16:24:17 meichel 00296 * Updated copyright header. 00297 * 00298 * Revision 1.16 2000/03/06 18:19:36 joergr 00299 * Moved get-method to base class, renamed method and made method virtual to 00300 * avoid hiding of methods (reported by Sun CC 4.2). 00301 * 00302 * Revision 1.15 1999/11/24 11:13:46 joergr 00303 * Added method to mirror order of entries in look-up tables. 00304 * Enhanced comments for methods "inverting" the LUT values/entries. 00305 * 00306 * Revision 1.14 1999/11/03 12:52:08 joergr 00307 * Added copy constructor and assignment operator to avoid compiler warnings. 00308 * 00309 * Revision 1.13 1999/10/20 10:34:44 joergr 00310 * Enhanced method invertTable to distinguish between copy of LUT data and 00311 * original (referenced) LUT data. 00312 * 00313 * Revision 1.12 1999/09/30 11:37:09 joergr 00314 * Added methods to compare two lookup tables. 00315 * 00316 * Revision 1.11 1999/09/17 12:22:53 joergr 00317 * Added/changed/completed DOC++ style comments in the header files. 00318 * 00319 * Revision 1.10 1999/09/08 15:19:24 joergr 00320 * Completed implementation of setting inverse presentation LUT as needed 00321 * e.g. for DICOM print (invert 8->12 bits PLUT). 00322 * 00323 * Revision 1.9 1999/07/23 14:01:49 joergr 00324 * Added dummy method (no implementation yet) to create inverse LUTs. 00325 * 00326 * Revision 1.8 1999/05/03 11:09:28 joergr 00327 * Minor code purifications to keep Sun CC 2.0.1 quiet. 00328 * 00329 * Revision 1.7 1999/03/24 17:20:04 joergr 00330 * Added/Modified comments and formatting. 00331 * 00332 * Revision 1.6 1999/02/03 17:27:23 joergr 00333 * Added base class for look-up tables (moved main functionality of class 00334 * DiLookupTable to DiBaseLUT). 00335 * 00336 * Revision 1.5 1998/12/23 11:34:34 joergr 00337 * Changed behaviour of getLabel/Description/Explanation() methods: return 00338 * NULL if string empty, no empty string "". 00339 * 00340 * Revision 1.4 1998/12/22 14:24:36 joergr 00341 * Changed parameter type. 00342 * Added method getAbsMaxRange. 00343 * 00344 * Revision 1.3 1998/12/16 16:31:30 joergr 00345 * Added explanation string to LUT class (retrieved from dataset). 00346 * 00347 * Revision 1.2 1998/12/14 17:19:19 joergr 00348 * Added support for signed values as second entry in look-up tables 00349 * (= first value mapped). 00350 * 00351 * Revision 1.1 1998/11/27 15:10:21 joergr 00352 * Added copyright message. 00353 * Added support of object counter class. 00354 * Added constructors to use external modality transformations. 00355 * Added methods to support presentation LUTs and shapes. 00356 * 00357 * Revision 1.3 1998/07/01 08:39:22 joergr 00358 * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional 00359 * options), e.g. add copy constructors. 00360 * 00361 * Revision 1.2 1998/05/11 14:53:18 joergr 00362 * Added CVS/RCS header to each file. 00363 * 00364 * 00365 */