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
Global and OS specific declarations for the MLDataCompressor project.
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 which can be specified by some applications, default is 1 for not known.
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; the compression class itself must provide checks for compatibility with v...
virtual void setDataType(MLDataType dt)
Set the data type of the compressed data or -1 if not known (the default).
virtual MLDataType getDataType() const
Returns the data type of the compressed data or -1 if not known (the default).
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; default is false.
DataCompressor()
Constructor.
virtual MLErrorCode setHint(const std::string &hintName, const std::string &value)
Set the hint value strVal of hint given by the name hintName.
~DataCompressor() override
Destructor.
virtual std::string getVendor() const
Return the name of the vendor providing the compressor code or algorithm, something of the kind "MeVi...
virtual void setImageExtent(const MLint ext[6])
Set the size of one voxel or 1 if not known (the default).
static int reorderBytePlanes(void *data, size_t dataSize, size_t voxSize)
Prepares the data for optimal compression, returns 0 on success, and a non 0 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 so that local data coherence is used to reduce changes between nei...
static int unReorderBytePlanes(void *data, size_t dataSize, size_t voxSize)
Make data preparation undone, returns 0 on success, and a non 0 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)
Set the hint value strVal of 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 not known (the default).
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" or so.
virtual void setVoxelSize(size_t vSize)
Set the size of one voxel or 1 if not known (the default).
virtual MLuint8 numUsedHints() const
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 not known (the default).
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 one ...
MLDataType _dataType
Data type which can be specified by some applications, default is -1 for not known.
virtual void getHint(MLuint8 hintIdx, HintType &hintType, std::string &strVal, std::string &hintName, double &rangeMin, double &rangeMax) const
Get 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)
Same like 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 ...