Reversible compression of medical images