34 #ifndef SOMAIO_IO_SCALEDCODING_H 
   35 #define SOMAIO_IO_SCALEDCODING_H 
   50                              const std::vector<long> & strides,
 
   51                              const std::vector<int> & sizes,
 
   52                              bool enableoffset = 
true,
 
   59                              const std::vector<long> & strides,
 
   60                              const std::vector<int> & sizes,
 
   61                              bool enableoffset, 
double * );
 
   65                              const std::vector<long> & strides,
 
   66                              const std::vector<int> & sizes,
 
   67                              bool enableoffset, 
double * );
 
   73                                     const std::vector<long> &,
 
   74                                     const std::vector<int> &,
 
   84         _slope(1), _offset(0), _maxerr(0) {}
 
   88       double & 
slope() { 
return _slope; }
 
   89       double & 
offset() { 
return _offset; }
 
   90       double & 
maxerr() { 
return _maxerr; }
 
   98   template <
typename INP, 
typename OUTP>
 
  107                                       const std::vector<long> & strides,
 
  108                                       const std::vector<int> & sizes );
 
  111                                          const std::vector<long> & strides,
 
  112                                          const std::vector<int> & sizes,
 
virtual ~ScaledEncodingInfo()
static ScaledEncodingInfo rescale(const INP *in, const std::vector< long > &strides, const std::vector< int > &sizes, OUTP *out)
static ScaledEncodingInfo info(const INP *thing, const std::vector< long > &strides, const std::vector< int > &sizes)
Get the slope, offset and maximum error to encode a volume of float or double using an integer type.
bool canEncodeAsScaledS16(const T *vol, float &slope, float &offset, const std::vector< long > &strides, const std::vector< int > &sizes, bool enableoffset=true, double *maxerr=0)
Checks if a volume can be encoded as 16 bit signed ints with a scale factor and optionally an offset.