Public Member Functions | |
DcmRLEEncoder (int doPad) | |
default constructor | |
~DcmRLEEncoder () | |
destructor | |
void | add (unsigned char ch) |
this method adds one byte to the byte stream to be compressed with the RLE compressor. | |
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. | |
void | flush () |
this method finalizes the compressed RLE stream, i.e. | |
size_t | size () const |
returns the size of compressed RLE stream in bytes. | |
OFBool | fail () const |
returns true if the RLE compressor has run out of memory. | |
void | write (void *target) const |
copies the compressed RLE byte stream into a target array of at least size() bytes. | |
void | write (DcmEncoderOutputStream &os) const |
copies the compressed RLE byte stream into an output stream | |
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. | |
Private Attributes | |
int | fail_ |
this flag indicates a failure of the RLE codec. | |
int | pad_ |
this flag indicates whether the RLE codec must pad encoded data to an even number of bytes (as required by DICOM). | |
unsigned char * | currentBlock_ |
this member points to a block of size DcmRLEEncoder_BLOCKSIZE (unless fail_ is true). | |
size_t | offset_ |
contains the number of bytes already written the the memory block pointed to by currentBlock_. | |
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. | |
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. | |
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_. |
The class is loosely based on an implementation by Phil Norman.
Definition at line 68 of file dcrleenc.h.
|
default constructor
Definition at line 75 of file dcrleenc.h. References currentBlock_, fail_, and RLE_buff_. |
|
this method adds a block of bytes to the byte stream to be compressed with the RLE compressor.
Definition at line 185 of file dcrleenc.h. References add(). |
|
this method adds one byte to the byte stream to be compressed with the RLE compressor.
Definition at line 108 of file dcrleenc.h. References fail_, move(), RLE_bindex_, RLE_buff_, RLE_pcount_, and RLE_prev_. Referenced by add(). |
|
returns true if the RLE compressor has run out of memory. In this case, no output has been created. Definition at line 270 of file dcrleenc.h. References fail_. |
|
this method finalizes the compressed RLE stream, i.e. flushes all pending literal or repeat runs. This method can be called at any time; however, it must be called before size() or write() can be used. Intermediate calls should be avoided since they possibly decrease the compression ratio. Definition at line 199 of file dcrleenc.h. References fail_, move(), RLE_bindex_, RLE_buff_, RLE_pcount_, and RLE_prev_. |
|
this method moves the given number of bytes from buff_ to currentBlock_ and "flushes" currentBlock_ to blockList_ if necessary.
Definition at line 350 of file dcrleenc.h. References blockList_, currentBlock_, fail_, offset_, OFList< T >::push_back(), and RLE_buff_. |
|
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.
Definition at line 260 of file dcrleenc.h. References blockList_, offset_, pad_, and OFList< T >::size(). |
|
copies the compressed RLE byte stream into an output stream
Definition at line 312 of file dcrleenc.h. References OFList< T >::begin(), blockList_, currentBlock_, OFList< T >::end(), fail_, offset_, pad_, and OFList< T >::size(). |
|
copies the compressed RLE byte stream into a target array of at least size() bytes.
Definition at line 279 of file dcrleenc.h. References OFList< T >::begin(), blockList_, currentBlock_, OFList< T >::end(), fail_, offset_, pad_, and OFList< T >::size(). |
|
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. Definition at line 401 of file dcrleenc.h. Referenced by move(), size(), write(), and ~DcmRLEEncoder(). |
|
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 Definition at line 389 of file dcrleenc.h. Referenced by DcmRLEEncoder(), move(), write(), and ~DcmRLEEncoder(). |
|
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. Definition at line 377 of file dcrleenc.h. Referenced by add(), DcmRLEEncoder(), fail(), flush(), move(), and write(). |
|
contains the number of bytes already written the the memory block pointed to by currentBlock_. Value is always less than DcmRLEEncoder_BLOCKSIZE. Definition at line 395 of file dcrleenc.h. |
|
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 Definition at line 383 of file dcrleenc.h. |
|
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 Definition at line 412 of file dcrleenc.h. |