A method for compression of raw CT data from a CT scanner, comprising the steps of: a) Input of data S from the CT scanner; b) Selection of a model for predicting the reference values H based on a history of reconstructed data S"; c) Calculation of the differences D between the input data S and the reference values H; d) Comparison of the actual compression ratio with a target compression ratio; e) If the actual compression ratio is less than the target compression ratio, perform a lossy compression comprising: e.a) Calculation of lossy differences D' by removing of R least significant bits from the differences D; e.b) Filling up of the lossy differences D' with R predetermined least significant bits; e.c) Calculation of first approximation values S' by adding the lossy differences D' to the reference values H wherein S' is expressed with one more most significant bit than the input data S; e.d) Calculation of an overflow handled value S" from the first approximation values S' further comprising the steps of: e.d.a) If the MSB of S' = "0", then calculation of S" by removing the MSB from S'; e.d.b) If the MSB of S' <> "0" and D' >= 0, then setting S" to a predetermined maximum sample value; e.d.c) If the MSB of S' <> "0" and D' < 0, then setting S" to zero; e.e) Storing of S" in said history; f) Encoding of D if step e) has been skipped, otherwise encoding of D' g) Output of the compressed values of the differences D if step e) has been skipped, otherwise Output of the compressed values of the lossy differences D'; a) Input of data S from the CT scanner; b) Selection of a model for predicting the reference values H based on a history of reconstructed data S"; c) Calculation of the differences D between the input data S and the reference values H; d) Comparison of the actual compression ratio with a target compression ratio; e) If the actual compression ratio is less than the target compression ratio, perform a lossy compression comprising: e.a) Calculation of lossy differences D' by removing of R least significant bits from the differences D; e.b) Filling up of the lossy differences D' with R predetermined least significant bits; e.c) Calculation of first approximation values S' by adding the lossy differences D' to the reference values H wherein S' is expressed with one more most significant bit than the input data S; e.d) Calculation of an overflow handled value S" from the first approximation values S' further comprising the steps of: e.d.a) If the MSB of S' = "0", then calculation of S" by removing the MSB from S'; e.d.b) If the MSB of S' <> "0" and D' >= 0, then setting S" to a predetermined maximum sample value; e.d.c) If the MSB of S' <> "0" and D' < 0, then setting S" to zero; e.e) Storing of S" in said history; e.a) Calculation of lossy differences D' by removing of R least significant bits from the differences D; e.b) Filling up of the lossy differences D' with R predetermined least significant bits; e.c) Calculation of first approximation values S' by adding the lossy differences D' to the reference values H wherein S' is expressed with one more most significant bit than the input data S; e.d) Calculation of an overflow handled value S" from the first approximation values S' further comprising the steps of: e.d.a) If the MSB of S' = "0", then calculation of S" by removing the MSB from S'; e.d.b) If the MSB of S' <> "0" and D' >= 0, then setting S" to a predetermined maximum sample value; e.d.c) If the MSB of S' <> "0" and D' < 0, then setting S" to zero; e.d.a) If the MSB of S' = "0", then calculation of S" by removing the MSB from S'; e.d.b) If the MSB of S' <> "0" and D' >= 0, then setting S" to a predetermined maximum sample value; e.d.c) If the MSB of S' <> "0" and D' < 0, then setting S" to zero; e.e) Storing of S" in said history; f) Encoding of D if step e) has been skipped, otherwise encoding of D' g) Output of the compressed values of the differences D if step e) has been skipped, otherwise Output of the compressed values of the lossy differences D';