13 #ifndef ML_DATA_TYPES_H
14 #define ML_DATA_TYPES_H
162 double rangeMin,
double rangeMax);
166 double rangeMin,
double rangeMax);
170 double rangeMin,
double rangeMax);
174 double rangeMin,
double rangeMax);
282 int suppressML64BitInts,
283 int suppressMLldouble);
300 int suppressML64BitInts,
301 int suppressMLldouble);
511 const char *typeStructInfo,
515 void **componentAddresses,
516 size_t numGoodCastTos,
517 const char **goodCastTos);
546 size_t numInstances);
558 size_t numInstances);
570 size_t numInstances);
745 void *stdiStr,
void *stdiStrStream,
MLEXPORT MLDataType MLGetDataTypeForUncorrectedRange(MLdouble min, MLdouble max, MLint32 preferUnsigned)
Like getMLDataTypeForRange with the following differences:
MLEXPORT const char *const * MLDataTypeNames()
Function that returns the table of C-strings of all scalar and registered datatypes.
MLEXPORT size_t MLSizeOf(MLDataType dataType)
Returns the size of the data type dataType in bytes.
MLEXPORT MLint32 MLIsValidType(MLDataType dataType)
Returns true (=1) if data type dataType seems to be valid, otherwise 0 (=false).
MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponentChars(const char *charCodes, int suppressML64BitInts, int suppressMLldouble)
Returns a standard data type that is able to hold the precisions of each of the type component charac...
MLEXPORT MLDataType MLGetIntegerDataTypeForRange(double rangeMin, double rangeMax)
Returns the minimal integer type that can hold the given range.
MLEXPORT MLTypeGroup MLGetTypeGroup(MLDataType dataType)
Get the type group to which the given type belongs.
MLEXPORT MLint32 MLHolds(MLDataType datatype1, MLDataType datatype2)
Returns true (=1) if data type \ datatype1 can hold data type datatype2 without precision or sign los...
MLEXPORT const char * MLNameFromDataType(MLDataType dataType)
Function that returns the NULL-terminated string name for data type dataType or "" in case of error o...
MLint32 MLDataType
MLDataType.
MLEXPORT MLint32 MLRangeOrder(MLDataType dataType)
Returns the order value for a data type ranges.
MLEXPORT MLint32 MLIsStandardType(MLDataType dataType)
Returns true (=1) if data type dataType is a standard (scalar) type, otherwise return false (=0).
MLEXPORT size_t MLSizeOfRegisteredType(MLDataType dataType)
Compatibility function - obsolete, use MLSizeOf instead!
MLEXPORT MLDataType MLGetPromotedPrecision(MLDataType datatype1, MLDataType datatype2)
Returns one of datatype1 and datatype2 that has higher precision.
MLEXPORT const char * MLTypeGetStructInfoString(MLDataType dataType)
Returns the components codes of the data type dataType or "" in case of an invalid data type.
MLEXPORT MLdouble MLDataTypeMin(MLDataType dataType)
Returns the minimum value of data type dataType or 0 if dataType is invalid.
MLEXPORT size_t MLNumDataTypes()
Returns the current number of ML datatypes.
MLEXPORT MLDataType MLGetDataTypeForRange(MLdouble *min, MLdouble *max, MLint32 preferUnsigned)
Corrects the order of *min and *max and returns an adequate standard data type.
MLEXPORT MLDataType MLGetPromotedTypeWithRange2Inputs(MLDataType inputType1, MLDataType inputType2, double rangeMin, double rangeMax)
Convenience function for MLGetPromotedTypeWithRange with two inputs.
MLEXPORT MLint32 MLIsDefaultExtendedType(MLDataType dataType)
Returns true (=1) if data type dataType is one of the extended types that should be support out of th...
MLEXPORT MLint32 MLIsIntType(MLDataType dataType)
Returns true (=1) if data type dataType is an integer data type, otherwise false (=0).
MLEXPORT MLDataType MLDataTypeFromName(const char *const name)
Returns the ID of the data type with name name.
MLEXPORT MLDataType MLGetPromotedTypeWithRange(const MLDataType *inputTypes, size_t numTypes, double rangeMin, double rangeMax)
Routine for type promotion that takes a list of input types and the target value range to find a resu...
MLEXPORT MLint32 MLIsScalarType(MLDataType dataType)
Alternative name for MLIsStandardType.
MLEXPORT MLDataType MLGetPromotedTypeWithRange1Input(MLDataType inputType1, double rangeMin, double rangeMax)
Convenience function for MLGetPromotedTypeWithRange with one input.
MLEXPORT MLDataType MLGetPromotedTypeWithRange3Inputs(MLDataType inputType1, MLDataType inputType2, MLDataType inputType3, double rangeMin, double rangeMax)
Convenience function for MLGetPromotedTypeWithRange with three inputs.
MLEXPORT MLdouble MLDataTypeMax(MLDataType dataType)
Returns the maximum value of data type dataType or 0 if dataType is invalid.
MLEXPORT MLint32 MLIsSigned(MLDataType dataType)
Returns true (=1) if data type dataType is signed, otherwise 0 (=false).
MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponents(MLDataType dataType, int suppressML64BitInts, int suppressMLldouble)
Returns a standard data type that is able to hold the precisions of each of the components of the typ...
MLEXPORT MLint32 MLIsFloatType(MLDataType dataType)
Returns true (=1) if data type dataType is a floating point data type, otherwise false (=0).
MLEXPORT MLErrorCode MLClampIntervalToDataTypeRange(double intervalMin, double intervalMax, MLDataType dataType, double *resultIntervalMin, double *resultIntervalMax)
Clamps the given lower/upper interval to the data type's range and checks whether the interval is com...
MLEXPORT size_t MLTypeGetNumComponents(MLDataType dataType)
Returns the number of components of the data type data type or 0 in case of an invalid data type.
MLEXPORT MLDataType MLGetRangeAndPrecisionEquivalent(MLDataType dataType)
Returns a standard data type for dataType that has comparable precision and range behavior.
MLEXPORT MLDataType MLGetPromotedType(MLDataType datatype1, MLDataType datatype2)
Returns a data type that can hold the value ranges from datatype1 and datatype2 (including both).
MLint32 MLErrorCode
Type of an ML Error code.
MLEXPORT const MLTypePropertyBits MLTypeHasNormalize
A data type instance can be normalized.
MLEXPORT MLdouble MLGetVoxelValueAsDouble(const void *data, MLDataType dataType, MLErrorCode *errorCode)
Interprets the data given by data as a value of type dataType and returns its value cast to double.
MLEXPORT MLint32 MLTypeComponentsFromString(const MLTypeInfos *infos, const char *stringData, const MLTypeData *defaultValue, MLTypeData *data)
Converts a string of a data type instance to instance data, i.e., similar to sscanf.
MLEXPORT const MLTypePropertyBits MLTypeHasSetToMinimum
The setToMinimum function is implemented. (Note: This function must be implemented....
MLEXPORT void MLTypeToggleEndianType(const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
Converts data type instances from little endian to big endian or vice versa.
MLEXPORT void MLTypeMultWithOtherType(const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
Casts another data element otherData with attributes given by otherInfos to a local buffer of a type ...
MLEXPORT size_t MLGetNumRegisteredTypeInfos()
Returns the number of registered type operations.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusType
Two data type instances can be added.
MLEXPORT void MLTypeCastFromOtherType(const MLTypeInfos *otherInfos, const MLTypeData *otherData, const MLTypeInfos *myInfos, MLTypeData *myData)
Casts another data element otherData with attributes given by otherInfos to myData of a type given by...
MLEXPORT const MLTypePropertyBits MLTypeHasIsEqualToType
An equality relation between two type instances can be calculated. (Note: This function must be imple...
MLEXPORT MLTypeData * MLTypeGetDataValuesFromString(MLDataType dataType, const char *voxelValue, const MLTypeData *defaultValue, size_t numInstances)
Allocates a buffer for numInstances of data type dataType and fills it with the data type value conve...
MLEXPORT void MLTypeCastFromDouble(const MLTypeInfos *infos, MLdouble doubleValue, MLTypeData *data)
The value doubleValue is cast to the types of the components and then written to them.
MLEXPORT MLint32 MLInitializeTypes()
Initialize all ML type management.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusInt
A data type instance and an integer can be added.
MLEXPORT const MLTypePropertyBits MLTypeScalarType
A data type has all standard properties of a scalar type.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToInt
A data type instance can be cast to integer.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithDouble
Data type instance can be multiplied with double.
MLEXPORT const MLTypePropertyBits MLTypeIsSignedType
The data type is signed.
MLEXPORT MLdouble MLTypeCastToDouble(const MLTypeInfos *infos, const MLTypeData *data)
The first component of the data type is converted to double and returned.
MLEXPORT void MLTypeCastToOtherType(const MLTypeInfos *otherInfos, const MLTypeData *otherData, const MLTypeInfos *myInfos, MLTypeData *myData)
Converts a data instance referenced by otherData of a type specified by otherInfos to another data in...
MLEXPORT char * MLTypeComponentsToStringLimited(const MLTypeInfos *infos, const MLTypeData *data, int maxPrecision)
Converts a data type instance to a string.
MLEXPORT bool MLTypeCastToBool(const MLTypeInfos *infos, const MLTypeData *data)
If data is identical to default element false (= 0) is returned, otherwise true (= 1).
MLEXPORT MLDataType MLGetMLDataTypeForCharCode(char code)
Returns an ML data type compatible to a character representing it.
MLEXPORT MLTypeData * MLAllocateVoxelBuffer(MLDataType dataType, size_t numVoxels, const MLTypeData *voxelDefaultValue)
Returns a buffer of numVoxels voxels of data type dataType.
MLEXPORT MLTypeInfos * MLGetTypeInfosAtIndex(size_t index)
Returns the index th registered type operation, NULL on invalid index.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithInt
Data type instance can be multiplied with integer.
MLEXPORT void MLTypeShiftComponentsLeft(const MLTypeInfos *infos, const MLTypeData *sourceData, MLint shiftLeft, MLTypeData *targetData)
Takes one data type component after another and shifts each component left shiftLeft times if it is a...
MLEXPORT const MLTypePropertyBits MLTypeHasSetToDefault
The setToDefault function is implemented. (Note: This function must be implemented....
MLEXPORT void MLTypeSetIntComponent(char component, MLint value, MLTypeData *targetPointer)
Like MLTypeSetDoubleComponent, only components are set to integer values.
MLEXPORT void MLTypeSetAllIntComponent(const MLTypeInfos *infos, MLint value, MLTypeData *targetPointer)
Like MLTypeSetAllDoubleComponents, only components are set to integer values.
MLEXPORT const MLTypePropertyBits MLTypeHasSetToMaximum
The setToMaximum function is implemented. (Note: This function must be implemented....
MLEXPORT const MLTypePropertyBits MLTypeIsIntegerType
The data type is an integer type. False otherwise.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromDouble
A double can be cast to a data type instance.
MLEXPORT MLint32 MLRegisterStaticTypeInfos(MLTypeInfos *infos, MLDataType dt)
Version of the method that allows to specify a pre-defined data type value.
MLEXPORT MLErrorCode MLTypeGetMinMaxRangeOfComponents(const MLTypeInfos *infos, const MLTypeData *srcPtr, MLdouble *retMin, MLdouble *retMax)
Returns the minimum/maximum range of all components of an arbitrary registered voxel.
MLEXPORT const MLTypePropertyBits MLTypeHasSetStringValue
The function setStringValue is implemented. (Note: This function must be implemented....
MLEXPORT size_t MLTypeComponentSize(char component)
Returns the sizeof of a MLTypeComponent component denoted by a character code.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToDouble
A data type instance can be cast to double.
MLEXPORT MLTypePropertyBits MLTypePropBitsXor(MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
Inverts all set bits from propertyBits that are set in mask.
MLEXPORT const MLTypePropertyBits MLTypeHasGetStringValue
The function getStringValue is implemented. (Note: This function must be implemented....
MLEXPORT void MLTypeConvertToLittleEndian(const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
Converts data type instances from big endian to little endian.
MLEXPORT MLint32 MLRegisterTypeInfos(MLTypeInfos *infos)
Adds the data type class information to the list of registered datatypes.
MLEXPORT char * MLTypeComponentsToString(const MLTypeInfos *infos, const MLTypeData *data)
Converts a data type instance to a string.
MLEXPORT void MLTypeCastFromInt(const MLTypeInfos *infos, MLint intValue, MLTypeData *data)
The integer value of intValue is cast to the types of the components and then written to them.
MLEXPORT MLint32 MLTypeGetComponentProperties(char code, MLint32 *isSigned, MLint32 *isIntegerType, MLint32 *isFloatingPointType, MLint32 *isLongType)
Returns true (=1) in *isSigned, *isIntegerType, *isFloatingPointType, and *isLongType if the componen...
MLEXPORT MLint MLTypeCastToInt(const MLTypeInfos *infos, const MLTypeData *data)
The first component of the data type is converted to integer and returned.
MLEXPORT char * MLGetVoxelValueAsString(const MLTypeData *data, MLDataType dataType, MLErrorCode *errorCode)
Interprets the data given by data as a value of type dataType and returns its value as string.
MLEXPORT void MLTypeCorrectPropertyBits(MLTypeInfos *infos)
Corrects all property bits except for the basic properties [MLTypeIsSignedType, MLTypeIsFloatingPoint...
MLEXPORT const MLTypePropertyBits MLTypeIsStandardType
The data type is standard scalar data type(intUL, floatUL, charUL, ...).
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithType
Two data type instances can be multiplied.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromOtherType
Any data type instance can be cast a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToBool
A data type instance can be cast to bool.
MLEXPORT MLTypeData * MLTypeInfosCreateBuffer(const MLTypeInfos *infos)
Returns a buffer of the size of one data element. NULL is returned on failure.
MLEXPORT const MLTypePropertyBits MLTypeHasCopy
Copies parameter one to parameter two. (Note: This function must be implemented.)
MLEXPORT const MLTypePropertyBits MLTypeHasNegate
The negative value of a data type instance can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeIsFloatingPointType
The data type is a floating point type. False otherwise.
MLEXPORT void MLTypeInfosRemoveBuffer(MLTypeData *buffer)
Removes a buffer created with MLTypeInfosCreateBuffer.
MLEXPORT char * MLGetVoxelValueAsStringLimited(const MLTypeData *data, MLDataType dataType, MLErrorCode *errorCode, int maxPrecision)
Interprets the data given by data as a value of type dataType and returns its value as string.
MLEXPORT void MLTypeCastFromBool(const MLTypeInfos *infos, bool boolValue, MLTypeData *data)
If boolValue == 0, data is set to the type default value given by infos.
MLEXPORT const MLTypePropertyBits MLTypeIsDefaultType
The data type is one of the default types (standard scalar or default extended).
MLEXPORT MLint32 MLAreTypesInitialized()
Returns 1 (=true) if type table is initialized, otherwise 0 (=false).
MLEXPORT const MLTypePropertyBits MLTypeHasNoProperties
The data type has no standard properties.
MLEXPORT void MLDestroyTypes()
Destroy ML type management.
MLEXPORT void MLTypeConvertToBigEndian(const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
Converts data type instances from little endian to big endian.
MLEXPORT MLint32 MLIsRegisteredTypeInfos(const MLTypeInfos *infos)
Returns 1 (=true) if the data type is already registered. Otherwise, 0 (=false) is returned.
MLEXPORT void MLTypeSetAllDoubleComponents(const MLTypeInfos *infos, MLdouble value, MLTypeData *targetPointer)
All components of the data referenced by *targetPointer are set to their values cast from the double ...
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromInt
An integer can be cast to a data type instance.
MLEXPORT MLdouble MLTypeGetDoubleComponent(char component, const MLTypeData *targetPointer)
Interprets the data referenced by *targetPointer as data of the type component and returns it as doub...
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithOtherType
A data type instances can be multiplied with the one of another type.
MLEXPORT MLTypePropertyBits MLTypePropBitsAnd(MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
AND operation of all bits in mask and those in propertyBits.
MLEXPORT MLint32 MLTypeInfosInit(MLTypeInfos *infos, size_t typeSize, const char *name, MLdouble dblMin, MLdouble dblMax, const MLTypeData *typeMinPtr, const MLTypeData *typeMaxPtr, const MLTypeData *typeDefaultPtr, const char *typeStructInfo, MLint32 isScalarType, MLTypeGroup typeGroup, MLDataType rangeAndPrecisionEquiv, void **componentAddresses, size_t numGoodCastTos, const char **goodCastTos)
Initialization of the main properties of MLTypeInfos.
MLEXPORT void MLTypeSetDoubleComponent(char component, MLdouble value, MLTypeData *targetPointer)
Interprets the data referenced by *targetPointer as data of the type component and sets its value fro...
MLEXPORT MLint MLTypeGetIntComponent(char component, const MLTypeData *targetPointer)
Like MLTypeGetComponent, only that the components is returned as integer values.
MLEXPORT MLint32 MLTypePropBitsTest(MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
Returns true (=1) if bit mask mask is part of propertyBits; otherwise, it return false (=0).
MLEXPORT const MLTypePropertyBits MLTypeHasCastToOtherType
A data type instance can be cast to another type.
MLEXPORT const char * MLGetCDataTypeNameForCharCode(char code)
Returns the basic C/C++ data type name corresponding to a character representing it.
MLEXPORT MLint32 MLTypeComponentsFromStream(void *iStr, void *iStrStream, void *stdiStr, void *stdiStrStream, const MLTypeInfos *infos, MLTypeData *data)
Reads data type components into different stream versions (istream and istrstream within and outside ...
MLEXPORT MLTypeInfos * MLGetTypeInfosForDataType(MLDataType dataType)
Returns the MLTypeInfos for the data type dataType, or NULL on non-registered or invalid type.
MLEXPORT MLTypePropertyBits MLTypePropBitsOr(MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
Adds all set bits in mask to those in propertyBits.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusDouble
A data type instance and a double can be added.
MLEXPORT void MLTypeSetDefaultFunctionPointers(MLTypeInfos *infos)
Sets all function pointers to default values that perform error handling when called.
MLEXPORT const char * MLGetMLDataTypeNameForCharCode(char code)
Returns an ML type name type name compatible to a character representing it.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
MLuint64 MLTypePropertyBits
Structure to define a bit mask that identifies all implemented functions for a data type.
unsigned char MLTypeData
This is the pointer type used to point to the data of MLType data instances.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
MLint32 MLTypeGroup
This is an identifier to differentiate types like matrices, vectors, and complex/quaternion types,...
SwitchType< ml::TypeTraits< T >::isStandardType > isScalarType()
The purpose of this function is only to return different result types depending on whether T is a sca...
Structure containing all data type features and pointers to all functions needed to implement operati...