Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GDCMLOOKUPTABLE_H
00017 #define GDCMLOOKUPTABLE_H
00018
00019 #include "gdcmTypes.h"
00020 #include "gdcmObject.h"
00021 #include <stdlib.h>
00022
00023 namespace gdcm
00024 {
00025
00026 class LookupTableInternal;
00030 class GDCM_EXPORT LookupTable : public Object
00031 {
00032 public:
00033 typedef enum {
00034 RED = 0,
00035 GREEN,
00036 BLUE,
00037 GRAY,
00038 UNKNOWN
00039 } LookupTableType;
00040
00041 LookupTable();
00042 ~LookupTable();
00043 void Print(std::ostream &) const {}
00044
00046 void Allocate( unsigned short bitsample = 8 );
00048 void InitializeLUT(LookupTableType type, unsigned short length,
00049 unsigned short subscript, unsigned short bitsize);
00050 unsigned int GetLUTLength(LookupTableType type) const;
00051 virtual void SetLUT(LookupTableType type, const unsigned char *array,
00052 unsigned int length);
00053 void GetLUT(LookupTableType type, unsigned char *array, unsigned int &length) const;
00054 void GetLUTDescriptor(LookupTableType type, unsigned short &length,
00055 unsigned short &subscript, unsigned short &bitsize) const;
00056
00058 void InitializeRedLUT(unsigned short length, unsigned short subscript,
00059 unsigned short bitsize);
00060 void SetRedLUT(const unsigned char *red, unsigned int length);
00061 void InitializeGreenLUT(unsigned short length, unsigned short subscript,
00062 unsigned short bitsize);
00063 void SetGreenLUT(const unsigned char *green, unsigned int length);
00064 void InitializeBlueLUT(unsigned short length, unsigned short subscript,
00065 unsigned short bitsize);
00066 void SetBlueLUT(const unsigned char *blue, unsigned int length);
00067
00069 void Clear();
00070
00072 void Decode(std::istream &is, std::ostream &os) const;
00073
00074 LookupTable(LookupTable const &lut):Object(lut)
00075 {
00076 assert(0);
00077 }
00078
00080 bool GetBufferAsRGBA(unsigned char *rgba) const;
00081
00083 const unsigned char *GetPointer() const;
00084
00086 bool WriteBufferAsRGBA(const unsigned char *rgba);
00087
00089 unsigned short GetBitSample() const { return BitSample; }
00090
00092 bool Initialized() const;
00093
00094 private:
00095 protected:
00096 LookupTableInternal *Internal;
00097 unsigned short BitSample;
00098 bool IncompleteLUT:1;
00099 };
00100
00101 }
00102
00103 #endif //GDCMLOOKUPTABLE_H