GDCM  2.2.6
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 
77  bool Decode(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const;
78 
79  LookupTable(LookupTable const &lut):Object(lut)
80  {
81  assert(0);
82  }
83 
85  bool GetBufferAsRGBA(unsigned char *rgba) const;
86 
88  const unsigned char *GetPointer() const;
89 
91  bool WriteBufferAsRGBA(const unsigned char *rgba);
92 
94  unsigned short GetBitSample() const { return BitSample; }
95 
97  bool Initialized() const;
98 
99 private:
101  void Encode(std::istream &is, std::ostream &os);
102 
103 protected:
104  LookupTableInternal *Internal;
105  unsigned short BitSample; // refer to the pixel type (not the bit size of LUT)
106  bool IncompleteLUT:1;
107 };
108 
109 } // end namespace gdcm
110 
111 #endif //GDCMLOOKUPTABLE_H
LookupTable class.
Definition: gdcmLookupTable.h:29
Definition: gdcmTerminal.h:40
unsigned short BitSample
Definition: gdcmLookupTable.h:105
Definition: gdcmTerminal.h:43
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Definition: gdcmLookupTable.h:36
Object.
Definition: gdcmObject.h:36
Definition: gdcmLookupTable.h:34
LookupTableInternal * Internal
Definition: gdcmLookupTable.h:104
Definition: gdcmLookupTable.h:35
LookupTable(LookupTable const &lut)
Definition: gdcmLookupTable.h:79
void Print(std::ostream &) const
Definition: gdcmLookupTable.h:42
Definition: gdcmTerminal.h:41
unsigned short GetBitSample() const
return the bit sample
Definition: gdcmLookupTable.h:94

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo