#ifndef GDCMLOOKUPTABLE_H
#define GDCMLOOKUPTABLE_H
#include "gdcmTypes.h"
#include "gdcmObject.h"
#include <stdlib.h>
namespace gdcm
{
class LookupTableInternal;
class GDCM_EXPORT LookupTable : public Object
{
public:
typedef enum {
RED = 0, GREEN,
BLUE,
GRAY,
UNKNOWN
} LookupTableType;
LookupTable();
~LookupTable() override;
void Print(std::ostream &) const override;
void Allocate( unsigned short bitsample = 8 );
void InitializeLUT(LookupTableType type, unsigned short length,
unsigned short subscript, unsigned short bitsize);
unsigned int GetLUTLength(LookupTableType type) const;
virtual void SetLUT(LookupTableType type, const unsigned char *array,
unsigned int length);
void GetLUT(LookupTableType type, unsigned char *array, unsigned int &length) const;
void GetLUTDescriptor(LookupTableType type, unsigned short &length,
unsigned short &subscript, unsigned short &bitsize) const;
void InitializeRedLUT(unsigned short length, unsigned short subscript,
unsigned short bitsize);
void SetRedLUT(const unsigned char *red, unsigned int length);
void InitializeGreenLUT(unsigned short length, unsigned short subscript,
unsigned short bitsize);
void SetGreenLUT(const unsigned char *green, unsigned int length);
void InitializeBlueLUT(unsigned short length, unsigned short subscript,
unsigned short bitsize);
void SetBlueLUT(const unsigned char *blue, unsigned int length);
void Clear();
void Decode(std::istream &is, std::ostream &os) const;
bool Decode(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const;
bool IsRGB8() const;
bool Decode8(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const;
LookupTable(LookupTable const &lut):Object(lut), Internal(nullptr), BitSample(0), IncompleteLUT(false)
{
gdcm_assert(0);
}
bool GetBufferAsRGBA(unsigned char *rgba) const;
const unsigned char *GetPointer() const;
bool WriteBufferAsRGBA(const unsigned char *rgba);
unsigned short GetBitSample() const { return BitSample; }
bool Initialized() const;
private:
void Encode(std::istream &is, std::ostream &os);
protected:
LookupTableInternal *Internal;
unsigned short BitSample; bool IncompleteLUT:1;
};
}
#endif