00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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
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
00311
00312 DiBaseLUT(const DiBaseLUT &);
00313 DiBaseLUT &operator=(const DiBaseLUT &);
00314 };
00315
00316
00317 #endif
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385