MeVisLab Toolbox Reference
mlITKObjectFactory.h File Reference
#include <mlITKSupport.h>

Go to the source code of this file.

Classes

class  ml::MLITKObjectFactory
 A class to manage a void pointer to an object of a certain class type a type dataType and dimension dim. More...
 

Namespaces

 ml
 Main documentation file for ML users and developers.
 

Macros

#define _ML_CREATE_ITK_OBJECT_VOID(ML_OUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME)
 Internal helper macro, to be used only within this file. More...
 
#define _ML_DESTROY_ITK_OBJECT_VOID(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME)
 See _ML_CREATE_ITK_OBJECT_VOID; however this is for object destruction. More...
 
#define _ML_CREATE_ITK_OBJECT_VOID_WO_DT(ML_OUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME)
 Internal helper macro, to be used only within this file. More...
 
#define _ML_DESTROY_ITK_OBJECT_VOID_WO_DT(MLOUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME)
 See _ML_CREATE_ITK_OBJECT_VOID; however this is for object destruction. More...
 
#define MLITKImplementFactoryFuncs(CLASS_NAME, NAMESPACE, NEW_FUNC, DEL_FUNC)
 Creates code for two static factory functions, one to create objects of type NAMESPACE::CLASS_NAME and to remove them. More...
 
#define MLITKObjectFactoryInit(FACTORY, CLASS_NAME)    FACTORY._setCreatorAndDestructor(CLASS_NAME##Creator, CLASS_NAME##Destructor);
 

Macro Definition Documentation

◆ _ML_CREATE_ITK_OBJECT_VOID

#define _ML_CREATE_ITK_OBJECT_VOID (   ML_OUTDATATYPE,
  ITKOUTDATATYPE,
  MLINDATATYPE,
  ITKINDATATYPE,
  DIM,
  CLASS_NAME 
)
Value:
{ \
return new CLASS_NAME<ITKINDATATYPE, DIM>(); \
} \

Internal helper macro, to be used only within this file.

It expands to the code to create the itk object for all data types and dims.

Parameters
ML_OUTDATATYPEis the ML voxel type of output, currently unused.
ITKOUTDATATYPEis the ITK voxel type of the output image(s) of the ITK class, currently unused.
MLINDATATYPEis the ML voxel type of the input image(s), currently unused.
ITKINDATATYPEis the ITK voxel type of the input image(s).
DIMis the dimension the ITK class is compiled with.
CLASS_NAMEis the class name of the ITK algorithm.

Definition at line 27 of file mlITKObjectFactory.h.

◆ _ML_CREATE_ITK_OBJECT_VOID_WO_DT

#define _ML_CREATE_ITK_OBJECT_VOID_WO_DT (   ML_OUTDATATYPE,
  ITKOUTDATATYPE,
  MLINDATATYPE,
  ITKINDATATYPE,
  DIM,
  CLASS_NAME 
)
Value:
{ \
return new CLASS_NAME<DIM>(); \
} \

Internal helper macro, to be used only within this file.

It expands to the code to create the itk object for all data types and dims.

Parameters
ML_OUTDATATYPEis the ML voxel type of output, currently unused.
ITKOUTDATATYPEis the ITK voxel type of the output image(s) of the ITK class, currently unused.
MLINDATATYPEis the ML voxel type of the input image(s), currently unused.
ITKINDATATYPEis the ITK voxel type of the input image(s).
DIMis the dimension the ITK class is compiled with.
CLASS_NAMEis the class name of the ITK algorithm.

Definition at line 57 of file mlITKObjectFactory.h.

◆ _ML_DESTROY_ITK_OBJECT_VOID

#define _ML_DESTROY_ITK_OBJECT_VOID (   MLOUTDATATYPE,
  ITKOUTDATATYPE,
  MLINDATATYPE,
  ITKINDATATYPE,
  DIM,
  CLASS_NAME 
)
Value:
{ \
delete static_cast<CLASS_NAME<ITKINDATATYPE, DIM>*>(itkFactoryObj); \
} \

See _ML_CREATE_ITK_OBJECT_VOID; however this is for object destruction.

Parameters
MLOUTDATATYPEis the ML voxel type of output, currently unused.
ITKOUTDATATYPEis the ITK voxel type of the output image(s) of the ITK class, currently unused.
MLINDATATYPEis the ML voxel type of the input image(s), currently unused.
ITKINDATATYPEis the ITK voxel type of the input image(s).
DIMis the dimension the ITK class is compiled with.
CLASS_NAMEis the class name of the ITK algorithm.

Definition at line 41 of file mlITKObjectFactory.h.

◆ _ML_DESTROY_ITK_OBJECT_VOID_WO_DT

#define _ML_DESTROY_ITK_OBJECT_VOID_WO_DT (   MLOUTDATATYPE,
  ITKOUTDATATYPE,
  MLINDATATYPE,
  ITKINDATATYPE,
  DIM,
  CLASS_NAME 
)
Value:
{ \
delete static_cast<CLASS_NAME<DIM>*>(itkFactoryObj); \
} \

See _ML_CREATE_ITK_OBJECT_VOID; however this is for object destruction.

Parameters
MLOUTDATATYPEis the ML voxel type of output, currently unused.
ITKOUTDATATYPEis the ITK voxel type of the output image(s) of the ITK class, currently unused.
MLINDATATYPEis the ML voxel type of the input image(s), currently unused.
ITKINDATATYPEis the ITK voxel type of the input image(s).
DIMis the dimension the ITK class is compiled with.
CLASS_NAMEis the class name of the ITK algorithm.

Definition at line 71 of file mlITKObjectFactory.h.

◆ MLITKImplementFactoryFuncs

#define MLITKImplementFactoryFuncs (   CLASS_NAME,
  NAMESPACE,
  NEW_FUNC,
  DEL_FUNC 
)
Value:
/*--------------------------------------------------------------------*/ \ \
/*--------------------------------------------------------------------*/ \
static void *CLASS_NAME##Creator(MLDataType dType, unsigned int dim){ \
/* Call correct template version of object creation for all types and dims. */ \
ML_IMPLEMENT_ALL_ITK_6D_CASES("CLASS_NAME##creator())", \
NEW_FUNC, \
NAMESPACE::CLASS_NAME, dType, dim); \
return NULL; /* Error */ \
} \
\
/*--------------------------------------------------------------------*/ \ \ \
/*--------------------------------------------------------------------*/ \
static void CLASS_NAME##Destructor(void *itkFactoryObj, MLDataType dType, unsigned int dim){ \
/* Call correct template version of object destruction for all types and dims. */ \
ML_IMPLEMENT_ALL_ITK_6D_CASES("CLASS_NAME##destructor()", \
DEL_FUNC, \
NAMESPACE::CLASS_NAME, dType, dim); \
} \
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684

Creates code for two static factory functions, one to create objects of type NAMESPACE::CLASS_NAME and to remove them.

Their template arguments are specified automatically by function arguments dataType and dim.

Parameters
CLASS_NAMEspecifies the class the factory function shall be created for.
NAMESPACEspecifies the namespace in which CLASS_NAME resides.

Definition at line 84 of file mlITKObjectFactory.h.

◆ MLITKObjectFactoryInit

#define MLITKObjectFactoryInit (   FACTORY,
  CLASS_NAME 
)     FACTORY._setCreatorAndDestructor(CLASS_NAME##Creator, CLASS_NAME##Destructor);

Initializes an MLITKObjectFactory with its creation and destruction

functions which must have been implemented by MLITKImplementFactoryFuncs.

Parameters
FACTORYspecifies the factory instance to be initialized.
CLASS_NAMEspecifies the class for which the init functions

have been created.

Definition at line 115 of file mlITKObjectFactory.h.