MeVisLab Toolbox Reference
mlKernelMacros.h File Reference

Go to the source code of this file.

Macros

#define CALC_ROW_H()
 This file contains macros CALC_ROW_H() and CALC_ROW_CPP() used in classes derived from KernelBaseOp and KernelOp.
 
#define CALC_ROW_CPP(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE)
 CALC_ROW_CPP() implementation for all scalar data types which is typical.
 
#define CALC_ROW_DEFAULT_TYPES_CPP(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_DEFAULT_CASES, _KERNEL_CASE_CODE)
 CALC_ROW_DEFAULT_TYPES_CPP() implementation for all default data types.
 
#define CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION, _KERNEL_CASE_CODE)
 CALC_ROW_CPP_ANY() for backward compatibility.
 
#define CALC_ROW_CPP_EXT(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE_EXT)
 CALC_ROW_CPP_EXT() implementation for all data types which is typical.
 
#define CALC_ROW_CPP_EXT_DD(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE_EXT_DD)
 CALC_ROW_CPP_EXT_DD() implementation compiling all input/output voxel type combinations.
 
#define CALC_ROW_CPP_ANY_EXT(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION, _KERNEL_CASE_CODE_EXT)
 CALC_ROW_CPP_EXT() implementation for all data types which is typical.
 
#define CALC_ROW_CPP_SUBIMG(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE_SUBIMG)
 CALC_ROW_CPP_SUBIMG implementation for all data types which is typical.
 
#define CALC_ROW_CPP_ANY_SUBIMG(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION, _KERNEL_CASE_CODE_SUBIMG)
 CALC_ROW_CPP_SUBIMG_ANY for backward compatibility.
 
#define CALC_ROW_CPP_SUBIMG_EXT(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE_SUBIMG_EXT)
 CALC_ROW_CPP_SUBIMG_EXT implementation for more parameters to calcRow().
 
#define CALC_ROW_CPP_SUBIMG_EXT_DD(CLASS_NAME, SUPER_CLASS)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, ML_IMPLEMENT_SCALAR_CASES, _KERNEL_CASE_CODE_SUBIMG_EXT_DD)
 CALC_ROW_CPP_SUBIMG_EXT_DD implementation for more parameters to calcRow() compiling all combinations of input/output voxel types.
 
#define CALC_ROW_CPP_ANY_SUBIMG_EXT(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION)    _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, SWITCH_SELECTION, _KERNEL_CASE_CODE_SUBIMG_EXT)
 CALC_ROW_CPP_SUBIMG_EXT implementation for more parameters to calcRow().
 
#define _KERNEL_STD_PARAMS
 Non-public helper macro for parameters to calcRow calls in the normal version.
 
#define _KERNEL_STD_PARAMS_SUBIMG
 Non-public helper macro for parameters to calcRow calls in the normal version with typedSubImg pointers.
 
#define _KERNEL_EXT_PARAMS
 Non-public helper macro for parameters to calcRow calls in the extended version.
 
#define _KERNEL_EXT_PARAMS_SUBIMG
 Non-public helper macro for parameters to calcRow calls in the extended version with typed subimage pointers.
 
#define _CALC_ROW_CPP_ANY(CLASS_NAME, SUPER_CLASS, TYPE_IMPLEMENTER, CASE_CODE)
 Non-public helper macro which needs to be added to the implementation of the of a class derived from this class.
 
#define __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, ADD_PARAMS)
 Non-public helper special macro for internal calculateOutputSubImage() implementation.
 
#define __KERNEL_CASE_CODE_EXT_DD_HELPER(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, OPNAME, _KERNEL_EXT_PARAMS) \
 Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE.
 
#define __KERNEL_CASE_CODE_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, ADD_PARAMS)
 Non-public helper macro; same as __KERNEL_CASE_CODE with the difference that all combinations of input and output types are compiled.
 
#define __KERNEL_CASE_CODE_SUBIMG_EXT_DD_HELPER(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, OPNAME, _KERNEL_EXT_PARAMS_SUBIMG) \
 Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE with subimage parameters.
 
#define __KERNEL_CASE_CODE_SUBIMG_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, ADD_PARAMS)
 Non-public helper/wrapper macro; same as __KERNEL_CASE_CODE with the difference that all combinations of input and output types are compiled and subimages are passed as parameters; note: it generates significantly more code.
 
#define _KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_STD_PARAMS)
 Non-public helper macro; normal version for calcRow calls.
 
#define _KERNEL_CASE_CODE_EXT(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_EXT_PARAMS)
 Non-public helper macro; extended version for calcRow calls.
 
#define _KERNEL_CASE_CODE_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_EXT_PARAMS)
 Non-public helper macro; extended version for calcRow calls which supports different input and output types.
 
#define _KERNEL_CASE_CODE_SUBIMG(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_STD_PARAMS_SUBIMG)
 Non-public helper macro; normal version for calcRow calls with subimage parameters.
 
#define _KERNEL_CASE_CODE_SUBIMG_EXT(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_EXT_PARAMS_SUBIMG)
 Non-public helper macro; extended version for calcRow calls with subimage parameters.
 
#define _KERNEL_CASE_CODE_SUBIMG_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)    __KERNEL_CASE_CODE_SUBIMG_EXT_DD(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME, _KERNEL_EXT_PARAMS_SUBIMG)
 Non-public helper macro; extended version for calcRow calls with subimage parameters supporting different input and output types.
 

Functions

template<typename INDTYPE >
void __ML_KERNEL_CASE_CODE_clearAndHandleError (ml::TSubImageWithCursor< INDTYPE > *&typedInTSubImgs, INDTYPE **&rowTab, bool err, const char *className)
 Non-public template helper function to handle dynamic memory cleanup.
 

Macro Definition Documentation

◆ __KERNEL_CASE_CODE

#define __KERNEL_CASE_CODE ( OUT_DATA_TYPE,
IN_DATA_TYPE,
CLASS_NAME,
ADD_PARAMS )

Non-public helper special macro for internal calculateOutputSubImage() implementation.

The macro code is implemented explicitly for all data types in calculateOutputSubImage() of kernel modules. First typed subimage of the input and the output page are calculated. The the borders of the input or output subimage are filled/copied dependent on the the current border handling. The all rows are scanned in the loop and the subimage cursors are placed on the row starts. The input image cursor defines the current kernel placement, i.e the kernel origin. The output image cursor defines the result voxel filtered from kernel and input image values. Note that both cursors are placed in global image coordinates, and NOT in local page coordinates! In the inner loop the calcRow() method of the module is called with all important parameters. In ADD_PARAMS additional parameters to calcRow can be passed.

Definition at line 286 of file mlKernelMacros.h.

◆ __KERNEL_CASE_CODE_EXT_DD

#define __KERNEL_CASE_CODE_EXT_DD ( OUT_DATA_TYPE,
IN_DATA_TYPE,
CLASS_NAME,
ADD_PARAMS )
Value:
{ \
inSubImgs->getDataType(), \
"__KERNEL_CASE_CODE_DD", \
\
} \
#define __KERNEL_CASE_CODE_EXT_DD_HELPER(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)
Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.

Non-public helper macro; same as __KERNEL_CASE_CODE with the difference that all combinations of input and output types are compiled.

generates significantly more code.

Definition at line 355 of file mlKernelMacros.h.

◆ __KERNEL_CASE_CODE_EXT_DD_HELPER

Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE.

Definition at line 348 of file mlKernelMacros.h.

◆ __KERNEL_CASE_CODE_SUBIMG_EXT_DD

#define __KERNEL_CASE_CODE_SUBIMG_EXT_DD ( OUT_DATA_TYPE,
IN_DATA_TYPE,
CLASS_NAME,
ADD_PARAMS )
Value:
{ \
inSubImgs->getDataType(), \
"__KERNEL_CASE_SUBIMG_CODE_DD", \
} \
#define __KERNEL_CASE_CODE_SUBIMG_EXT_DD_HELPER(OUT_DATA_TYPE, IN_DATA_TYPE, CLASS_NAME)
Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE with subimage paramet...

Non-public helper/wrapper macro; same as __KERNEL_CASE_CODE with the difference that all combinations of input and output types are compiled and subimages are passed as parameters; note: it generates significantly more code.

Definition at line 377 of file mlKernelMacros.h.

◆ __KERNEL_CASE_CODE_SUBIMG_EXT_DD_HELPER

Non-public helper/wrapper macro to instantiate KERNEL_CASE_CODE for all INDTYPE with subimage parameters.

Definition at line 369 of file mlKernelMacros.h.

◆ _CALC_ROW_CPP_ANY

Value:
\
void CLASS_NAME::_calcKernelPage(SubImage *outSubImg, \
int outIndex, \
SubImage *inSubImgs, \
int numInSubImgs, \
size_t indexTabSize, \
size_t loopIdx, \
size_t iteration, \
const ImageVector &ov1, \
const ImageVector &ov2, \
const ImageVector &pOf, \
size_t numVox) \
{ \
/* Loop and position variables used in inner macros. */ \
ImageVector p, rowStart; \
\
/* Only to avoid warnings if not used by macro. */ \
loopIdx += 0u; \
iteration += 0u; \
outIndex += 0; \
switch(outSubImg->getDataType()){ \
"_CALC_ROW_CPP_ANY", INTYPE_DUMMY) \
ML_IMPLEMENT_DEFAULT_HANDLING("_CALC_ROW_CPP_ANY") \
} \
} \
MLint MLsoffset
Signed ML offset type which is a 32 bit signed integer on 32 bit platforms and a 64 bit integer on 64...
Definition mlTypeDefs.h:562

Non-public helper macro which needs to be added to the implementation of the of a class derived from this class.

It guarantees that the correct template functions are called for images of any data type. Please use this macro instead of implementing it yourself since function signatures and contents are subject to change and optimizations. See also CALC_ROW_H(). Note that this macro overloads calculateOutputSubImage() which then calls template typed versions of calcRow(). CLASS_NAME is the type of your class derived from KernelBaseOp or KernelOp and SUPER_CLASS is the class you derive from (i.e. KernelBaseOp or KernelOp).

Definition at line 212 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE

Non-public helper macro; normal version for calcRow calls.

Definition at line 392 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE_EXT

Non-public helper macro; extended version for calcRow calls.

Definition at line 398 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE_EXT_DD

Non-public helper macro; extended version for calcRow calls which supports different input and output types.

Definition at line 405 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE_SUBIMG

Non-public helper macro; normal version for calcRow calls with subimage parameters.

Definition at line 413 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE_SUBIMG_EXT

Non-public helper macro; extended version for calcRow calls with subimage parameters.

Definition at line 419 of file mlKernelMacros.h.

◆ _KERNEL_CASE_CODE_SUBIMG_EXT_DD

Non-public helper macro; extended version for calcRow calls with subimage parameters supporting different input and output types.

Definition at line 426 of file mlKernelMacros.h.

◆ _KERNEL_EXT_PARAMS

#define _KERNEL_EXT_PARAMS
Value:

Non-public helper macro for parameters to calcRow calls in the extended version.

Definition at line 186 of file mlKernelMacros.h.

◆ _KERNEL_EXT_PARAMS_SUBIMG

#define _KERNEL_EXT_PARAMS_SUBIMG
Value:

Non-public helper macro for parameters to calcRow calls in the extended version with typed subimage pointers.

Definition at line 193 of file mlKernelMacros.h.

◆ _KERNEL_STD_PARAMS

#define _KERNEL_STD_PARAMS
Value:

Non-public helper macro for parameters to calcRow calls in the normal version.

Definition at line 174 of file mlKernelMacros.h.

◆ _KERNEL_STD_PARAMS_SUBIMG

#define _KERNEL_STD_PARAMS_SUBIMG
Value:

Non-public helper macro for parameters to calcRow calls in the normal version with typedSubImg pointers.

Definition at line 180 of file mlKernelMacros.h.

◆ CALC_ROW_CPP

CALC_ROW_CPP() implementation for all scalar data types which is typical.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSMust be KernelBaseOp if your derive from KernelBaseOp, otherwise KernelOp.

Definition at line 56 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_ANY

CALC_ROW_CPP_ANY() for backward compatibility.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.
SWITCH_SELECTIONMust be a case implementation from mlModuleMacros.h, for example ML_IMPLEMENT_INT_CASES. It defines the compilation data types for the filter.

Definition at line 74 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_ANY_EXT

CALC_ROW_CPP_EXT() implementation for all data types which is typical.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.
SWITCH_SELECTIONMust be a case implementation from mlModuleMacros.h, for example ML_IMPLEMENT_INT_CASES. It defines the compilation data types for the filter.

Definition at line 101 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_ANY_SUBIMG

CALC_ROW_CPP_SUBIMG_ANY for backward compatibility.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.
SWITCH_SELECTIONMust be a case implementation from mlModuleMacros.h, for example ML_IMPLEMENT_INT_CASES. It defines the compilation data types for the filter.

Definition at line 121 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_ANY_SUBIMG_EXT

CALC_ROW_CPP_SUBIMG_EXT implementation for more parameters to calcRow().

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.
SWITCH_SELECTIONMust be a case implementation from mlModuleMacros.h, for example ML_IMPLEMENT_INT_CASES. It defines the compilation data types for the filter.

Definition at line 148 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_EXT

CALC_ROW_CPP_EXT() implementation for all data types which is typical.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.

Definition at line 82 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_EXT_DD

CALC_ROW_CPP_EXT_DD() implementation compiling all input/output voxel type combinations.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.

Definition at line 90 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_SUBIMG

CALC_ROW_CPP_SUBIMG implementation for all data types which is typical.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.

Definition at line 111 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_SUBIMG_EXT

CALC_ROW_CPP_SUBIMG_EXT implementation for more parameters to calcRow().

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.

Definition at line 129 of file mlKernelMacros.h.

◆ CALC_ROW_CPP_SUBIMG_EXT_DD

CALC_ROW_CPP_SUBIMG_EXT_DD implementation for more parameters to calcRow() compiling all combinations of input/output voxel types.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSThe parent class of your class.

Definition at line 138 of file mlKernelMacros.h.

◆ CALC_ROW_DEFAULT_TYPES_CPP

CALC_ROW_DEFAULT_TYPES_CPP() implementation for all default data types.

Parameters
CLASS_NAMEName of the class you implement.
SUPER_CLASSMust be KernelBaseOp if your derive from KernelBaseOp, otherwise KernelOp.

Definition at line 64 of file mlKernelMacros.h.

◆ CALC_ROW_H

#define CALC_ROW_H ( )
Value:
protected: \
virtual void _calcKernelPage(SubImage *outSubImg, \
int outIndex, \
SubImage *inSubImgs, \
int numInSubImgs, \
size_t indexTabSize, \
size_t loopIdx, \
size_t iteration, \
const ImageVector &ov1, \
const ImageVector &ov2, \
const ImageVector &pOf, \
size_t numVox) override; \

This file contains macros CALC_ROW_H() and CALC_ROW_CPP() used in classes derived from KernelBaseOp and KernelOp.

Macro which needs to be added to the header of the of a class derived from KernelBaseOp or KernelOp. It overloads calculateOutputSubImage() of the base class. Please use this macro instead of implementing it yourself since function signatures and contents are subject to change. See also CALC_ROW_CPP().

Definition at line 34 of file mlKernelMacros.h.

Function Documentation

◆ __ML_KERNEL_CASE_CODE_clearAndHandleError()

template<typename INDTYPE >
void __ML_KERNEL_CASE_CODE_clearAndHandleError ( ml::TSubImageWithCursor< INDTYPE > *& typedInTSubImgs,
INDTYPE **& rowTab,
bool err,
const char * className )

Non-public template helper function to handle dynamic memory cleanup.

Not in code to reduce code complexity and to reduce number of exception handling code in KERNEL_CASE_CODEs.

Definition at line 251 of file mlKernelMacros.h.

References ML_PRINT_ERROR, ML_UNKNOWN_EXCEPTION, MLFree(), and mlrange_cast().