MeVisLabToolboxReference
FMEwork/ITK/Sources/ITK/MLITK/ITKSupport/mlITKObjectFactory.h File Reference

File containing a class and macros to build an object factory for itk classes. More...

#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

namespace  ml
 

Define the namespace name like in the ML. Default is ml.


Defines

#define _ML_CREATE_ITK_OBJECT_VOID(ML_OUTDATATYPE, ITKOUTDATATYPE, MLINDATATYPE, ITKINDATATYPE, DIM, CLASS_NAME)
 Internal helper macro, to be used only within this file.
#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.
#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.
#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.
#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.
#define MLITKObjectFactoryInit(FACTORY, CLASS_NAME)   FACTORY._setCreatorAndDestructor(CLASS_NAME##Creator, CLASS_NAME##Destructor);

Detailed Description

File containing a class and macros to build an object factory for itk classes.

Author:
Wolf Spindler

Definition in file mlITKObjectFactory.h.


Define Documentation

#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 26 of file mlITKObjectFactory.h.

#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 56 of file mlITKObjectFactory.h.

#define _ML_DESTROY_ITK_OBJECT_VOID (   MLOUTDATATYPE,
  ITKOUTDATATYPE,
  MLINDATATYPE,
  ITKINDATATYPE,
  DIM,
  CLASS_NAME 
)
Value:
{                                                                                                                \
  delete (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 40 of file mlITKObjectFactory.h.

#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 70 of file mlITKObjectFactory.h.

#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);                           \
  }                                                                                             \

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 83 of file mlITKObjectFactory.h.

#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 114 of file mlITKObjectFactory.h.