After saving DICOM images using RLE encoding, I sometimes cannot display those saved images in ImageEn.
The issue with my saved images is that RLE stream size for the RLE high bytes is larger compared to the RLE stream size for the low bytes. Thus, when reading the low bytes, the existing check:
if imageLength div 2 + Stream.Position > Stream.Size then begin Progress.Aborting^ := true; exit; end;
will always trigger.
Is it safe to change the check to this instead, which takes into account the bytes already read for the RLE high bytes?
if Stream.Position + (ImageLength - Stream.Position + base + idxArray[0] ) > Stream.Size ...