OpenMS
2.6.0
|
Functions | |
double | optimalLinearFixedPoint (const double *data, size_t dataSize) |
double | optimalLinearFixedPointMass (const double *data, size_t dataSize, double mass_acc) |
size_t | encodeLinear (const double *data, const size_t dataSize, unsigned char *result, double fixedPoint) |
void | encodeLinear (const std::vector< double > &data, std::vector< unsigned char > &result, double fixedPoint) |
size_t | decodeLinear (const unsigned char *data, const size_t dataSize, double *result) |
void | decodeLinear (const std::vector< unsigned char > &data, std::vector< double > &result) |
size_t | encodeSafe (const double *data, const size_t dataSize, unsigned char *result) |
size_t | decodeSafe (const unsigned char *data, const size_t dataSize, double *result) |
size_t | encodePic (const double *data, const size_t dataSize, unsigned char *result) |
void | encodePic (const std::vector< double > &data, std::vector< unsigned char > &result) |
size_t | decodePic (const unsigned char *data, const size_t dataSize, double *result) |
void | decodePic (const std::vector< unsigned char > &data, std::vector< double > &result) |
double | optimalSlofFixedPoint (const double *data, size_t dataSize) |
size_t | encodeSlof (const double *data, const size_t dataSize, unsigned char *result, double fixedPoint) |
void | encodeSlof (const std::vector< double > &data, std::vector< unsigned char > &result, double fixedPoint) |
size_t | decodeSlof (const unsigned char *data, const size_t dataSize, double *result) |
void | decodeSlof (const std::vector< unsigned char > &data, std::vector< double > &result) |
void ms::numpress::MSNumpress::decodeLinear | ( | const std::vector< unsigned char > & | data, |
std::vector< double > & | result | ||
) |
Calls lower level decodeLinear while handling vector sizes appropriately
Note that this method may throw a const char* if it deems the input data to be corrupt, i.e.. that the last encoded int does not use the last byte in the data. In addition the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0 halfbyte.
data | vector of bytes to be decoded |
result | vector of resulting double (will be resized to the number of doubles) |
size_t ms::numpress::MSNumpress::decodeLinear | ( | const unsigned char * | data, |
const size_t | dataSize, | ||
double * | result | ||
) |
Decodes data encoded by encodeLinear.
result vector guaranteed to be shorter or equal to (|data| - 8) * 2
Note that this method may throw a const char* if it deems the input data to be corrupt, i.e. that the last encoded int does not use the last byte in the data. In addition the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0 halfbyte.
data | pointer to array of bytes to be decoded (need memorycont. repr.) |
dataSize | number of bytes from *data to decode |
result | pointer to were resulting doubles should be stored |
return | the number of decoded doubles, or -1 if dataSize < 4 or 4 < dataSize < 8 |
void ms::numpress::MSNumpress::decodePic | ( | const std::vector< unsigned char > & | data, |
std::vector< double > & | result | ||
) |
Calls lower level decodePic while handling vector sizes appropriately
Note that this method may throw a const char* if it deems the input data to be corrupt, i.e. that the last encoded int does not use the last byte in the data. In addition the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0 halfbyte.
data | vector of bytes to be decoded |
size_t ms::numpress::MSNumpress::decodePic | ( | const unsigned char * | data, |
const size_t | dataSize, | ||
double * | result | ||
) |
Decodes data encoded by encodePic
result vector guaranteed to be shorter of equal to |data| * 2
Note that this method may throw a const char* if it deems the input data to be corrupt, i.e. that the last encoded int does not use the last byte in the data. In addition the last encoded int need to use either the last halfbyte, or the second last followed by a 0x0 halfbyte.
data | pointer to array of bytes to be decoded (need memorycont. repr.) |
dataSize | number of bytes from *data to decode |
result | pointer to were resulting doubles should be stored |
size_t ms::numpress::MSNumpress::decodeSafe | ( | const unsigned char * | data, |
const size_t | dataSize, | ||
double * | result | ||
) |
Decodes data encoded by encodeSafe.
result vector is the same size as the input data.
Might throw const char* is something goes wrong during decoding.
data | pointer to array of bytes to be decoded (need memorycont. repr.) |
dataSize | number of bytes from *data to decode |
result | pointer to were resulting doubles should be stored |
void ms::numpress::MSNumpress::decodeSlof | ( | const std::vector< unsigned char > & | data, |
std::vector< double > & | result | ||
) |
Calls lower level decodeSlof while handling vector sizes appropriately
Note that this method may throw a const char* if it deems the input data to be corrupt.
data | vector of bytes to be decoded |
result | vector of resulting double (will be resized to the number of doubles) |
size_t ms::numpress::MSNumpress::decodeSlof | ( | const unsigned char * | data, |
const size_t | dataSize, | ||
double * | result | ||
) |
Decodes data encoded by encodeSlof
The return will include exactly (|data| - 8) / 2 doubles.
Note that this method may throw a const char* if it deems the input data to be corrupt.
data | pointer to array of bytes to be decoded (need memorycont. repr.) |
dataSize | number of bytes from *data to decode |
result | pointer to were resulting doubles should be stored |
size_t ms::numpress::MSNumpress::encodeLinear | ( | const double * | data, |
const size_t | dataSize, | ||
unsigned char * | result, | ||
double | fixedPoint | ||
) |
Encodes the doubles in data by first using a
The resulting binary is maximally 8 + dataSize * 5 bytes, but much less if the data is reasonably smooth on the first order.
This encoding is suitable for typical m/z or retention time binary arrays. On a test set, the encoding was empirically show to be accurate to at least 0.002 ppm.
data | pointer to array of double to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
result | pointer to where resulting bytes should be stored |
fixedPoint | the scaling factor used for getting the fixed point repr. This is stored in the binary and automatically extracted on decoding. |
void ms::numpress::MSNumpress::encodeLinear | ( | const std::vector< double > & | data, |
std::vector< unsigned char > & | result, | ||
double | fixedPoint | ||
) |
Calls lower level encodeLinear while handling vector sizes appropriately
data | vector of doubles to be encoded |
result | vector of resulting bytes (will be resized to the number of bytes) |
size_t ms::numpress::MSNumpress::encodePic | ( | const double * | data, |
const size_t | dataSize, | ||
unsigned char * | result | ||
) |
Encodes ion counts by simply rounding to the nearest 4 byte integer, and compressing each integer with encodeInt.
The handleable range is therefore 0 -> 4294967294. The resulting binary is maximally dataSize * 5 bytes, but much less if the data is close to 0 on average.
data | pointer to array of double to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
result | pointer to where resulting bytes should be stored |
void ms::numpress::MSNumpress::encodePic | ( | const std::vector< double > & | data, |
std::vector< unsigned char > & | result | ||
) |
Calls lower level encodePic while handling vector sizes appropriately
data | vector of doubles to be encoded |
result | vector of resulting bytes (will be resized to the number of bytes) |
size_t ms::numpress::MSNumpress::encodeSafe | ( | const double * | data, |
const size_t | dataSize, | ||
unsigned char * | result | ||
) |
Encodes the doubles in data by storing the residuals from a linear prediction after first two values.
The resulting binary is the same size as the input data.
This encoding is suitable for typical m/z or retention time binary arrays, and is intended to be used before zlib compression to improve compression.
data | pointer to array of doubles to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
result | pointer to were resulting bytes should be stored |
size_t ms::numpress::MSNumpress::encodeSlof | ( | const double * | data, |
const size_t | dataSize, | ||
unsigned char * | result, | ||
double | fixedPoint | ||
) |
Encodes ion counts by taking the natural logarithm, and storing a fixed point representation of this. This is calculated as
unsigned short fp = log(d + 1) * fixedPoint + 0.5
the result vector is exactly |data| * 2 + 8 bytes long
data | pointer to array of double to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
result | pointer to were resulting bytes should be stored |
void ms::numpress::MSNumpress::encodeSlof | ( | const std::vector< double > & | data, |
std::vector< unsigned char > & | result, | ||
double | fixedPoint | ||
) |
Calls lower level encodeSlof while handling vector sizes appropriately
data | vector of doubles to be encoded |
Compute the maximal linear fixed point that prevents integer overflow.
data | pointer to array of double to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
double ms::numpress::MSNumpress::optimalLinearFixedPointMass | ( | const double * | data, |
size_t | dataSize, | ||
double | mass_acc | ||
) |
Compute the optimal linear fixed point with a desired m/z accuracy.
data | pointer to array of double to be encoded (need memorycont. repr.) |
dataSize | number of doubles from *data to encode |
mass_acc | desired m/z accuracy in Th |