MeVisLab Toolbox Reference
mlAPI.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
22
23#ifdef WIN32
24 #include <ThirdPartyWarningsDisable.h>
25 #include <windows.h>
26 #include <ThirdPartyWarningsRestore.h>
27#endif
28
29// Attention: All includes must be pure C!
30
32#ifndef ML_DISABLE_CPP
33#define ML_DISABLE_CPP
34#endif
35
37#include "mlInitSystemML.h"
38
40#undef ML_DISABLE_CPP
41
43#include "mlUtilsAPI.h"
44
46#include "mlVersion.h"
47
48
49//-----------------------------------------------------------------------------------
52//-----------------------------------------------------------------------------------
54#define mlField void
55
57#define mlSensor void
58
60#define mlModule void
61
63#define mlBase void
64
66#define mlType void
67
68#ifdef WIN32
71 typedef HMODULE MLLibraryHandle;
72#else
74 typedef void* MLLibraryHandle;
75#endif
76
77
79
80#ifdef __cplusplus
81extern "C" {
82#endif
83
84
85//-----------------------------------------------------------------------------------
88//-----------------------------------------------------------------------------------
105MLEXPORT MLint32 MLInit(MLint32 majorVersion, MLint32 majorCAPIVersion, MLint32 revCAPI);
106
111
113MLEXPORT void MLHostSetProgressCB(void* userData, MLHostProgressCB* callback);
114
117MLEXPORT void MLHostUpdateProgress(const char* info1, const char* info2);
118
120MLEXPORT void MLHostSetBreakCheckCB(void* userData, MLHostBreakCheckCB* callback);
122
123//-----------------------------------------------------------------------------------
126//-----------------------------------------------------------------------------------
146[[nodiscard]]
148
150[[nodiscard]]
152
161
165
170
203[[nodiscard]]
205 MLLibraryHandle libHandle,
206 char** errStr);
207
209
210
211
212//-----------------------------------------------------------------------------------
215//-----------------------------------------------------------------------------------
220
224
230MLEXPORT MLint32 MLBaseIsDerivedFrom(mlBase* base, const char* superClassName);
231
234MLEXPORT const char* MLBaseGetType(mlBase* base);
235
239
244
249
251MLEXPORT mlType* MLTypeFromName(const char* name);
252
257
262MLEXPORT const char* MLTypeGetName(mlType* type);
263
269
276
282
289MLEXPORT MLint32 MLTypeIsDerivedFrom(mlType* type, const char* parent);
291
292
293
294//-----------------------------------------------------------------------------------
297//-----------------------------------------------------------------------------------
303MLEXPORT mlField* MLModuleGetField(mlModule* module, const char* name);
304
309
315
321MLEXPORT void MLModuleSetFieldValue(mlModule* module, char* fieldName, char* value);
323
324
325
326//-----------------------------------------------------------------------------------
329//-----------------------------------------------------------------------------------
335
341
347
354
355
356
357//-----------------------------------------------------------------------------------
360//-----------------------------------------------------------------------------------
362MLEXPORT const char* MLFieldGetName(mlField* field);
363
365MLEXPORT const char* MLFieldGetType(mlField* field);
366
368MLEXPORT void MLFieldSetValue(mlField* field, const char* value);
369
372
376MLEXPORT size_t MLFieldGetValue(mlField* field, char* value, size_t bufferSize);
377
382
387
392
397
402
410
415
424
425
426
427//-----------------------------------------------------------------------------------
430//-----------------------------------------------------------------------------------
435
440
445
450MLEXPORT const char* MLFieldGetEnumName(mlField* field, MLint32 i, int* value);
452
453
454
455//-----------------------------------------------------------------------------------
458//-----------------------------------------------------------------------------------
472
483
489
495
496
497
498//-----------------------------------------------------------------------------------
501//-----------------------------------------------------------------------------------
516[[nodiscard]]
518 MLint x, MLint y, MLint z, MLint c, MLint t, MLint u,
519 MLint nx, MLint ny, MLint nz, MLint nc, MLint nt, MLint nu,
520 MLDataType datatype);
521
522
524[[nodiscard]]
526 MLint x, MLint y, MLint z, MLint c,
527 MLint nx, MLint ny, MLint nz, MLint nc,
528 MLDataType datatype);
529
530
532[[nodiscard]]
534 MLint x, MLint y, MLint z,
535 MLint nx, MLint ny, MLint nz,
536 MLDataType datatype);
537
538
540[[nodiscard]]
542 MLint x, MLint y, MLint z,
543 MLint nx, MLint ny, MLint nz,
544 MLDataType datatype);
545
546
547
551[[nodiscard]]
553 MLint x, MLint y, MLint z, MLint c, MLint t, MLint u,
554 MLint nx, MLint ny, MLint nz, MLint nc, MLint nt, MLint nu,
555 MLDataType datatype,
556 MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax);
557
558
560[[nodiscard]]
562 MLint x, MLint y, MLint z, MLint c,
563 MLint nx, MLint ny, MLint nz, MLint nc,
564 MLDataType datatype,
565 MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax);
566
567
569[[nodiscard]]
571 MLint x, MLint y, MLint z,
572 MLint nx, MLint ny, MLint nz,
573 MLDataType datatype,
574 MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax);
575
576
578[[nodiscard]]
580 MLint x, MLint y, MLint z,
581 MLint nx, MLint ny, MLint nz,
582 MLDataType datatype,
583 MLdouble srcMin, MLdouble srcMax, MLdouble dstMin, MLdouble dstMax);
584
587MLEXPORT void MLImageFreeTile(void *data);
589
590
591//-----------------------------------------------------------------------------------
594//-----------------------------------------------------------------------------------
595
598
602
606
613
620
627
632MLEXPORT MLErrorCode MLGetPageMemorySize(mlField* outField, size_t* numBytes);
633
638MLEXPORT MLErrorCode MLGetMemoryImgSize(mlField* outField, size_t *numBytes);
639
643
644
645
646
647//-----------------------------------------------------------------------------------
650//-----------------------------------------------------------------------------------
654[[nodiscard]]
656
665[[nodiscard]]
667
676MLEXPORT MLErrorCode MLImageGetSize6D(mlField* outField, int *x, int *y, int *z, int *c, int *t, int *u);
677
686MLEXPORT MLErrorCode MLImageGetPageSize6D(mlField* outField, int *x, int *y, int *z, int *c, int *t, int *u);
687
688
690MLEXPORT MLErrorCode MLImageGetSize(mlField* outField, int *x, int *y, int *z, int *c);
691
696MLEXPORT MLErrorCode MLImageGetType(mlField* outField, MLDataType* dtype, size_t* dsize);
697
703
709
712[[nodiscard]]
714 const char* imagePropertyTypeClassName,
715 void** imagePropertyExtension);
716
719
722
725
728
731
734
741 MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ);
742
749 MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ);
750
757 MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ);
758
765 MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ);
767
768
769
770//-----------------------------------------------------------------------------------
773//-----------------------------------------------------------------------------------
774
780
783MLEXPORT void MLBaseFieldSetPersistentState(mlField* baseField, const char* state);
784
789
793
796MLEXPORT void MLBaseFieldSetPtr(mlField* baseField, const void *value);
798
799
800
801//-----------------------------------------------------------------------------------
804//-----------------------------------------------------------------------------------
805
810
815MLEXPORT void MLSoNodeFieldSetPtr(mlField* field, const void* value);
816
817
822
827MLEXPORT void MLPointerFieldSetPtr(mlField* field, const void* value);
828
830
831
832
833//-----------------------------------------------------------------------------------
836//-----------------------------------------------------------------------------------
843
848
853
860
867
868
869//---------------------------------------------------------------------------------------------
872//---------------------------------------------------------------------------------------------
876
880
884
889
890
891//-----------------------------------------------------------------------------------
894//-----------------------------------------------------------------------------------
899
904
905#ifdef __cplusplus
906}
907#endif
908
909
910
MLint32 MLDataType
Definition mlTypeDefs.h:595
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
MLEXPORT size_t MLFieldGetValueSize(mlField *field)
Returns the string length of field value coded as string of field field.
MLEXPORT MLErrorCode MLGetPageMemorySize(mlField *outField, size_t *numBytes)
MLEXPORT void MLImageFreeTile(void *data)
MLEXPORT MLErrorCode MLLoadLibraryWOErrorExt(const char *name, MLLibraryHandle *libHandle)
#define mlModule
A macro name for a void pointer to an ml::Module in the ML to make the pointer more readable.
Definition mlAPI.h:60
MLEXPORT void MLDeleteModule(mlModule *module)
MLEXPORT void * MLPointerFieldGetPtr(mlField *field)
MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrix(mlField *outField, MLfloat[16])
Returns the VoxelToWorldMatrix of the image represented by output field outField.
MLEXPORT MLint64 MLFieldGetIntValue64(mlField *field)
MLEXPORT void MLFieldSetIntValue(mlField *field, MLint32 value)
MLEXPORT MLint32 MLFieldGetIntValue(mlField *field)
MLEXPORT void MLFieldSetValue(mlField *field, const char *value)
Sets the value of field field to value.
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 mlType * MLTypeGetParentType(mlType *type)
MLEXPORT void MLHostUpdateProgress(const char *info1, const char *info2)
MLEXPORT MLfloat MLFieldGetFloatValue(mlField *field)
MLEXPORT const char * MLBaseGetType(mlBase *base)
MLEXPORT mlField * MLFieldSensorGetField(mlSensor *sensor)
MLEXPORT void MLSoNodeFieldSetPtr(mlField *field, const void *value)
MLEXPORT MLuint64 MLCacheGetCurrentSizeKB()
Returns the number of kilobytes currently allocated within the ML cache.
MLEXPORT void MLSendMessagesToCout(MLint32 on)
MLEXPORT MLint32 MLAreMessagesSentToCerr()
MLEXPORT void MLBeginLoadFields(mlModule *module)
MLEXPORT void MLDeleteFieldSensor(mlSensor *sensor)
MLEXPORT mlModule * MLCreateModuleFromType(mlType *type)
MLEXPORT void MLFieldSetEnumValue(mlField *field, int val)
MLEXPORT void MLPointerFieldSetPtr(mlField *field, const void *value)
MLEXPORT void MLHostSetBreakCheckCB(void *userData, MLHostBreakCheckCB *callback)
Sets a callback to provide break checking of current calculation.
MLEXPORT MLuint32 MLGetMaxNumThreads()
HMODULE MLLibraryHandle
Definition mlAPI.h:71
MLEXPORT void MLEndLoadFields(mlModule *module)
MLEXPORT MLErrorCode MLGetMemoryImgSize(mlField *outField, size_t *numBytes)
MLEXPORT void MLBaseFieldSetPtr(mlField *baseField, const void *value)
MLEXPORT void MLHostSetProgressCB(void *userData, MLHostProgressCB *callback)
Sets a callback to provide feedback of the host calculation progress.
MLEXPORT MLErrorCode MLUnLoadLibrary(const char *name, MLLibraryHandle libHandle, char **errStr)
MLEXPORT MLErrorCode MLClearPagesAndMemoryImg(mlField *outField)
MLEXPORT const char * MLBaseGetParentType(mlBase *base)
MLEXPORT mlField * MLModuleGetField(mlModule *module, const char *name)
MLEXPORT mlModule * MLCreateModuleFromName(const char *className)
MLEXPORT MLErrorCode MLImageGetVoxelSizeInDoubles(mlField *outField, MLdouble *x, MLdouble *y, MLdouble *z)
MLEXPORT const char * MLBaseFieldGetPersistentState(mlField *baseField)
MLEXPORT void MLBeginSaveFields(mlModule *module)
MLEXPORT MLuint64 MLCacheGetMaxSizeKB()
MLEXPORT void MLModuleSetFieldValue(mlModule *module, char *fieldName, char *value)
MLEXPORT void MLEndSaveFields(mlModule *module)
MLEXPORT MLErrorCode MLImageGetType(mlField *outField, MLDataType *dtype, size_t *dsize)
#define mlBase
A macro name for a void pointer to a base object in the ML to make the pointer more readable.
Definition mlAPI.h:63
MLEXPORT void MLFieldSensorAttach(mlSensor *sensor, mlField *field)
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)
MLEXPORT mlSensor * MLCreateFieldSensor(void *userData, MLSensorCB *callback)
MLEXPORT void MLFieldSensorDetach(mlSensor *sensor)
MLEXPORT MLErrorCode MLLoadLibraryWOError(const char *name)
Same as MLLoadLibraryWOErrorExt with libHandle=NULL.
MLEXPORT MLint32 MLLoadLibrary(const char *name)
MLEXPORT MLdouble MLFieldGetDoubleValue(mlField *field)
MLEXPORT const char * MLTypeGetName(mlType *type)
MLEXPORT const char * MLGetImageStateString(mlField *outField)
MLEXPORT int MLFieldGetEnumValue(mlField *field)
MLEXPORT const char * MLTypeGetDllName(mlType *type)
#define mlType
A macro name for a void pointer to a runtime type in the ML to make the pointer more readable.
Definition mlAPI.h:66
MLEXPORT void MLSendMessagesToCerr(MLint32 on)
MLEXPORT void MLBaseFieldSetPersistentState(mlField *baseField, const char *state)
MLEXPORT MLint32 MLTypeIsDerivedFrom(mlType *type, const char *parent)
MLEXPORT MLErrorCode MLImageGetMaxValue(mlField *outField, MLdouble *maxValue)
Returns the maximum voxel value maxValue of the image represented by output field outField.
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 four dimensional regions (i.e., t=u=0 and nt=nt=1).
MLEXPORT MLint32 MLTypeIsAbstract(mlType *type)
MLEXPORT MLErrorCode MLClearMemoryImg(mlField *outField)
MLEXPORT mlField * MLModuleGetIndexedField(mlModule *module, MLint32 n)
MLEXPORT void * MLSoNodeFieldGetPtr(mlField *field)
MLEXPORT mlType * MLBaseGetTypeObject(mlBase *base)
MLEXPORT MLint32 MLBaseIsDerivedFrom(mlBase *base, const char *superClassName)
MLEXPORT MLErrorCode MLImageGetMinValue(mlField *outField, MLdouble *minValue)
Returns the minimum voxel value minValue of the image represented by output field outField.
MLEXPORT void MLBaseFieldClearPersistentState(mlField *baseField, char *state)
MLEXPORT void * MLBaseFieldGetPtr(mlField *field)
MLEXPORT MLErrorCode MLImageMapVoxelToWorldInDoubles(mlField *outField, MLdouble srcX, MLdouble srcY, MLdouble srcZ, MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ)
MLEXPORT void MLFieldSetDoubleValue(mlField *field, MLdouble value)
#define mlField
A macro name for a void pointer to a field in the ML to make the pointer more readable.
Definition mlAPI.h:54
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)
MLEXPORT MLint32 MLAreMessagesSentToCout()
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 const char * MLTypeGetParentName(mlType *type)
MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrix(mlField *outField, MLfloat[16])
Returns the WorldToVoxelMatrix of the image represented by output field outField.
MLEXPORT MLErrorCode MLClearPages(mlField *outField)
MLEXPORT void MLClearCache()
Removes all cached pages from all module outputs.
MLEXPORT void MLFieldSetFloatValue(mlField *field, MLfloat value)
MLEXPORT MLint32 MLFieldConnectFrom(mlField *inField, mlField *outField)
MLEXPORT MLErrorCode MLImageGetPageSize6D(mlField *outField, int *x, int *y, int *z, int *c, int *t, int *u)
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 void MLFieldDisconnect(mlField *inField)
MLEXPORT size_t MLFieldGetNumEnums(mlField *field)
MLEXPORT MLint32 MLImageFieldConnectFromNoNotify(mlField *inField, mlField *outField)
MLEXPORT MLint32 MLDestroy()
MLEXPORT MLErrorCode MLImageGetVoxelSize(mlField *outField, MLfloat *x, MLfloat *y, MLfloat *z)
MLEXPORT MLuint32 MLSetIsCurrentlyUnloadingLibrary(MLuint32 enable)
MLEXPORT MLErrorCode MLGetImageState(mlField *outField)
MLEXPORT MLint32 MLInit(MLint32 majorVersion, MLint32 majorCAPIVersion, MLint32 revCAPI)
MLEXPORT void MLFieldSetIntValue64(mlField *field, MLint64 value)
MLEXPORT const char * MLFieldGetEnumName(mlField *field, MLint32 i, int *value)
MLEXPORT MLErrorCode MLSetMaxNumThreads(MLuint32 numThreads)
MLEXPORT MLErrorCode MLImageGetWorldToVoxelMatrixInDoubles(mlField *outField, MLdouble[16])
Returns the WorldToVoxelMatrix of the image represented by output field outField.
MLEXPORT MLErrorCode MLImageMapWorldToVoxel(mlField *outField, MLfloat srcX, MLfloat srcY, MLfloat srcZ, MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ)
MLEXPORT void MLFieldTouch(mlField *field)
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 four dimensional regions (i.e., t=u=0 and nt=nt=1).
MLEXPORT MLErrorCode MLImageMapVoxelToWorld(mlField *outField, MLfloat srcX, MLfloat srcY, MLfloat srcZ, MLfloat *dstX, MLfloat *dstY, MLfloat *dstZ)
MLEXPORT MLErrorCode MLImageGetFirstImagePropertyExtensionByType(mlField *outField, const char *imagePropertyTypeClassName, void **imagePropertyExtension)
MLEXPORT void MLCacheSetMaxSizeKB(MLuint64 size)
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 three dimensional regions (i.e., t=u=0 and nt=nt=1).
MLEXPORT MLErrorCode MLImageMapWorldToVoxelInDoubles(mlField *outField, MLdouble srcX, MLdouble srcY, MLdouble srcZ, MLdouble *dstX, MLdouble *dstY, MLdouble *dstZ)
#define mlSensor
A macro name for a void pointer to a sensor in the ML to make the pointer more readable.
Definition mlAPI.h:57
MLEXPORT const char * MLFieldGetType(mlField *field)
Returns the runtime data type of field field as string.
MLEXPORT mlType * MLTypeFromName(const char *name)
Returns the type object for given name. 0 will be returned if the type described by name is unknown.
MLEXPORT size_t MLFieldGetValue(mlField *field, char *value, size_t bufferSize)
MLEXPORT MLErrorCode MLImageGetSize6D(mlField *outField, int *x, int *y, int *z, int *c, int *t, int *u)
MLEXPORT MLuint32 MLIsCurrentlyUnloadingLibrary()
MLEXPORT const char * MLFieldGetName(mlField *field)
Returns the name of field field.
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 three dimensional regions (i.e., c=t=u=0 and nc=nt=nu=1).
MLEXPORT size_t MLModuleGetNumFields(mlModule *module)
MLEXPORT MLErrorCode MLImageGetVoxelToWorldMatrixInDoubles(mlField *outField, MLdouble[16])
Returns the VoxelToWorldMatrix of the image represented by output field outField.
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
Definition mlTypeDefs.h:424
MLint32 MLHostBreakCheckCB(void *usrData, void **hitField)
unsigned int MLuint32
Definition mlTypeDefs.h:184
double MLdouble
Definition mlTypeDefs.h:216
void MLSensorCB(void *usrData, void *sensor)
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
Definition mlTypeDefs.h:411
MLint64 MLint
Definition mlTypeDefs.h:489
signed int MLint32
Definition mlTypeDefs.h:160
void MLHostProgressCB(void *usrData, const char *info1, const char *info2)
float MLfloat
Definition mlTypeDefs.h:200