ML Reference
mlAPI.h File Reference
#include <ThirdPartyWarningsDisable.h>
#include <windows.h>
#include <ThirdPartyWarningsRestore.h>
#include "mlInitSystemML.h"
#include "mlUtilsAPI.h"
#include "mlVersion.h"

Go to the source code of this file.

Functions

ML and ML Host: Initialization, Destruction, and callbacks.
MLEXPORT MLint32 MLInit (MLint32 majorVersion, MLint32 majorCAPIVersion, MLint32 revCAPI)
 Calls the C++ initialization of the ML.
 
MLEXPORT MLint32 MLDestroy ()
 Destroys the ML, frees memory allocated in MLInit() and in all other ML operations.
 
MLEXPORT void MLHostSetProgressCB (void *userData, MLHostProgressCB *callback)
 Sets a callback to provide feedback of the host calculation progress.
 
MLEXPORT void MLHostUpdateProgress (const char *info1, const char *info2)
 Calls the callback set MLHostSetProgressCB manually (this is used by the InventorWrapper module).
 
MLEXPORT void MLHostSetBreakCheckCB (void *userData, MLHostBreakCheckCB *callback)
 Sets a callback to provide break checking of current calculation.
 
Library loading, unloading, runtime state changes.
MLEXPORT MLErrorCode MLLoadLibraryWOErrorExt (const char *name, MLLibraryHandle *libHandle)
 Loads the given shared library.
 
MLEXPORT MLErrorCode MLLoadLibraryWOError (const char *name)
 Same as MLLoadLibraryWOErrorExt with libHandle=NULL.
 
MLEXPORT MLint32 MLLoadLibrary (const char *name)
 Loads the given shared library.
 
MLEXPORT MLuint32 MLIsCurrentlyUnloadingLibrary ()
 This function returns true(=1) if an ML library is currently unloaded, otherwise false (=0).
 
MLEXPORT MLuint32 MLSetIsCurrentlyUnloadingLibrary (MLuint32 enable)
 This function allows to set the MLIsCurrentlyUnloadingLibrary state and returns the previously set unloading state.
 
MLEXPORT MLErrorCode MLUnLoadLibrary (const char *name, MLLibraryHandle libHandle, char **errStr)
 Unloads the given shared library.
 
Management of ML modules
MLEXPORT mlModuleMLCreateModuleFromName (const char *className)
 Creates a new instance of a module of type given by className.
 
MLEXPORT void MLDeleteModule (mlModule *module)
 Destroys/deletes a module instance module created by MLCreateModuleFromName.
 
MLEXPORT MLint32 MLBaseIsDerivedFrom (mlBase *base, const char *superClassName)
 Returns 1(=true) if base is derived from class with name superClassName and 0(=false) if not.
 
MLEXPORT const char * MLBaseGetType (mlBase *base)
 Returns object type as string.
 
MLEXPORT mlTypeMLBaseGetTypeObject (mlBase *base)
 Returns object type as type object.
 
MLEXPORT const char * MLBaseGetParentType (mlBase *base)
 Returns object type of parent class as string.
 
MLEXPORT mlModuleMLCreateModuleFromType (mlType *type)
 Creates a new instance of a module of type given by type.
 
MLEXPORT mlTypeMLTypeFromName (const char *name)
 Returns type object for given name. 0 will be returned if the type described by name is unknown.
 
MLEXPORT MLint32 MLTypeIsAbstract (mlType *type)
 Returns true (== 1) if type is abstract, otherwise 0 (=false).
 
MLEXPORT const char * MLTypeGetName (mlType *type)
 Returns pointer to a null terminated string containing the name of the class represented by type.
 
MLEXPORT const char * MLTypeGetDllName (mlType *type)
 Returns pointer to a null terminated string containing the string name of the dll probably containing the code and/or the init function of the class represented by type.
 
MLEXPORT const char * MLTypeGetParentName (mlType *type)
 Returns pointer to a null terminated string containing the name of the parent class of that represented by type.
 
MLEXPORT mlTypeMLTypeGetParentType (mlType *type)
 Returns pointer to the RuntimeType instance representing the type of the parent class of that represented by type.
 
MLEXPORT MLint32 MLTypeIsDerivedFrom (mlType *type, const char *parent)
 Returns true (== 1) if runtime type type is derived from the parent class with the name given by parent.
 
Access to field interface of module
MLEXPORT mlFieldMLModuleGetField (mlModule *module, const char *name)
 Return field with name name of module.
 
MLEXPORT size_t MLModuleGetNumFields (mlModule *module)
 Return number of fields contained in module.
 
MLEXPORT mlFieldMLModuleGetIndexedField (mlModule *module, MLint32 n)
 Return field with index from [0..getNumFields-1] of module if field exists; otherwise 0 (NULL) is returned.
 
MLEXPORT void MLModuleSetFieldValue (mlModule *module, char *fieldName, char *value)
 Sets field with name fieldName of module to value value.
 
Activate/deactivate loading/saving state for modules.
MLEXPORT void MLBeginLoadFields (mlModule *module)
 Notifies the begin of the loading process in which the fields of the module are set/initialized.
 
MLEXPORT void MLEndLoadFields (mlModule *module)
 Notifies the end of the loading process in which the fields of the module are set/initialized.
 
MLEXPORT void MLBeginSaveFields (mlModule *module)
 Notifies the begin of the saving process in which the fields of the module are read/saved.
 
MLEXPORT void MLEndSaveFields (mlModule *module)
 Notifies the end of the saving process in which the fields of the module are read/saved.
 
Access to field values and properties.
MLEXPORT const char * MLFieldGetName (mlField *field)
 Returns name of field field.
 
MLEXPORT const char * MLFieldGetType (mlField *field)
 Return runtime data type of field field as string.
 
MLEXPORT void MLFieldSetValue (mlField *field, const char *value)
 Set value of field field to value.
 
MLEXPORT size_t MLFieldGetValueSize (mlField *field)
 Returns string length of field value coded as string of field field.
 
MLEXPORT size_t MLFieldGetValue (mlField *field, char *value, size_t bufferSize)
 Copies the value of field field as string into the character string value.
 
MLEXPORT void MLFieldSetFloatValue (mlField *field, MLfloat value)
 Set value of FloatField field to the float value value.
 
MLEXPORT MLfloat MLFieldGetFloatValue (mlField *field)
 Return the value of the FloatField field.
 
MLEXPORT void MLFieldSetDoubleValue (mlField *field, MLdouble value)
 Set value of DoubleField field to the double value value.
 
MLEXPORT MLdouble MLFieldGetDoubleValue (mlField *field)
 Return the value of the DoubleField field field.
 
MLEXPORT void MLFieldSetIntValue (mlField *field, MLint32 value)
 Set value of IntegerField field to the integer value value.
 
MLEXPORT void MLFieldSetIntValue64 (mlField *field, MLint64 value)
 Set value of IntegerField field to the integer value value.
 
MLEXPORT MLint32 MLFieldGetIntValue (mlField *field)
 Return the value of the IntegerField field.
 
MLEXPORT MLint64 MLFieldGetIntValue64 (mlField *field)
 Return the value of the IntegerField field.
 
Access to enum fields
MLEXPORT int MLFieldGetEnumValue (mlField *field)
 Returns index of selected element in the EnumField field.
 
MLEXPORT void MLFieldSetEnumValue (mlField *field, int val)
 Sets index of selected element in the EnumField field.
 
MLEXPORT size_t MLFieldGetNumEnums (mlField *field)
 Returns number of elements in the EnumField field.
 
MLEXPORT const char * MLFieldGetEnumName (mlField *field, MLint32 i, int *value)
 Return name of the i th element of enum field field and set value to i if field type is an enum type.
 
Connecting of input and output fields
MLEXPORT MLint32 MLFieldConnectFrom (mlField *inField, mlField *outField)
 If inField is an input connector field and outField is an output connector field, the field inField is connected with the field outField and returns true (=1) if connecting was successful, false (=0) otherwise.
 
MLEXPORT MLint32 MLImageFieldConnectFromNoNotify (mlField *inField, mlField *outField)
 Connects connectors of input connector field inField with the connector of the output connector field outField and returns true (=1) if connection is successful, otherwise false (= 0).
 
MLEXPORT void MLFieldDisconnect (mlField *inField)
 If inField is an input field: Removes connection to input field inField.
 
MLEXPORT void MLFieldTouch (mlField *field)
 Touches the field field to notify all connected fields.
 
Requesting and freeing of image data via output connector fields
MLEXPORT MLErrorCode MLImageGetTile6D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint c, MLint t, MLint u, MLint nx, MLint ny, MLint nz, MLint nc, MLint nt, MLint nu, MLDataType datatype)
 Calculates a 6d rectangular region of the input image given by output field outField and returns a pointer to calculated data in *memory.
 
MLEXPORT MLErrorCode MLImageGetTile4D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint c, MLint nx, MLint ny, MLint nz, MLint nc, MLDataType datatype)
 Like MLImageGetTile6D(), only for 4 dimensional regions, (i.e., t=u=0 and nt=nt=1)
 
MLEXPORT MLErrorCode MLImageGetTile3D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz, MLDataType datatype)
 Like MLImageGetTile6D(), only for 3 dimensional regions, (i.e., c=t=u=0 and nc=nt=nu=1)
 
MLEXPORT MLErrorCode MLImageGetTile (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz, MLDataType datatype)
 Exactly like MLImageGetTile3D().
 
MLEXPORT MLErrorCode MLImageGetScaledTile6D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint c, MLint t, MLint u, MLint nx, MLint ny, MLint nz, MLint nc, MLint nt, MLint nu, MLDataType datatype, MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax)
 Like MLImageGetTile6D().
 
MLEXPORT MLErrorCode MLImageGetScaledTile4D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint c, MLint nx, MLint ny, MLint nz, MLint nc, MLDataType datatype, MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax)
 Like MLImageGetScaledTile6D(), only for 4 dimensional regions, (i.e., t=u=0 and nt=nt=1)
 
MLEXPORT MLErrorCode MLImageGetScaledTile3D (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz, MLDataType datatype, MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax)
 Like MLImageGetScaledTile6D(), only for 3 dimensional regions, (i.e., t=u=0 and nt=nt=1)
 
MLEXPORT MLErrorCode MLImageGetScaledTile (mlField *outField, void **memory, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz, MLDataType datatype, MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax)
 Exactly like MLImageGetScaledTile3D().
 
MLEXPORT void MLImageFreeTile (void *data)
 Frees the memory created/allocated by any of the functions MLImageGetTile*() or MLImageGetScaledTile*().
 
Cache management.
MLEXPORT MLuint64 MLCacheGetCurrentSizeKB ()
 Returns number of kilobytes currently allocated within ML cache.
 
MLEXPORT MLuint64 MLCacheGetMaxSizeKB ()
 Returns maximum number of kilobytes used by the ML cache.
 
MLEXPORT void MLCacheSetMaxSizeKB (MLuint64 size)
 Sets maximum number of kilobytes used by the ML cache.
 
MLEXPORT MLErrorCode MLClearPagesAndMemoryImg (mlField *outField)
 Removes all pages of the page image from the memory at OutputConnectorField outField.
 
MLEXPORT MLErrorCode MLClearPages (mlField *outField)
 Removes all pages of the page image from the memory at output image field outField.
 
MLEXPORT MLErrorCode MLClearMemoryImg (mlField *outField)
 Clears the memory image in OutputConnectorField outField if it is handled by the ML.
 
MLEXPORT MLErrorCode MLGetPageMemorySize (mlField *outField, size_t *numBytes)
 Returns currently used cache size for pages of the image in OutputConnectorField outField in bytes.
 
MLEXPORT MLErrorCode MLGetMemoryImgSize (mlField *outField, size_t *numBytes)
 Returns currently used size of memory image of OutputConnectorField outField in bytes.
 
MLEXPORT void MLClearCache ()
 Removes all cached pages from all module outputs.
 
Access to image properties via output connector fields
MLEXPORT MLErrorCode MLGetImageState (mlField *outField)
 Tries to update and then it checks an image represented by output field outField.
 
MLEXPORT const char * MLGetImageStateString (mlField *outField)
 Requests the state string from an output field outField.
 
MLEXPORT MLErrorCode MLImageGetSize6D (mlField *outField, int *x, int *y, int *z, int *c, int *t, int *u)
 Determines the size of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetPageSize6D (mlField *outField, int *x, int *y, int *z, int *c, int *t, int *u)
 Determines the page size of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetSize (mlField *outField, int *x, int *y, int *z, int *c)
 Like MLImageGetSize6D, only for 4D. The last two extents are ignored.
 
MLEXPORT MLErrorCode MLImageGetType (mlField *outField, MLDataType *dtype, size_t *dsize)
 Determines the data type dtype and its size dsize in bytes of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageGetVoxelSize (mlField *outField, MLfloat *x, MLfloat *y, MLfloat *z)
 Determines the voxel size x / y / z of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageGetVoxelSizeInDoubles (mlField *outField, MLdouble *x, MLdouble *y, MLdouble *z)
 Determines the voxel size x / y / z of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageGetFirstImagePropertyExtensionByType (mlField *outField, const char *imagePropertyTypeClassName, void **imagePropertyExtension)
 Returns the first image property extension imagePropertyExtension (as void-Pointer) of type imagePropertyTypeClassName of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetMinValue (mlField *outField, MLdouble *minValue)
 Returns minimum voxel value minValue of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetMaxValue (mlField *outField, MLdouble *maxValue)
 Returns the maximum voxel value maxValue of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrix (mlField *outField, MLfloat[16])
 Returns the VoxelToWorldMatrix of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrixInDoubles (mlField *outField, MLdouble[16])
 Returns the VoxelToWorldMatrix of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrix (mlField *outField, MLfloat[16])
 Returns the WorldToVoxelMatrix of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrixInDoubles (mlField *outField, MLdouble[16])
 Returns the WorldToVoxelMatrix of the image represented by output field outField.
 
MLEXPORT MLErrorCode MLImageMapVoxelToWorld (mlField *outField, MLfloat srcX, MLfloat srcY, MLfloat srcZ, MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ)
 Transforms the given position (srcX, srcY, scrZ) from voxel to world coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageMapVoxelToWorldInDoubles (mlField *outField, MLdouble srcX, MLdouble srcY, MLdouble srcZ, MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ)
 Transforms the given position (srcX, srcY, scrZ) from voxel to world coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageMapWorldToVoxel (mlField *outField, MLfloat srcX, MLfloat srcY, MLfloat srcZ, MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ)
 Transforms the given position (srcX, srcY, scrZ) from world to voxel coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.
 
MLEXPORT MLErrorCode MLImageMapWorldToVoxelInDoubles (mlField *outField, MLdouble srcX, MLdouble srcY, MLdouble srcZ, MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ)
 Transforms the given position (srcX, srcY, scrZ) from world to voxel coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.
 
Base field management
MLEXPORT const char * MLBaseFieldGetPersistentState (mlField *baseField)
 Returns a character string which contains the object state of the base object represented by the base field baseField.
 
MLEXPORT void MLBaseFieldSetPersistentState (mlField *baseField, const char *state)
 Restores the state of the base object represented by the base field baseField using a state generated by the call of getPersistentState(baseField).
 
MLEXPORT void MLBaseFieldClearPersistentState (mlField *baseField, char *state)
 Frees the memory allocated for the character string state which was allocated by the function call MLBaseFieldGetPersistentState(baseField).
 
MLEXPORT void * MLBaseFieldGetPtr (mlField *field)
 Returns the value of the base field field.
 
MLEXPORT void MLBaseFieldSetPtr (mlField *baseField, const void *value)
 Sets the pointer value of the base field baseField to value.
 
SoNode and Pointer field management
MLEXPORT void * MLSoNodeFieldGetPtr (mlField *field)
 Returns the value of the SoNode field field.
 
MLEXPORT void MLSoNodeFieldSetPtr (mlField *field, const void *value)
 Sets the pointer value of the SoNode field field to value.
 
MLEXPORT void * MLPointerFieldGetPtr (mlField *field)
 Returns the value of the pointer field field.
 
MLEXPORT void MLPointerFieldSetPtr (mlField *field, const void *value)
 Sets the value of the pointer field field to value.
 
Field sensor management.
MLEXPORT mlSensorMLCreateFieldSensor (void *userData, MLSensorCB *callback)
 Returns a field sensor.
 
MLEXPORT void MLDeleteFieldSensor (mlSensor *sensor)
 Destroys the sensor sensor.
 
MLEXPORT mlFieldMLFieldSensorGetField (mlSensor *sensor)
 Returns the field which is observed by sensor sensor.
 
MLEXPORT void MLFieldSensorAttach (mlSensor *sensor, mlField *field)
 Attach the sensor sensor to the field field (any value change will be notified by the call of the callback).
 
MLEXPORT void MLFieldSensorDetach (mlSensor *sensor)
 Disconnects the connection between sensor sensor and its observed field.
 
Sending of messages to std::cout or std::cerr.
MLEXPORT MLint32 MLAreMessagesSentToCout ()
 Returns 1(=true) if the ML messages are sent to std::cout, otherwise 0(=false).
 
MLEXPORT void MLSendMessagesToCout (MLint32 on)
 If 0 is passed as on, message sending to std::cout is disabled.
 
MLEXPORT MLint32 MLAreMessagesSentToCerr ()
 Returns 1(=true) if the ML messages are sent to std::cerr, otherwise 0(=false).
 
MLEXPORT void MLSendMessagesToCerr (MLint32 on)
 If 0 is passed as on, message sending to std::cerr is disabled.
 
Set/Get the number of threads the ML may use.
MLEXPORT MLErrorCode MLSetMaxNumThreads (MLuint32 numThreads)
 Sets the number of parallel threads which the ML might use.
 
MLEXPORT MLuint32 MLGetMaxNumThreads ()
 Returns the currently set number of parallel threads which the ML might use.
 

Macro definitions for void pointers to make the API readable.

Defines a C-Application Programming Interface (API) to the ML, see also mlUtilsAPI.h.

It supplies control to most parts of the ML and much higher binary compatibility than the C++ binary interface. It also can be used to link the ML to other programming languages. All functions of this interface are highly (however not completely) protected with exception handlers and tested to guarantee high security when using this functions. All detected errors will be handled by the ErrorOutput class if not explicitly returned by returned error codes. Disable all c++ specific things in mlInitSystemML for this C-API. Include ML library initialization code and system dependencies. Undefine macro to avoid macro space pollution. Include all non ML includes which shall be available generally. Include ML version information.

#define mlField   void
 A macro name for a void pointer to a field in the ML to make pointer more readable.
 
#define mlSensor   void
 A macro name for a void pointer to a sensor in the ML to make pointer more readable.
 
#define mlModule   void
 A macro name for a void pointer to a ml::Module in the ML to make pointer more readable.
 
#define mlBase   void
 A macro name for a void pointer to a base object in the ML to make pointer more readable.
 
#define mlType   void
 A macro name for a void pointer to a runtime type in the ML to make pointer more readable.
 
typedef HMODULE MLLibraryHandle
 Defines the platform specific handle for a dynamically linked library.
 

Macro Definition Documentation

◆ mlBase

#define mlBase   void

A macro name for a void pointer to a base object in the ML to make pointer more readable.

Definition at line 63 of file mlAPI.h.

◆ mlField

#define mlField   void

A macro name for a void pointer to a field in the ML to make pointer more readable.

Definition at line 54 of file mlAPI.h.

◆ mlModule

#define mlModule   void

A macro name for a void pointer to a ml::Module in the ML to make pointer more readable.

Definition at line 60 of file mlAPI.h.

◆ mlSensor

#define mlSensor   void

A macro name for a void pointer to a sensor in the ML to make pointer more readable.

Definition at line 57 of file mlAPI.h.

◆ mlType

#define mlType   void

A macro name for a void pointer to a runtime type in the ML to make pointer more readable.

Definition at line 66 of file mlAPI.h.

Typedef Documentation

◆ MLLibraryHandle

typedef HMODULE MLLibraryHandle

Defines the platform specific handle for a dynamically linked library.

It requires a windows include and cannot be placed in mlTypeDefs.h therefore.

Definition at line 71 of file mlAPI.h.

Function Documentation

◆ MLAreMessagesSentToCerr()

MLEXPORT MLint32 MLAreMessagesSentToCerr ( )

Returns 1(=true) if the ML messages are sent to std::cerr, otherwise 0(=false).

Default is 0.

◆ MLAreMessagesSentToCout()

MLEXPORT MLint32 MLAreMessagesSentToCout ( )

Returns 1(=true) if the ML messages are sent to std::cout, otherwise 0(=false).

Default is 1.

◆ MLBaseFieldClearPersistentState()

MLEXPORT void MLBaseFieldClearPersistentState ( mlField * baseField,
char * state )

Frees the memory allocated for the character string state which was allocated by the function call MLBaseFieldGetPersistentState(baseField).

If state is NULL it simply will be ignored.

◆ MLBaseFieldGetPersistentState()

MLEXPORT const char * MLBaseFieldGetPersistentState ( mlField * baseField)

Returns a character string which contains the object state of the base object represented by the base field baseField.

The string memory is allocated in the function and must be released with MLBaseFieldClearPersistentState().

◆ MLBaseFieldGetPtr()

MLEXPORT void * MLBaseFieldGetPtr ( mlField * field)

Returns the value of the base field field.

If field is not of expected type then an error is printed and 0 (NULL) is returned.

◆ MLBaseFieldSetPersistentState()

MLEXPORT void MLBaseFieldSetPersistentState ( mlField * baseField,
const char * state )

Restores the state of the base object represented by the base field baseField using a state generated by the call of getPersistentState(baseField).

◆ MLBaseFieldSetPtr()

MLEXPORT void MLBaseFieldSetPtr ( mlField * baseField,
const void * value )

Sets the pointer value of the base field baseField to value.

If field is not of expected type then an error is printed and nothing is done.

◆ MLBaseGetParentType()

MLEXPORT const char * MLBaseGetParentType ( mlBase * base)

Returns object type of parent class as string.

base must be a valid pointer to a Base object otherwise it will be handled as ML_BAD_PARAMETER error and 0 will be returned.

◆ MLBaseGetType()

MLEXPORT const char * MLBaseGetType ( mlBase * base)

Returns object type as string.

base must be a valid pointer to a Base object otherwise it will be handled as ML_BAD_PARAMETER error and 0 will be returned.

◆ MLBaseGetTypeObject()

MLEXPORT mlType * MLBaseGetTypeObject ( mlBase * base)

Returns object type as type object.

base must be a valid pointer to a Base object otherwise it will be handled as ML_BAD_PARAMETER error and 0 will be returned.

◆ MLBaseIsDerivedFrom()

MLEXPORT MLint32 MLBaseIsDerivedFrom ( mlBase * base,
const char * superClassName )

Returns 1(=true) if base is derived from class with name superClassName and 0(=false) if not.

base must be a valid pointer to a Base object and superClassName a non-NULL pointer to a null terminated non-empty string. Otherwise it will be handled as a ML_BAD_PARAMETER error and 0 will be returned.

◆ MLBeginLoadFields()

MLEXPORT void MLBeginLoadFields ( mlModule * module)

Notifies the begin of the loading process in which the fields of the module are set/initialized.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and call will be ignored.

◆ MLBeginSaveFields()

MLEXPORT void MLBeginSaveFields ( mlModule * module)

Notifies the begin of the saving process in which the fields of the module are read/saved.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and call will be ignored.

◆ MLCacheGetCurrentSizeKB()

MLEXPORT MLuint64 MLCacheGetCurrentSizeKB ( )

Returns number of kilobytes currently allocated within ML cache.

◆ MLCacheGetMaxSizeKB()

MLEXPORT MLuint64 MLCacheGetMaxSizeKB ( )

Returns maximum number of kilobytes used by the ML cache.

Note that this limit can be exceeded by the ML if not possible in another way.

◆ MLCacheSetMaxSizeKB()

MLEXPORT void MLCacheSetMaxSizeKB ( MLuint64 size)

Sets maximum number of kilobytes used by the ML cache.

Note that this limit can be exceeded by the ML if not possible in another way.

◆ MLClearCache()

MLEXPORT void MLClearCache ( )

Removes all cached pages from all module outputs.

◆ MLClearMemoryImg()

MLEXPORT MLErrorCode MLClearMemoryImg ( mlField * outField)

Clears the memory image in OutputConnectorField outField if it is handled by the ML.

A manually controlled memory image is not changed. No memory will be cleared on invalid or wrongly typed outField pointers. They will be handled as errors and ML_BAD_TYPE will be returned. On successful operation ML_RESULT_OK will be returned.

◆ MLClearPages()

MLEXPORT MLErrorCode MLClearPages ( mlField * outField)

Removes all pages of the page image from the memory at output image field outField.

No pages will be cleared on invalid or wrong typed outField pointers. They will be handled as errors and ML_BAD_TYPE will be returned. On successful operation ML_RESULT_OK will be returned.

◆ MLClearPagesAndMemoryImg()

MLEXPORT MLErrorCode MLClearPagesAndMemoryImg ( mlField * outField)

Removes all pages of the page image from the memory at OutputConnectorField outField.

Also clears the memoryImg if the memoryImg mode is adequate. No pages will be cleared on invalid or wrongly typed outField pointers. They will be handled as errors and ML_BAD_TYPE will be returned. On successful operation ML_RESULT_OK will be returned.

◆ MLCreateFieldSensor()

MLEXPORT mlSensor * MLCreateFieldSensor ( void * userData,
MLSensorCB * callback )

Returns a field sensor.

It will call callback with user data userData if the field is notified. callback must be a valid pointer to an MLSensorCB function. An invalid pointer will be handled as a non fatal error and a sensor creation without callback. The created sensor must be destroyed/removed with MLDeleteFieldSensor().

◆ MLCreateModuleFromName()

MLEXPORT mlModule * MLCreateModuleFromName ( const char * className)

Creates a new instance of a module of type given by className.

className must be a non-NULL pointer to a non-empty null terminated string. Otherwise a ML_BAD_PARAMETER error will occur.

◆ MLCreateModuleFromType()

MLEXPORT mlModule * MLCreateModuleFromType ( mlType * type)

Creates a new instance of a module of type given by type.

type must be a non-NULL pointer to a valid mlRuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur.

◆ MLDeleteFieldSensor()

MLEXPORT void MLDeleteFieldSensor ( mlSensor * sensor)

Destroys the sensor sensor.

Eventually attached fields will be detached automatically before destruction. sensor must be a valid pointer to a sensor. Invalid pointers will be handled as non fatal errors and ignoring the call.

◆ MLDeleteModule()

MLEXPORT void MLDeleteModule ( mlModule * module)

Destroys/deletes a module instance module created by MLCreateModuleFromName.

NULL pointers as parameters will lead to a ML_BAD_PARAMETER error.

◆ MLDestroy()

MLEXPORT MLint32 MLDestroy ( )

Destroys the ML, frees memory allocated in MLInit() and in all other ML operations.

No ML operations are permitted after this call. On success, 1 is returned and 0 on any failure.

◆ MLEndLoadFields()

MLEXPORT void MLEndLoadFields ( mlModule * module)

Notifies the end of the loading process in which the fields of the module are set/initialized.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and call will be ignored.

◆ MLEndSaveFields()

MLEXPORT void MLEndSaveFields ( mlModule * module)

Notifies the end of the saving process in which the fields of the module are read/saved.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and call will be ignored.

◆ MLFieldConnectFrom()

MLEXPORT MLint32 MLFieldConnectFrom ( mlField * inField,
mlField * outField )

If inField is an input connector field and outField is an output connector field, the field inField is connected with the field outField and returns true (=1) if connecting was successful, false (=0) otherwise.

inField and outField must be valid field pointers, otherwise a ML_BAD_FIELD error occurs and 0 is returned.

IMPORTANT: In contrast to connecting normal fields the MLFieldConnectFrom() call from an input to an output connector field does NOT cause a notification for optimized network build and historical reasons. It is recommended to use MLFieldTouch() on the input connector field afterwards to assure that the module correctly gets the notification about the connection.

◆ MLFieldDisconnect()

MLEXPORT void MLFieldDisconnect ( mlField * inField)

If inField is an input field: Removes connection to input field inField.

Otherwise all attached fields are removed. If inField is not a valid field pointer then it will be handled as a ML_BAD_FIELD error and call is ignored.

◆ MLFieldGetDoubleValue()

MLEXPORT MLdouble MLFieldGetDoubleValue ( mlField * field)

Return the value of the DoubleField field field.

field must be a valid DoubleField pointer, otherwise it will be handled as a ML_BAD_FIELD error and 0 will be returned.

◆ MLFieldGetEnumName()

MLEXPORT const char * MLFieldGetEnumName ( mlField * field,
MLint32 i,
int * value )

Return name of the i th element of enum field field and set value to i if field type is an enum type.

If field is not a valid EnumField pointer, it will be handled as a ML_BAD_FIELD error, *value is set to -1 and an empty string is returned.

◆ MLFieldGetEnumValue()

MLEXPORT int MLFieldGetEnumValue ( mlField * field)

Returns index of selected element in the EnumField field.

If field is not a valid EnumField pointer, it will be handled as a ML_BAD_FIELD error and 0 is returned.

◆ MLFieldGetFloatValue()

MLEXPORT MLfloat MLFieldGetFloatValue ( mlField * field)

Return the value of the FloatField field.

field must be a valid FloatField pointer, otherwise it will be handled as a ML_BAD_FIELD error and 0 will be returned.

◆ MLFieldGetIntValue()

MLEXPORT MLint32 MLFieldGetIntValue ( mlField * field)

Return the value of the IntegerField field.

field must be a valid IntegerField pointer, otherwise it will be handled as a ML_BAD_FIELD error and 0 will be returned.

◆ MLFieldGetIntValue64()

MLEXPORT MLint64 MLFieldGetIntValue64 ( mlField * field)

Return the value of the IntegerField field.

field must be a valid IntegerField pointer, otherwise it will be handled as a ML_BAD_FIELD error and 0 will be returned. This version returns the field value as 64 bit integers if the ML is compiled to support 64 bit integers on 32 bit systems; the normal MLFieldGetIntValue routine remains for backward compatibility.

◆ MLFieldGetName()

MLEXPORT const char * MLFieldGetName ( mlField * field)

Returns name of field field.

◆ MLFieldGetNumEnums()

MLEXPORT size_t MLFieldGetNumEnums ( mlField * field)

Returns number of elements in the EnumField field.

If field is not a valid EnumField pointer, it will be handled as a ML_BAD_FIELD error and 0 is returned.

◆ MLFieldGetType()

MLEXPORT const char * MLFieldGetType ( mlField * field)

Return runtime data type of field field as string.

◆ MLFieldGetValue()

MLEXPORT size_t MLFieldGetValue ( mlField * field,
char * value,
size_t bufferSize )

Copies the value of field field as string into the character string value.

bufferSize is the number of characters in value which also limits the the number of copied characters. Return value is the real string size.

◆ MLFieldGetValueSize()

MLEXPORT size_t MLFieldGetValueSize ( mlField * field)

Returns string length of field value coded as string of field field.

◆ MLFieldSensorAttach()

MLEXPORT void MLFieldSensorAttach ( mlSensor * sensor,
mlField * field )

Attach the sensor sensor to the field field (any value change will be notified by the call of the callback).

sensor must be a valid pointer to a sensor, field a valid pointer to a field. Invalid pointers will be handled as non fatal errors and ignoring the call. A previously attached field will automatically be detached before attaching the new one.

◆ MLFieldSensorDetach()

MLEXPORT void MLFieldSensorDetach ( mlSensor * sensor)

Disconnects the connection between sensor sensor and its observed field.

Invalid sensor pointers will be handled as a non fatal error and ignoring the call. MLFieldSensorGetField(sensor) of this sensor will return NULL after this call.

◆ MLFieldSensorGetField()

MLEXPORT mlField * MLFieldSensorGetField ( mlSensor * sensor)

Returns the field which is observed by sensor sensor.

sensor must be a valid pointer to a sensor. Invalid pointers will be handled as non fatal errors and a NULL return. If no field is attached NULL is returned.

◆ MLFieldSetDoubleValue()

MLEXPORT void MLFieldSetDoubleValue ( mlField * field,
MLdouble value )

Set value of DoubleField field to the double value value.

field must be a valid DoubleField pointer, otherwise it will be handled as a ML_BAD_FIELD error and the call will be ignored.

◆ MLFieldSetEnumValue()

MLEXPORT void MLFieldSetEnumValue ( mlField * field,
int val )

Sets index of selected element in the EnumField field.

If field is not a valid EnumField pointer, it will be handled as a ML_BAD_FIELD error and the call is ignored.

◆ MLFieldSetFloatValue()

MLEXPORT void MLFieldSetFloatValue ( mlField * field,
MLfloat value )

Set value of FloatField field to the float value value.

field must be a valid FloatField pointer, otherwise it will be handled as a ML_BAD_FIELD error and the call will be ignored.

◆ MLFieldSetIntValue()

MLEXPORT void MLFieldSetIntValue ( mlField * field,
MLint32 value )

Set value of IntegerField field to the integer value value.

field must be a valid IntegerField pointer, otherwise it will be handled as a ML_BAD_FIELD error and the call will be ignored.

◆ MLFieldSetIntValue64()

MLEXPORT void MLFieldSetIntValue64 ( mlField * field,
MLint64 value )

Set value of IntegerField field to the integer value value.

field must be a valid IntegerField pointer, otherwise it will be handled as a ML_BAD_FIELD error and the call will be ignored. This version accepts the field value as 64 bit integers if the ML is compiled to support 64 bit integers on 32 bit systems; the normal MLFieldSetIntValue routine remains for backward compatibility.

◆ MLFieldSetValue()

MLEXPORT void MLFieldSetValue ( mlField * field,
const char * value )

Set value of field field to value.

◆ MLFieldTouch()

MLEXPORT void MLFieldTouch ( mlField * field)

Touches the field field to notify all connected fields.

If field is not a valid field pointer, it will be handled as a ML_BAD_FIELD error and call is ignored.

◆ MLGetImageState()

MLEXPORT MLErrorCode MLGetImageState ( mlField * outField)

Tries to update and then it checks an image represented by output field outField.

The return value will be ML_RESULT_OK if the image is valid and accessible. Otherwise an error code is returned.

◆ MLGetImageStateString()

MLEXPORT const char * MLGetImageStateString ( mlField * outField)

Requests the state string from an output field outField.

It tries to update the output image and then it returns a null terminated string describing the state of the output connector. This description is either the error code description of an MLErrorCode or the user defined state string when invalidating the output of a module. Passing NULL as outField will result in MLGetErrorCodeDescription(ML_DISCONNECTED_GRAPH);

◆ MLGetMaxNumThreads()

MLEXPORT MLuint32 MLGetMaxNumThreads ( )

Returns the currently set number of parallel threads which the ML might use.

If 1 is set, multithreading is disabled.

◆ MLGetMemoryImgSize()

MLEXPORT MLErrorCode MLGetMemoryImgSize ( mlField * outField,
size_t * numBytes )

Returns currently used size of memory image of OutputConnectorField outField in bytes.

*numBytes will be 0 on invalid or wrongly typed outField pointers. They will be handled as errors and ML_BAD_TYPE will be returned. On successful operation ML_RESULT_OK will be returned.

◆ MLGetPageMemorySize()

MLEXPORT MLErrorCode MLGetPageMemorySize ( mlField * outField,
size_t * numBytes )

Returns currently used cache size for pages of the image in OutputConnectorField outField in bytes.

*numBytes will be 0 on invalid or wrongly typed outField pointers. They will be handled as errors and ML_BAD_TYPE will be returned. On successful operation ML_RESULT_OK will be returned.

◆ MLHostSetBreakCheckCB()

MLEXPORT void MLHostSetBreakCheckCB ( void * userData,
MLHostBreakCheckCB * callback )

Sets a callback to provide break checking of current calculation.

◆ MLHostSetProgressCB()

MLEXPORT void MLHostSetProgressCB ( void * userData,
MLHostProgressCB * callback )

Sets a callback to provide feedback of the host calculation progress.

◆ MLHostUpdateProgress()

MLEXPORT void MLHostUpdateProgress ( const char * info1,
const char * info2 )

Calls the callback set MLHostSetProgressCB manually (this is used by the InventorWrapper module).

◆ MLImageFieldConnectFromNoNotify()

MLEXPORT MLint32 MLImageFieldConnectFromNoNotify ( mlField * inField,
mlField * outField )

Connects connectors of input connector field inField with the connector of the output connector field outField and returns true (=1) if connection is successful, otherwise false (= 0).

Note that this connection is NOT a field connection and so notifications are NOT propagated through this connection. Only a data transfer connection is established. (Used for macro module connections) inField must be a non-NULL InputConnectorField pointer and outField must be a non-NULL OutputConnectorField pointer, else ML_BAD_FIELD errors will occur and 0 will be returned.

◆ MLImageFreeTile()

MLEXPORT void MLImageFreeTile ( void * data)

Frees the memory created/allocated by any of the functions MLImageGetTile*() or MLImageGetScaledTile*().

◆ MLImageGetFirstImagePropertyExtensionByType()

MLEXPORT MLErrorCode MLImageGetFirstImagePropertyExtensionByType ( mlField * outField,
const char * imagePropertyTypeClassName,
void ** imagePropertyExtension )

Returns the first image property extension imagePropertyExtension (as void-Pointer) of type imagePropertyTypeClassName of the image represented by output field outField.

◆ MLImageGetMaxValue()

MLEXPORT MLErrorCode MLImageGetMaxValue ( mlField * outField,
MLdouble * maxValue )

Returns the maximum voxel value maxValue of the image represented by output field outField.

◆ MLImageGetMinValue()

MLEXPORT MLErrorCode MLImageGetMinValue ( mlField * outField,
MLdouble * minValue )

Returns minimum voxel value minValue of the image represented by output field outField.

◆ MLImageGetPageSize6D()

MLEXPORT MLErrorCode MLImageGetPageSize6D ( mlField * outField,
int * x,
int * y,
int * z,
int * c,
int * t,
int * u )

Determines the page size of the image represented by output field outField.

The return values are: x, y, z - the spacial resolution, c - the number of color channels, t - the number of time points and u - the extent of an additional dimension for arbitrary purposes. On any failure the result values are x=y=z=c=t=u=0. The return value will be ML_RESULT_OK on success and the corresponding error code otherwise.

◆ MLImageGetScaledTile()

MLEXPORT MLErrorCode MLImageGetScaledTile ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint nx,
MLint ny,
MLint nz,
MLDataType datatype,
MLdouble srcMin,
MLdouble srcMax,
MLdouble dstMin,
MLdouble dstMax )

Exactly like MLImageGetScaledTile3D().

◆ MLImageGetScaledTile3D()

MLEXPORT MLErrorCode MLImageGetScaledTile3D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint nx,
MLint ny,
MLint nz,
MLDataType datatype,
MLdouble srcMin,
MLdouble srcMax,
MLdouble dstMin,
MLdouble dstMax )

Like MLImageGetScaledTile6D(), only for 3 dimensional regions, (i.e., t=u=0 and nt=nt=1)

◆ MLImageGetScaledTile4D()

MLEXPORT MLErrorCode MLImageGetScaledTile4D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint c,
MLint nx,
MLint ny,
MLint nz,
MLint nc,
MLDataType datatype,
MLdouble srcMin,
MLdouble srcMax,
MLdouble dstMin,
MLdouble dstMax )

Like MLImageGetScaledTile6D(), only for 4 dimensional regions, (i.e., t=u=0 and nt=nt=1)

◆ MLImageGetScaledTile6D()

MLEXPORT MLErrorCode MLImageGetScaledTile6D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint c,
MLint t,
MLint u,
MLint nx,
MLint ny,
MLint nz,
MLint nc,
MLint nt,
MLint nu,
MLDataType datatype,
MLdouble srcMin,
MLdouble srcMax,
MLdouble dstMin,
MLdouble dstMax )

Like MLImageGetTile6D().

Anyway, the resulting memory can be scaled to another interval. It is assumed that the input image data range is from [ srcMin, srcMax ] and will be scaled to [ dstMin, dstMax ].

◆ MLImageGetSize()

MLEXPORT MLErrorCode MLImageGetSize ( mlField * outField,
int * x,
int * y,
int * z,
int * c )

Like MLImageGetSize6D, only for 4D. The last two extents are ignored.

◆ MLImageGetSize6D()

MLEXPORT MLErrorCode MLImageGetSize6D ( mlField * outField,
int * x,
int * y,
int * z,
int * c,
int * t,
int * u )

Determines the size of the image represented by output field outField.

The return values are: x, y, z - the spacial resolution, c - the number of color channels, t - the number of time points and u - the extent of an additional dimension for arbitrary purposes. On any failure the result values are x=y=z=c=t=u=0. The return value will be ML_RESULT_OK on success and the corresponding error code otherwise.

◆ MLImageGetTile()

MLEXPORT MLErrorCode MLImageGetTile ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint nx,
MLint ny,
MLint nz,
MLDataType datatype )

Exactly like MLImageGetTile3D().

◆ MLImageGetTile3D()

MLEXPORT MLErrorCode MLImageGetTile3D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint nx,
MLint ny,
MLint nz,
MLDataType datatype )

Like MLImageGetTile6D(), only for 3 dimensional regions, (i.e., c=t=u=0 and nc=nt=nu=1)

◆ MLImageGetTile4D()

MLEXPORT MLErrorCode MLImageGetTile4D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint c,
MLint nx,
MLint ny,
MLint nz,
MLint nc,
MLDataType datatype )

Like MLImageGetTile6D(), only for 4 dimensional regions, (i.e., t=u=0 and nt=nt=1)

◆ MLImageGetTile6D()

MLEXPORT MLErrorCode MLImageGetTile6D ( mlField * outField,
void ** memory,
MLint x,
MLint y,
MLint z,
MLint c,
MLint t,
MLint u,
MLint nx,
MLint ny,
MLint nz,
MLint nc,
MLint nt,
MLint nu,
MLDataType datatype )

Calculates a 6d rectangular region of the input image given by output field outField and returns a pointer to calculated data in *memory.

outField must be a non-NULL pointer to a OutputConnectorField, otherwise a ML_BAD_FIELD error will occur, the call will be ignored and ML_BAD_FIELD will be returned. The origin coordinate of the region to be calculated is x, y, z, c, t, u, the extents are nx, ny, nz, nc, nt, nu, and the data type is specified by datatype. Note that the specified region may reach outside the valid image ranges. The data calculated from those regions will be supplied normally in *memory but the content will be undefined. If *memory is a null pointer then the memory needed for the image region is allocated automatically and *memory is set to the memory area. It must be freed with the function MLImageFreeTile(). On successful operation ML_RESULT_OK is returned, otherwise an error describing code.

◆ MLImageGetType()

MLEXPORT MLErrorCode MLImageGetType ( mlField * outField,
MLDataType * dtype,
size_t * dsize )

Determines the data type dtype and its size dsize in bytes of the image represented by the output field outField.

On success the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and dtype and dsize will be undefined.

◆ MLImageGetVoxelSize()

MLEXPORT MLErrorCode MLImageGetVoxelSize ( mlField * outField,
MLfloat * x,
MLfloat * y,
MLfloat * z )

Determines the voxel size x / y / z of the image represented by the output field outField.

On success the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and x, y and z will be undefined.

◆ MLImageGetVoxelSizeInDoubles()

MLEXPORT MLErrorCode MLImageGetVoxelSizeInDoubles ( mlField * outField,
MLdouble * x,
MLdouble * y,
MLdouble * z )

Determines the voxel size x / y / z of the image represented by the output field outField.

On success the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and x, y and z will be undefined.

◆ MLImageGetVoxelToWorldMatrix()

MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrix ( mlField * outField,
MLfloat [16] )

Returns the VoxelToWorldMatrix of the image represented by output field outField.

◆ MLImageGetVoxelToWorldMatrixInDoubles()

MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrixInDoubles ( mlField * outField,
MLdouble [16] )

Returns the VoxelToWorldMatrix of the image represented by output field outField.

◆ MLImageGetWorldToVoxelMatrix()

MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrix ( mlField * outField,
MLfloat [16] )

Returns the WorldToVoxelMatrix of the image represented by output field outField.

◆ MLImageGetWorldToVoxelMatrixInDoubles()

MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrixInDoubles ( mlField * outField,
MLdouble [16] )

Returns the WorldToVoxelMatrix of the image represented by output field outField.

◆ MLImageMapVoxelToWorld()

MLEXPORT MLErrorCode MLImageMapVoxelToWorld ( mlField * outField,
MLfloat srcX,
MLfloat srcY,
MLfloat srcZ,
MLfloat * dstX,
MLfloat * dstY,
MLfloat * dstZ )

Transforms the given position (srcX, srcY, scrZ) from voxel to world coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.

On success, the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and an error will be printed.

◆ MLImageMapVoxelToWorldInDoubles()

MLEXPORT MLErrorCode MLImageMapVoxelToWorldInDoubles ( mlField * outField,
MLdouble srcX,
MLdouble srcY,
MLdouble srcZ,
MLdouble * dstX,
MLdouble * dstY,
MLdouble * dstZ )

Transforms the given position (srcX, srcY, scrZ) from voxel to world coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.

On success, the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and an error will be printed.

◆ MLImageMapWorldToVoxel()

MLEXPORT MLErrorCode MLImageMapWorldToVoxel ( mlField * outField,
MLfloat srcX,
MLfloat srcY,
MLfloat srcZ,
MLfloat * dstX,
MLfloat * dstY,
MLfloat * dstZ )

Transforms the given position (srcX, srcY, scrZ) from world to voxel coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.

On success, the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and an error will be printed.

◆ MLImageMapWorldToVoxelInDoubles()

MLEXPORT MLErrorCode MLImageMapWorldToVoxelInDoubles ( mlField * outField,
MLdouble srcX,
MLdouble srcY,
MLdouble srcZ,
MLdouble * dstX,
MLdouble * dstY,
MLdouble * dstZ )

Transforms the given position (srcX, srcY, scrZ) from world to voxel coordinates (dstX, dstY, dstZ) by using the transformation matrix of the image represented by the output field outField.

On success, the return value will be ML_RESULT_OK. Otherwise the return value will be the corresponding error code and an error will be printed.

◆ MLInit()

MLEXPORT MLint32 MLInit ( MLint32 majorVersion,
MLint32 majorCAPIVersion,
MLint32 revCAPI )

Calls the C++ initialization of the ML.

Must be called before any ML or mlAPI usage.

Returns
true (=1) on success, false(=0) otherwise. The return value 0 should be considered fatal, i.e., some basic system properties are not sufficient, required libraries are not found, not enough memory, invalid library versions or something like that.
Parameters
majorVersionshould always be ML_MAJOR_VERSION.
majorCAPIVersionshould always be ML_MAJOR_CAPI_VERSION.
revCAPIshould always be ML_CAPI_REVISION.

Multiple calls are legal but will not change any previous initialization. Note that this call does not check C++ compatibility of the ML since this call is typically used by applications which only require C-API compatibility. C++ applications should also check MLIsCPPAPILinkCompatible for a non 0 return value.

◆ MLIsCurrentlyUnloadingLibrary()

MLEXPORT MLuint32 MLIsCurrentlyUnloadingLibrary ( )

This function returns true(=1) if an ML library is currently unloaded, otherwise false (=0).

◆ MLLoadLibrary()

MLEXPORT MLint32 MLLoadLibrary ( const char * name)

Loads the given shared library.

name must be a non-NULL pointer to a non-empty null terminated string. Otherwise a fatal error will occur. On successful library load true (=1) is returned, on error false(=0) is returned. Any error will be posted to the ML error handler. As a side effect the most recently loaded library name is updated to the library name (see Runtime::setRecentlyLoadedDllName for more infos) and the initialization of the loaded library is called implicitly.

◆ MLLoadLibraryWOError()

MLEXPORT MLErrorCode MLLoadLibraryWOError ( const char * name)

Same as MLLoadLibraryWOErrorExt with libHandle=NULL.

◆ MLLoadLibraryWOErrorExt()

MLEXPORT MLErrorCode MLLoadLibraryWOErrorExt ( const char * name,
MLLibraryHandle * libHandle )

Loads the given shared library.

name must be a non-NULL pointer to a non empty null terminated string. Otherwise a fatal error will occur.

Note
MeVisLab uses its own library loading and will not call this function.

Returns ML_RESULT_OK in case of successful library load or an error code describing the error (e.g., ML_LIBRARY_LOAD_ERROR if the library is not found or not linked).

As a side effect the most recently loaded library name is updated to the library name (see Runtime::setRecentlyLoadedDllName for more infos) and the initialization of the loaded library is called implicitly. Errors are posted only on invalid parameters, crashes on library initialization, but NOT if the library is not found or not loadable. So this library can be used to check for a library and to handle unloadable libraries without errors. If libHandle is passed as NULL pointer then it is ignored; otherwise *libHandle is set to the return value of the library load function. It will be needed to unload the library with MLUnLoadLibrary.

◆ MLModuleGetField()

MLEXPORT mlField * MLModuleGetField ( mlModule * module,
const char * name )

Return field with name name of module.

Return 0 (NULL) if it does not exist. module must be a valid pointer to a ml::Module object and name must be a non-NULL pointer to a null terminated non-empty string. Otherwise it will be handled as a ML_BAD_PARAMETER error and 0 will be returned.

◆ MLModuleGetIndexedField()

MLEXPORT mlField * MLModuleGetIndexedField ( mlModule * module,
MLint32 n )

Return field with index from [0..getNumFields-1] of module if field exists; otherwise 0 (NULL) is returned.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and 0 will be returned.

◆ MLModuleGetNumFields()

MLEXPORT size_t MLModuleGetNumFields ( mlModule * module)

Return number of fields contained in module.

module must be a valid pointer to a ml::Module object. Otherwise it will be handled as a ML_BAD_PARAMETER error and 0 will be returned.

◆ MLModuleSetFieldValue()

MLEXPORT void MLModuleSetFieldValue ( mlModule * module,
char * fieldName,
char * value )

Sets field with name fieldName of module to value value.

module must be a valid pointer to a ml::Module object and fieldName and value must be pointers to null terminated strings where fieldName also must must be non-empty. Otherwise they will be handled as a ML_BAD_PARAMETER errors and call will be ignored.

◆ MLPointerFieldGetPtr()

MLEXPORT void * MLPointerFieldGetPtr ( mlField * field)

Returns the value of the pointer field field.

A field of unexpected type or an invalid field pointer is handled as a non fatal error and a NULL return.

◆ MLPointerFieldSetPtr()

MLEXPORT void MLPointerFieldSetPtr ( mlField * field,
const void * value )

Sets the value of the pointer field field to value.

The pointer value may be NULL. A field of unexpected type or an invalid field pointer is handled as a non fatal error and ignoring the call.

◆ MLSendMessagesToCerr()

MLEXPORT void MLSendMessagesToCerr ( MLint32 on)

If 0 is passed as on, message sending to std::cerr is disabled.

Otherwise all messages are printed to std::cerr.

◆ MLSendMessagesToCout()

MLEXPORT void MLSendMessagesToCout ( MLint32 on)

If 0 is passed as on, message sending to std::cout is disabled.

Otherwise all messages are printed to std::cout.

◆ MLSetIsCurrentlyUnloadingLibrary()

MLEXPORT MLuint32 MLSetIsCurrentlyUnloadingLibrary ( MLuint32 enable)

This function allows to set the MLIsCurrentlyUnloadingLibrary state and returns the previously set unloading state.

It may be used when library unloading is triggered by an external program instead of using MLUnLoadLibrary.

◆ MLSetMaxNumThreads()

MLEXPORT MLErrorCode MLSetMaxNumThreads ( MLuint32 numThreads)

Sets the number of parallel threads which the ML might use.

Legal values for numThreads are positive numbers > 0, otherwise a ML_BAD_PARAMETER error will occur. If 1 is set, multithreading is disabled.

◆ MLSoNodeFieldGetPtr()

MLEXPORT void * MLSoNodeFieldGetPtr ( mlField * field)

Returns the value of the SoNode field field.

A field of unexpected type or an invalid field pointer is handled as a non fatal error and a NULL return.

◆ MLSoNodeFieldSetPtr()

MLEXPORT void MLSoNodeFieldSetPtr ( mlField * field,
const void * value )

Sets the pointer value of the SoNode field field to value.

The pointer value may be NULL. A field of unexpected type or an invalid field pointer is handled as a non fatal error and ignoring the call.

◆ MLTypeFromName()

MLEXPORT mlType * MLTypeFromName ( const char * name)

Returns type object for given name. 0 will be returned if the type described by name is unknown.

◆ MLTypeGetDllName()

MLEXPORT const char * MLTypeGetDllName ( mlType * type)

Returns pointer to a null terminated string containing the string name of the dll probably containing the code and/or the init function of the class represented by type.

type must be a non-NULL pointer to a valid mlRuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur and NULL is returned.

◆ MLTypeGetName()

MLEXPORT const char * MLTypeGetName ( mlType * type)

Returns pointer to a null terminated string containing the name of the class represented by type.

type must be a non-NULL pointer to a valid mlRuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur and NULL is returned.

◆ MLTypeGetParentName()

MLEXPORT const char * MLTypeGetParentName ( mlType * type)

Returns pointer to a null terminated string containing the name of the parent class of that represented by type.

A pointer to "No parent" is returned if there is no such class. type must be a non-NULL pointer to a valid mlRuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur and NULL is returned.

◆ MLTypeGetParentType()

MLEXPORT mlType * MLTypeGetParentType ( mlType * type)

Returns pointer to the RuntimeType instance representing the type of the parent class of that represented by type.

A NULL pointer is returned if there is no such class. type must be a non-NULL pointer to a valid RuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur and NULL is returned.

◆ MLTypeIsAbstract()

MLEXPORT MLint32 MLTypeIsAbstract ( mlType * type)

Returns true (== 1) if type is abstract, otherwise 0 (=false).

type must be a non-NULL pointer to a valid mlRuntimeType object. Otherwise a ML_BAD_PARAMETER error will occur. -1 is return value after such or fatal errors.

◆ MLTypeIsDerivedFrom()

MLEXPORT MLint32 MLTypeIsDerivedFrom ( mlType * type,
const char * parent )

Returns true (== 1) if runtime type type is derived from the parent class with the name given by parent.

The return value is false (== 0) if not or on errors or if any of type or parent is NULL (which is legal to pass to the call). The non-NULL type must be a pointer to a valid RuntimeType object and parent a pointer to a null terminated string containing the name of the parent class.

◆ MLUnLoadLibrary()

MLEXPORT MLErrorCode MLUnLoadLibrary ( const char * name,
MLLibraryHandle libHandle,
char ** errStr )

Unloads the given shared library.

name must be a non-NULL pointer to a non-empty null terminated string. Otherwise a fatal error will occur. Returns ML_RESULT_OK in case of successful library unload or an error code describing the error.

Note
MeVisLab uses its own library unloading and will not call this function.

The libHandle parameter must be the corresponding library handle created by MLLoadLibraryWOErrorExt for successful operation. The responsibility for safe removal of the library is completely up to the application - the ML cannot check completely whether - for example - other libraries depend on the unloaded one. If errStr is passed as a non-NULL pointer then it is set to a string describing the error. *errStr must always be freed with MLFree(). Note that detection of references is limited to ML type; it does not cover all possible link references etc.

Note that library unloading has a number of side effects:

  • All runtime types registered in the runtime type system are removed;
  • The library is not removed if other libraries still use it.
  • If instances of classes of the library exist the library can be unloaded; however those libraries will not operate safely any more. It is possible to load new code for that library again; whether the already existing instances will operate safely again depends on the content of the reloaded library. This behavior should not be considered reliable.
  • Opened resources not closed properly by the library programmer may remain open (for example type registrations in other type systems than the one of the ML, initialized device drivers etc.). Thus use this function only with extreme care.