gdcmLookupTable.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#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, // Keep RED == 0
GREEN,
BLUE,
GRAY,
UNKNOWN
} LookupTableType;
LookupTable();
~LookupTable() override;
void Print(std::ostream &) const override;
void Allocate( unsigned short bitsample = 8 );
//TODO: check to see if length should be unsigned short, unsigned int, or whatever
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)
{
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; // refer to the pixel type (not the bit size of LUT)
bool IncompleteLUT:1;
};
} // end namespace gdcm
#endif //GDCMLOOKUPTABLE_H
gdcm::LookupTable::GetLUTDescriptor
void GetLUTDescriptor(LookupTableType type, unsigned short &length, unsigned short &subscript, unsigned short &bitsize) const
gdcm::LookupTable::LookupTableType
LookupTableType
Definition gdcmLookupTable.h:32
gdcm::LookupTable::GRAY
@ GRAY
Definition gdcmLookupTable.h:36
gdcm::LookupTable::BLUE
@ BLUE
Definition gdcmLookupTable.h:35
gdcm::LookupTable::UNKNOWN
@ UNKNOWN
Definition gdcmLookupTable.h:37
gdcm::LookupTable::GREEN
@ GREEN
Definition gdcmLookupTable.h:34
gdcm::LookupTable::RED
@ RED
Definition gdcmLookupTable.h:33
gdcm::LookupTable::BitSample
unsigned short BitSample
Definition gdcmLookupTable.h:111
gdcm::LookupTable::SetBlueLUT
void SetBlueLUT(const unsigned char *blue, unsigned int length)
gdcm::LookupTable::SetLUT
virtual void SetLUT(LookupTableType type, const unsigned char *array, unsigned int length)
gdcm::LookupTable::InitializeGreenLUT
void InitializeGreenLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
gdcm::LookupTable::LookupTable
LookupTable()
gdcm::LookupTable::Decode
void Decode(std::istream &is, std::ostream &os) const
Decode the LUT.
gdcm::LookupTable::SetGreenLUT
void SetGreenLUT(const unsigned char *green, unsigned int length)
gdcm::LookupTable::WriteBufferAsRGBA
bool WriteBufferAsRGBA(const unsigned char *rgba)
Write the LUT as RGBA.
gdcm::LookupTable::SetRedLUT
void SetRedLUT(const unsigned char *red, unsigned int length)
gdcm::LookupTable::GetBufferAsRGBA
bool GetBufferAsRGBA(unsigned char *rgba) const
return the LUT as RGBA buffer
gdcm::LookupTable::Decode8
bool Decode8(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const
Decode into RGB 8 bits space.
gdcm::LookupTable::Initialized
bool Initialized() const
return whether the LUT has been initialized
gdcm::LookupTable::InitializeRedLUT
void InitializeRedLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
RED / GREEN / BLUE specific:
gdcm::LookupTable::IsRGB8
bool IsRGB8() const
Return whether 16 bits LUT is in RGB 8 bits space.
gdcm::LookupTable::GetLUT
void GetLUT(LookupTableType type, unsigned char *array, unsigned int &length) const
gdcm::LookupTable::Decode
bool Decode(char *outputbuffer, size_t outlen, const char *inputbuffer, size_t inlen) const
gdcm::LookupTable::InitializeBlueLUT
void InitializeBlueLUT(unsigned short length, unsigned short subscript, unsigned short bitsize)
gdcm::LookupTable::Clear
void Clear()
Clear the LUT.
gdcm::LookupTable::LookupTable
LookupTable(LookupTable const &lut)
Definition gdcmLookupTable.h:85
gdcm::LookupTable::Internal
LookupTableInternal * Internal
Definition gdcmLookupTable.h:110
gdcm::LookupTable::~LookupTable
~LookupTable() override
gdcm::LookupTable::Allocate
void Allocate(unsigned short bitsample=8)
Allocate the LUT.
gdcm::LookupTable::InitializeLUT
void InitializeLUT(LookupTableType type, unsigned short length, unsigned short subscript, unsigned short bitsize)
Generic interface:
gdcm::LookupTable::IncompleteLUT
bool IncompleteLUT
Definition gdcmLookupTable.h:112
gdcm::LookupTable::GetPointer
const unsigned char * GetPointer() const
return a raw pointer to the LUT
gdcm::LookupTable::Print
void Print(std::ostream &) const override
gdcm::LookupTable::GetLUTLength
unsigned int GetLUTLength(LookupTableType type) const
gdcm::LookupTable::GetBitSample
unsigned short GetBitSample() const
return the bit sample
Definition gdcmLookupTable.h:100
gdcm::Object::Object
Object()
Definition gdcmObject.h:42
gdcmObject.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21