OFFIS DCMTK  Version 3.6.0
dibaslut.h
1 /*
2  *
3  * Copyright (C) 1996-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmimgle
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomBaseLUT (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:25 $
22  * CVS/RCS Revision: $Revision: 1.18 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIBASLUT_H
31 #define DIBASLUT_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/ofstring.h"
35 #include "dcmtk/ofstd/ofcast.h"
36 
37 #include "dcmtk/dcmimgle/diutils.h"
38 
39 
40 /*---------------------*
41  * macro definitions *
42  *---------------------*/
43 
44 #define MIN_TABLE_ENTRY_SIZE 8
45 #define MAX_TABLE_ENTRY_SIZE 16
46 #define MAX_TABLE_ENTRY_COUNT 65536
47 
48 
49 /*---------------------*
50  * class declaration *
51  *---------------------*/
52 
55 class DiBaseLUT
56 {
57 
58  public:
59 
65  DiBaseLUT(const Uint32 count = 0,
66  const Uint16 bits = 0);
67 
70  virtual ~DiBaseLUT();
71 
76  inline Uint32 getCount() const
77  {
78  return Count;
79  }
80 
85  inline Uint16 getBits() const
86  {
87  return Bits;
88  }
89 
98  inline Uint32 getFirstEntry(const Uint32 = 0) const
99  {
100  return FirstEntry;
101  }
102 
111  inline Sint32 getFirstEntry(const Sint32) const
112  {
113  return OFstatic_cast(Sint16, FirstEntry);
114  }
115 
124  inline Uint32 getLastEntry(const Uint32 = 0) const
125  {
126  return FirstEntry + Count - 1;
127  }
128 
137  inline Sint32 getLastEntry(const Sint32) const
138  {
139  return OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry)) + Count - 1;
140  }
141 
148  inline Uint16 getValue(const Uint16 pos) const
149  {
150  return Data[pos];
151  }
152 
161  inline Uint16 getValue(const Uint32 pos) const
162  {
163  return Data[pos - FirstEntry];
164  }
165 
174  inline Uint16 getValue(const Sint32 pos) const
175  {
176  return Data[pos - OFstatic_cast(Sint32, OFstatic_cast(Sint16, FirstEntry))];
177  }
178 
183  inline Uint16 getFirstValue() const
184  {
185  return Data[0];
186  }
187 
192  inline Uint16 getLastValue() const
193  {
194  return Data[Count - 1];
195  }
196 
201  inline const Uint16 *getData() const
202  {
203  return Data;
204  }
205 
210  inline Uint16 getMinValue() const
211  {
212  return MinValue;
213  }
214 
219  inline Uint16 getMaxValue() const
220  {
221  return MaxValue;
222  }
223 
229  inline Uint32 getAbsMaxRange() const
230  {
231  return DicomImageClass::maxval(Bits, 0);
232  }
233 
238  inline int isValid() const
239  {
240  return Valid;
241  }
242 
247  inline const char *getExplanation() const
248  {
249  return (Explanation.empty()) ? OFstatic_cast(const char *, NULL) : Explanation.c_str();
250  }
251 
258  virtual OFBool operator==(const DiBaseLUT &lut);
259 
260 
261  protected:
262 
269  DiBaseLUT(Uint16 *buffer,
270  const Uint32 count = 0,
271  const Uint16 bits = 0);
272 
282  int compare(const DiBaseLUT *lut);
283 
285  Uint32 Count;
287  Uint16 FirstEntry;
289  Uint16 Bits;
290 
292  Uint16 MinValue;
294  Uint16 MaxValue;
295 
297  int Valid;
298 
301 
303  const Uint16 *Data;
305  Uint16 *DataBuffer;
306 
307 
308  private:
309 
310  // --- declarations to avoid compiler warnings
311 
312  DiBaseLUT(const DiBaseLUT &);
313  DiBaseLUT &operator=(const DiBaseLUT &);
314 };
315 
316 
317 #endif
318 
319 
320 /*
321  *
322  * CVS/RCS Log:
323  * $Log: dibaslut.h,v $
324  * Revision 1.18 2010-10-14 13:16:25 joergr
325  * Updated copyright header. Added reference to COPYRIGHT file.
326  *
327  * Revision 1.17 2010-10-05 15:26:28 joergr
328  * Fixed various Doxygen API documentation issues.
329  *
330  * Revision 1.16 2005/12/08 16:47:32 meichel
331  * Changed include path schema for all DCMTK header files
332  *
333  * Revision 1.15 2003/12/08 18:40:32 joergr
334  * Adapted type casts to new-style typecast operators defined in ofcast.h.
335  * Removed leading underscore characters from preprocessor symbols (reserved
336  * symbols). Updated CVS header.
337  *
338  * Revision 1.14 2003/06/12 15:08:34 joergr
339  * Fixed inconsistent API documentation reported by Doxygen.
340  *
341  * Revision 1.13 2001/06/01 15:49:39 meichel
342  * Updated copyright header
343  *
344  * Revision 1.12 2000/03/08 16:24:13 meichel
345  * Updated copyright header.
346  *
347  * Revision 1.11 2000/03/06 18:17:59 joergr
348  * Moved get-method to base class and made method virtual to avoid hiding of
349  * methods (reported by Sun CC 4.2).
350  *
351  * Revision 1.10 1999/10/20 10:34:43 joergr
352  * Enhanced method invertTable to distinguish between copy of LUT data and
353  * original (referenced) LUT data.
354  *
355  * Revision 1.9 1999/09/30 11:37:08 joergr
356  * Added methods to compare two lookup tables.
357  *
358  * Revision 1.8 1999/09/17 12:07:23 joergr
359  * Added/changed/completed DOC++ style comments in the header files.
360  *
361  * Revision 1.7 1999/09/08 15:19:24 joergr
362  * Completed implementation of setting inverse presentation LUT as needed
363  * e.g. for DICOM print (invert 8->12 bits PLUT).
364  *
365  * Revision 1.6 1999/07/23 13:51:44 joergr
366  * Changed comments/formatting.
367  *
368  * Revision 1.5 1999/05/03 11:09:27 joergr
369  * Minor code purifications to keep Sun CC 2.0.1 quiet.
370  *
371  * Revision 1.4 1999/03/24 17:19:58 joergr
372  * Added/Modified comments and formatting.
373  *
374  * Revision 1.3 1999/03/03 11:46:26 joergr
375  * Added method to invert lookup table data (used for presentation state LUTs).
376  *
377  * Revision 1.2 1999/02/11 15:42:49 joergr
378  * Removed unnecessary include statement.
379  *
380  * Revision 1.1 1999/02/03 17:45:38 joergr
381  * Added base class for look-up tables (moved main functionality of class
382  * DiLookupTable to DiBaseLUT).
383  *
384  *
385  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2