27#define _ML_CREATE_ITK_OBJECT_VOID(ML_OUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
29 return new CLASS_NAME<ITKINDATATYPE, DIM>(); \
41#define _ML_DESTROY_ITK_OBJECT_VOID(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
43 delete static_cast<CLASS_NAME<ITKINDATATYPE, DIM>*>(itkFactoryObj); \
57#define _ML_CREATE_ITK_OBJECT_VOID_WO_DT(ML_OUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
59 return new CLASS_NAME<DIM>(); \
71#define _ML_DESTROY_ITK_OBJECT_VOID_WO_DT(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME) \
73 delete static_cast<CLASS_NAME<DIM>*>(itkFactoryObj); \
84#define MLITKImplementFactoryFuncs(CLASS_NAME, NAMESPACE, NEW_FUNC, DEL_FUNC) \
88 static void *CLASS_NAME##Creator(MLDataType dType, unsigned int dim){ \
90 ML_IMPLEMENT_ALL_ITK_6D_CASES("CLASS_NAME##creator())", \
92 NAMESPACE::CLASS_NAME, dType, dim); \
100 static void CLASS_NAME##Destructor(void *itkFactoryObj, MLDataType dType, unsigned int dim){ \
102 ML_IMPLEMENT_ALL_ITK_6D_CASES("CLASS_NAME##destructor()", \
104 NAMESPACE::CLASS_NAME, dType, dim); \
115#define MLITKObjectFactoryInit(FACTORY, CLASS_NAME) \
116 FACTORY._setCreatorAndDestructor(CLASS_NAME##Creator, CLASS_NAME##Destructor);
132 typedef void *(*MLITKObjectFactoryCreator)(
MLDataType dataType,
unsigned int dim);
135 typedef void (*MLITKObjectFactoryDestructor)(
void *,
MLDataType dataType,
unsigned int dim);
163 MLITKObjectFactoryDestructor
dFunc)
165 _creatorFunc =
cFunc;
166 _destructorFunc =
dFunc;
179 _destroyInternalObject();
191 _itkObjectVoid = _creatorFunc(dataType,
static_cast<unsigned int>(dim));
192 _dataType = dataType;
193 _dimension =
static_cast<unsigned int>(dim);
199 _itkObjectVoid =
nullptr;
206 void _destroyInternalObject()
211 _destructorFunc(_itkObjectVoid, _dataType, _dimension);
219 _itkObjectVoid =
nullptr;
226 MLITKObjectFactory(
const MLITKObjectFactory &){}
229 MLITKObjectFactory &operator=(
const MLITKObjectFactory &){
return *
this; }
237 void *_itkObjectVoid;
243 unsigned int _dimension;
246 MLITKObjectFactoryCreator _creatorFunc;
249 MLITKObjectFactoryDestructor _destructorFunc;
A class to manage a void pointer to an object of a certain class type a type dataType and dimension d...
~MLITKObjectFactory()
Destroy internally stored object.
MLDataType getDataType() const
Returns data type of the managed internal object.
void destroyObject()
Destroy object.
void _setCreatorAndDestructor(MLITKObjectFactoryCreator cFunc, MLITKObjectFactoryDestructor dFunc)
Sets creator and destructor functions. Only to be called by the macro.
unsigned int getDimension() const
Returns dimension of the managed internal object.
void * getObject() const
Returns void pointer to the managed internal object.
void createObject(MLDataType dType, ImageVector v)
Create object.
void createObject(MLDataType dType, int dim)
Create object.
MLITKObjectFactory()
Create an empty object.
MLint getExtDimension() const
Returns the index to the highest vector component which is not 1 which is useful to get the real dime...
MLEXPORT MLint32 MLIsValidType(MLDataType dataType)
Returns true(=1) if data type dataType seems to be valid, otherwise 0(=false).
#define ML_INVALID_DATA_TYPE
Defines an invalid MLDataType.
MLint32 MLDataType
MLDataType.
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
#define ML_UNKNOWN_EXCEPTION
An unknown exception was detected and caught; this usually means that something for an unknown reason...
#define ML_PRINT_FATAL_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be du...
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define ML_CATCH_BLOCK(__paramType)
#define MLITK_SUPPORT_EXPORT
When included by other libraries MLITK_SUPPORT_EXPORT is compiled as import symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...