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
00031
00032
00033
00034
#ifndef DIBASLUT_H
00035
#define DIBASLUT_H
00036
00037
#include "osconfig.h"
00038
#include "ofstring.h"
00039
#include "ofcast.h"
00040
00041
#include "diutils.h"
00042
00043
00044
00045
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
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
00315
00316
DiBaseLUT(
const DiBaseLUT &);
00317
DiBaseLUT &operator=(
const DiBaseLUT &);
00318 };
00319
00320
00321
#endif
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