13#ifndef ML_DATA_COMPRESSOR_H 
   14#define ML_DATA_COMPRESSOR_H 
   47    enum { MaxHints = 10 };
 
   96    virtual std::string           
getVendor()
       const { 
return "";           }
 
  107    virtual bool                  isLossy()
         const { 
return false;        }
 
  151                                          const std::string value);
 
  156                                          const std::string &value);
 
  229    std::string _strHints[MaxHints];
 
  232    std::string _hintName[MaxHints];
 
  235    double      _rangeMin[MaxHints];
 
  238    double      _rangeMax[MaxHints];
 
  323    static std::vector<CompressionRegisterEntry>::iterator findCompressorType(
const std::string &typeName);
 
  328    static std::vector<CompressionRegisterEntry>::iterator findCompressorType(
const RuntimeType &
rtType);
 
  331    static std::vector<CompressionRegisterEntry> _dataCompressorTypes;
 
 
#define MLDATA_COMPRESSOR_EXPORT
 
Class representing general ML objects that support import/export via strings (setPersistentState() an...
 
Abstract base class for ML data compression algorithms.
 
size_t _voxelSize
Data type that can be specified by some applications, default is 1 if unknown.
 
virtual bool isSupportedVersion(const std::string &ver) const =0
Returns true if the passed version ver is supported by the implemented compressor class and false oth...
 
virtual std::string getVersion() const =0
Returns the version string.
 
virtual void setDataType(MLDataType dt)
Sets the data type of the compressed data or -1 if unknown. Default is -1.
 
virtual MLDataType getDataType() const
Returns the data type of the compressed data or -1 if unknown. Default is -1.
 
static void packMLints(const MLint vec[6], unsigned char packedBuffer[55])
Packs six MLint values if possible to a smaller memory.
 
static int unReorderDataTraversal(void *data, size_t dataSize, size_t voxSize, const MLint64 imgExt[6])
Undoes the operation applied by reorderDataTraversal, for further information see reorderDataTraversa...
 
virtual MLErrorCode compress(const void *srcMem, size_t srcSize, void *&dstMem, MLint &dstNum) const =0
Compresses a chunk of memory.
 
virtual int findHint(const std::string &hintName)
Returns the index of the hint with name hintName or -1 if not found.
 
virtual bool isLossy() const
Returns true if compression is lossy, false if not.
 
DataCompressor()
Constructor.
 
virtual MLErrorCode setHint(const std::string &hintName, const std::string &value)
Sets the hint value of the hint given by the name hintName.
 
~DataCompressor() override
Destructor.
 
virtual std::string getVendor() const
Returns the name of the vendor providing the compressor code or algorithm, something of the kind "MeV...
 
virtual void setImageExtent(const MLint ext[6])
Sets the size of one voxel or 1 if unknown. Default is 1.
 
static int reorderBytePlanes(void *data, size_t dataSize, size_t voxSize)
Prepares the data for optimal compression, returns 0 on success, and a non-zero value otherwise.
 
virtual std::string getTypeName() const =0
Returns the name of the compression scheme, used for example in user interfaces to select a compressi...
 
static int reorderDataTraversal(void *data, size_t dataSize, size_t voxSize, const MLint64 imgExt[6])
Reorders the traversal of the data to use local data coherence, reducing changes between neighboring ...
 
static int unReorderBytePlanes(void *data, size_t dataSize, size_t voxSize)
Makes data preparation undone, returns 0 on success, and a non-zero value otherwise.
 
virtual MLErrorCode decompress(const void *srcMem, size_t srcSize, void *&dstMem, MLint64 &resSize) const =0
Uncompresses a chunk of memory.
 
virtual MLErrorCode setHint(MLuint8 hintIdx, const std::string value)
Sets the hint value of the hint number hintIdx.
 
static void undiffCodeData(void *data, size_t dataSize, size_t voxSize=1)
See diffCodeData for the inverse operation and documentation.
 
static void unpackMLints(const unsigned char packedBuffer[55], MLint vec[6])
Inverse operation to packMLints.
 
virtual void getImageExtent(MLint ext[6]) const
Returns the extent of the compressed data chunk in voxels or [0,0,0] if unknown. Default is [0,...
 
HintType
Possible values to describe the type of a compression parameter.
 
virtual std::string getSuffix() const
Returns the suffix describing the compression scheme, for example "lzw", "tiff".
 
virtual void setVoxelSize(size_t vSize)
Sets the size of one voxel or 1 if unknown. Default is 1.
 
virtual MLuint8 numUsedHints() const
Returns the number of hints used by the derived compressor class, it defaults to 0.
 
virtual size_t getVoxelSize() const
Returns the size of one voxel or 1 if unknown. Default is 1.
 
static void diffCodeData(void *data, size_t dataSize, size_t voxSize=1)
This tool recodes a data array by calculating a coded difference between each voxel and its next voxe...
 
MLDataType _dataType
Data type that can be specified by some applications, default is -1 if unknown.
 
virtual void getHint(MLuint8 hintIdx, HintType &hintType, std::string &strVal, std::string &hintName, double &rangeMin, double &rangeMax) const
Gets the optional parameters settings for different purposes.
 
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
 
#define ML_ABSTRACT_CLASS_HEADER(className)
Similar to ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non-existing export symbol.
 
MLint32 MLDataType
MLDataType.
 
MLint32 MLErrorCode
Type of an ML Error code.
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
 
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
 
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...