DCMTK
Version 3.6.1 20170228
OFFIS DICOM Toolkit
|
this class implements an RLE compressor conforming to the DICOM standard. More...
Public Member Functions | |
DcmRLEEncoder (int doPad) | |
default constructor More... | |
~DcmRLEEncoder () | |
destructor | |
void | add (unsigned char ch) |
this method adds one byte to the byte stream to be compressed with the RLE compressor. More... | |
void | add (const unsigned char *buf, size_t bufcount) |
this method adds a block of bytes to the byte stream to be compressed with the RLE compressor. More... | |
void | flush () |
this method finalizes the compressed RLE stream, i.e. More... | |
size_t | size () const |
returns the size of compressed RLE stream in bytes. More... | |
OFBool | fail () const |
returns true if the RLE compressor has run out of memory. More... | |
void | write (void *target) const |
copies the compressed RLE byte stream into a target array of at least size() bytes. More... | |
void | write (DcmEncoderOutputStream &os) const |
copies the compressed RLE byte stream into an output stream More... | |
Private Member Functions | |
DcmRLEEncoder (const DcmRLEEncoder &) | |
private undefined copy constructor | |
DcmRLEEncoder & | operator= (const DcmRLEEncoder &) |
private undefined copy assignment operator | |
void | move (size_t numberOfBytes) |
this method moves the given number of bytes from buff_ to currentBlock_ and "flushes" currentBlock_ to blockList_ if necessary. More... | |
Private Attributes | |
int | fail_ |
this flag indicates a failure of the RLE codec. More... | |
int | pad_ |
this flag indicates whether the RLE codec must pad encoded data to an even number of bytes (as required by DICOM). More... | |
unsigned char * | currentBlock_ |
this member points to a block of size DcmRLEEncoder_BLOCKSIZE (unless fail_ is true). More... | |
size_t | offset_ |
contains the number of bytes already written the the memory block pointed to by currentBlock_. More... | |
OFList< unsigned char * > | blockList_ |
this member contains a list of memory blocks of size DcmRLEEncoder_BLOCKSIZE which already have been filled with encoded RLE data. More... | |
unsigned char * | RLE_buff_ |
this member points to a buffer of 132 bytes that is used by the RLE encoding algorithm. | |
int | RLE_prev_ |
value of the last byte fed to the RLE compressor. More... | |
int | RLE_pcount_ |
repeat counter, for RLE compressor may temporarily become negative, guaranteed to be >= 0 between method calls. | |
unsigned int | RLE_bindex_ |
index of next unused byte in RLE_buff_. | |
this class implements an RLE compressor conforming to the DICOM standard.
The class is loosely based on an implementation by Phil Norman.
|
inline |
default constructor
doPad | if true, RLE codec will pad output data to even number of bytes |
|
inline |
this method adds one byte to the byte stream to be compressed with the RLE compressor.
ch | byte to be added |
|
inline |
this method adds a block of bytes to the byte stream to be compressed with the RLE compressor.
buf | buffer to be added |
bufcount | number of bytes in buffer |
|
inline |
returns true if the RLE compressor has run out of memory.
In this case, no output has been created.
|
inline |
|
inlineprivate |
this method moves the given number of bytes from buff_ to currentBlock_ and "flushes" currentBlock_ to blockList_ if necessary.
numberOfBytes | number of bytes to copy |
|
inline |
returns the size of compressed RLE stream in bytes.
The size is guaranteed to be an even number of bytes (padded with a trailing zero byte as required by DICOM if necessary). This method may only be called after flush() has been executed to finalize the compressed stream.
|
inline |
|
inline |
copies the compressed RLE byte stream into an output stream
os | output stream |
References DcmEncoderOutputStream::write().
|
private |
this member contains a list of memory blocks of size DcmRLEEncoder_BLOCKSIZE which already have been filled with encoded RLE data.
The current block (pointed to by currentBlock_) is not contained in this list.
|
private |
this member points to a block of size DcmRLEEncoder_BLOCKSIZE (unless fail_ is true).
This is the current block of data to which the RLE stream is written
|
private |
this flag indicates a failure of the RLE codec.
Once a failure is flagged, the codec will consume all input and not produce any more output. A failure status can only be caused by an out-of-memory condition.
|
private |
contains the number of bytes already written the the memory block pointed to by currentBlock_.
Value is always less than DcmRLEEncoder_BLOCKSIZE.
|
private |
this flag indicates whether the RLE codec must pad encoded data to an even number of bytes (as required by DICOM).
True if padding is required, false otherwise
|
private |
value of the last byte fed to the RLE compressor.
This byte is not yet stored in the RLE_buff_ buffer. Type is int because this allows an "impossible" -1 as default value