GDCM 3.0.24
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
22namespace gdcm
23{
24
25class LookupTableInternal;
30{
31public:
32 typedef enum {
33 RED = 0, // Keep RED == 0
37 UNKNOWN
38 } LookupTableType;
39
41 ~LookupTable() override;
42 void Print(std::ostream &) const override;
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
80 bool IsRGB8() const;
81
83 bool Decode8(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const;
84
86 {
87 assert(0);
88 }
89
91 bool GetBufferAsRGBA(unsigned char *rgba) const;
92
94 const unsigned char *GetPointer() const;
95
97 bool WriteBufferAsRGBA(const unsigned char *rgba);
98
100 unsigned short GetBitSample() const { return BitSample; }
101
103 bool Initialized() const;
104
105private:
107 void Encode(std::istream &is, std::ostream &os);
108
109protected:
110 LookupTableInternal *Internal;
111 unsigned short BitSample; // refer to the pixel type (not the bit size of LUT)
113};
114
115} // end namespace gdcm
116
117#endif //GDCMLOOKUPTABLE_H
LookupTable class.
Definition gdcmLookupTable.h:30
void GetLUTDescriptor(LookupTableType type, unsigned short &length, unsigned short &subscript, unsigned short &bitsize) const
LookupTableType
Definition gdcmLookupTable.h:32
@ GRAY
Definition gdcmLookupTable.h:36
@ BLUE
Definition gdcmLookupTable.h:35
@ GREEN
Definition gdcmLookupTable.h:34
unsigned short BitSample
Definition gdcmLookupTable.h:111
void SetBlueLUT(const unsigned char *blue, unsigned int length)
virtual void SetLUT(LookupTableType type, const unsigned char *array, unsigned int length)
void InitializeGreenLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
void Decode(std::istream &is, std::ostream &os) const
Decode the LUT.
void SetGreenLUT(const unsigned char *green, unsigned int length)
bool WriteBufferAsRGBA(const unsigned char *rgba)
Write the LUT as RGBA.
void SetRedLUT(const unsigned char *red, unsigned int length)
bool GetBufferAsRGBA(unsigned char *rgba) const
return the LUT as RGBA buffer
bool Decode8(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const
Decode into RGB 8 bits space.
bool Initialized() const
return whether the LUT has been initialized
void InitializeRedLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
RED / GREEN / BLUE specific:
bool IsRGB8() const
Return whether 16 bits LUT is in RGB 8 bits space.
void GetLUT(LookupTableType type, unsigned char *array, unsigned int &length) const
bool Decode(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const
void InitializeBlueLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
void Clear()
Clear the LUT.
LookupTable(LookupTable const &lut)
Definition gdcmLookupTable.h:85
LookupTableInternal * Internal
Definition gdcmLookupTable.h:110
~LookupTable() override
void Allocate(unsigned short bitsample=8)
Allocate the LUT.
void InitializeLUT(LookupTableType type, unsigned short length, unsigned short subscript, unsigned short bitsize)
Generic interface:
bool IncompleteLUT
Definition gdcmLookupTable.h:112
const unsigned char * GetPointer() const
return a raw pointer to the LUT
void Print(std::ostream &) const override
unsigned int GetLUTLength(LookupTableType type) const
unsigned short GetBitSample() const
return the bit sample
Definition gdcmLookupTable.h:100
Object.
Definition gdcmObject.h:37
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21