GDCM  2.2.0
gdcmLookupTable.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 
15 #ifndef GDCMLOOKUPTABLE_H
16 #define GDCMLOOKUPTABLE_H
17 
18 #include "gdcmTypes.h"
19 #include "gdcmObject.h"
20 #include <stdlib.h>
21 
22 namespace gdcm
23 {
24 
25 class LookupTableInternal;
30 {
31 public:
32  typedef enum {
33  RED = 0, // Keep RED == 0
37  UNKNOWN
38  } LookupTableType;
39 
40  LookupTable();
41  ~LookupTable();
42  void Print(std::ostream &) const {}
43 
45  void Allocate( unsigned short bitsample = 8 );
47  //TODO: check to see if length should be unsigned short, unsigned int, or whatever
48  void InitializeLUT(LookupTableType type, unsigned short length,
49  unsigned short subscript, unsigned short bitsize);
50  unsigned int GetLUTLength(LookupTableType type) const;
51  virtual void SetLUT(LookupTableType type, const unsigned char *array,
52  unsigned int length);
53  void GetLUT(LookupTableType type, unsigned char *array, unsigned int &length) const;
54  void GetLUTDescriptor(LookupTableType type, unsigned short &length,
55  unsigned short &subscript, unsigned short &bitsize) const;
56 
58  void InitializeRedLUT(unsigned short length, unsigned short subscript,
59  unsigned short bitsize);
60  void SetRedLUT(const unsigned char *red, unsigned int length);
61  void InitializeGreenLUT(unsigned short length, unsigned short subscript,
62  unsigned short bitsize);
63  void SetGreenLUT(const unsigned char *green, unsigned int length);
64  void InitializeBlueLUT(unsigned short length, unsigned short subscript,
65  unsigned short bitsize);
66  void SetBlueLUT(const unsigned char *blue, unsigned int length);
67 
69  void Clear();
70 
72  void Decode(std::istream &is, std::ostream &os) const;
73 
74  LookupTable(LookupTable const &lut):Object(lut)
75  {
76  assert(0);
77  }
78 
80  bool GetBufferAsRGBA(unsigned char *rgba) const;
81 
83  const unsigned char *GetPointer() const;
84 
86  bool WriteBufferAsRGBA(const unsigned char *rgba);
87 
89  unsigned short GetBitSample() const { return BitSample; }
90 
92  bool Initialized() const;
93 
94 private:
96  void Encode(std::istream &is, std::ostream &os);
97 
98 protected:
99  LookupTableInternal *Internal;
100  unsigned short BitSample; // refer to the pixel type (not the bit size of LUT)
101  bool IncompleteLUT:1;
102 };
103 
104 } // end namespace gdcm
105 
106 #endif //GDCMLOOKUPTABLE_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo