This question is regarding the RLE algorithm used to compress images ( in this case encapsulated in a DICOM file)
Say I have a pixel data 50 pixel by 50 pixel. It represents a grayscale image with a single color component of 8 bits ( basically one byte is single 8 bit pixel ... this assumption just for sake of simplicity though has no bearing on question actually - would apply to color images as well)
To perform a run length encoding of this image the "runs" are defined as follows ( as per the standard)
Replicate run ( A sequence of identical bytes) - encoded as a two-byte code < -count + 1 > where count = the number of identical bytes in the run ( 2 <= count <= 128 )
Literal Run ( a non-repetitive sequence of bytes) - encoded as a two byte code < count - 1 > where count = number of bytes in the sequence (1 <= count <= 128 )
The questions:
Can the Replicate run and the Literal Run transcend row and column boundaries ? I mean. In the example of pixel data 50X50 pixels - if we have first two rows of white pixels. Is is legitimate RLE to encode first two rows as a replicate run of 100 bytes ( -99 ,< value of white pixel> ) - or should they broken up in two runs of 50 pixels each ?
Is there any de-facto protocol to start a new run on every new row ?