Idea: take advantage of SAXS/WAXS images all looking the same (mpeg idea) but use a constant image to subtract (perhaps with a scale factor for shot-intensity). Use the raw 16-bit data. How to handle subtraction of gain-switched pixels?
example bits:
UGDDDD
14 bits stored in a 16 bit word
U=unused
G=gain
D=data
could reuse lowest bits of data: they might be noise?
if pixel is in the same range as reference image: D(compressed)=D(shot)-D(ref)
(have to worry about sign-bit: can become negative)
if pixel is not in the same range, store it as-is and mark it as "unsubtracted" with one of the extra bits
try using "gzip" and tell gzip that we're compressing 16-bit numbers
possible future feature? D(compressed)=D(shot)-scalefactor*D(ref) (scalefactor represents brightness of each shot)
could make it better-but-lossy by eliminating low-ADC bits?