MeVisLab Toolbox Reference
ml::ITKModuleAddOns Class Reference

Class to implement much functionality used in ML modules wrapping filters. More...

#include <mlITKModuleAddOns.h>

Public Types

enum  ITKModuleAddOnConfigs1 {
  Empty = 0x00000000 , DoNotCompile = 0x00000001 , IsInplace = 0x00000002 , UseOnlySigned = 0x00000004 ,
  UseOnlyDouble = 0x00000008 , UseOnlyFloat = 0x00000010 , UseOnlyInt = 0x00000020 , IsKernelModule = 0x00000040 ,
  IsLevelSetModule = 0x00000080 , HasFeatureImage = 0x00000100 , IsImageFilter = 0x00000200 , IsImageMetric = 0x00000400 ,
  IsTransform = 0x00000800 , IsInterpolator = 0x00001000 , IsOptimizer = 0x00002000 , IsSource = 0x00004000 ,
  UseMemBufInput0 = 0x00008000 , UseMemBufInput1 = 0x00010000 , UseMemBufInput2 = 0x00020000 , Only2D = 0x00040000 ,
  Only3D = 0x00080000 , NonScalarInput = 0x00100000 , NonScalarOutput = 0x00200000 , ConvertsPointSet = 0x00400000 ,
  UsesComplex = 0x00800000 , UsesSCSL = 0x01000000 , SuppressGetParams = 0x02000000 , ClampOutputValues = 0x04000000 ,
  AutoGetInputMinMax = 0x08000000 , SetOutputMinMax = 0x10000000 , UsesTensor = 0x20000000 , UsesCVVectors = 0x40000000 ,
  UnUsedMask01_01 = 0x80000000
}
 Configuration bits for configMask1 in ITKModuleAddOns constructor. More...
 
enum  ITKModuleAddOnConfigs2 {
  UsesImgDimVecOut = 0x00000001 , Uses2OutComps = 0x00000002 , Uses3OutComps = 0x00000004 , Uses4OutComps = 0x00000008 ,
  Uses6OutComps = 0x00000010 , Uses8OutComps = 0x00000020 , Uses16OutComps = 0x00000040 , UsesITK = 0x00000080 ,
  UsesVTK = 0x00000100 , UsesGlobalPageExt = 0x00000200 , UsesImgDimVecIn = 0x00000400 , UseFlatKernel = 0x00000800 ,
  UsesNonScalarIntConversion = 0x00001000 , IdSizedInBox0 = 0x00002000 , IdSizedInBox1 = 0x00004000 , IdSizedInBox2 = 0x00008000 ,
  UnknownMask2_16 = 0x00010000 , UnknownMask2_17 = 0x00020000 , UnknownMask2_18 = 0x00040000 , UnknownMask2_29 = 0x00080000 ,
  UnknownMask2_20 = 0x00100000 , UnknownMask2_21 = 0x00200000 , UnknownMask2_22 = 0x00400000 , UnknownMask2_23 = 0x00800000 ,
  UnknownMask2_24 = 0x01000000 , UnknownMask2_25 = 0x02000000 , UnknownMask2_26 = 0x04000000 , UnknownMask2_27 = 0x08000000 ,
  UnknownMask2_28 = 0x10000000 , UnknownMask2_39 = 0x20000000 , UnknownMask2_30 = 0x40000000 , UnknownMask2_31 = 0x80000000
}
 Configuration bits for configMask2 in ITKModuleAddOns constructor. More...
 

Public Member Functions

 ITKModuleAddOns (Module &module, unsigned int configMask1=Empty, unsigned int configMask2=Empty)
 Create Initialization and configuration with flags in the passed configMask which must be composed from ModuleAddOnConfigs.
 
 ~ITKModuleAddOns ()
 Destructor.
 
unsigned int getConfigMask1 ()
 Returns configuration mask 1.
 
unsigned int getConfigMask2 ()
 Returns configuration mask 2.
 
MLDataType getInputSubImageDataType ()
 Returns the current input buffer data type for non scalar filters.
 
MLDataType getOutputSubImageDataType (int outIndex=0)
 Returns the current output buffer data type for non scalar filters.
 
MLTypeInfosgetInSubImageTypeInfos ()
 Returns the pointer to the information struct of the input data type; this pointer is valid or NULL only after executing calculateOutputImageProperties().
 
MLTypeInfosgetOutSubImageTypeInfos (int outIndex=0)
 Returns the pointer to the information struct of the output data type; this pointer is valid or NULL only after executing calculateOutputImageProperties().
 
MLint getUsedFilteringDim ()
 Returns the dimension the filter shall current work with.
 
void preConstructorStuff ()
 Adds functionality to constructor of _module directly after construction.
 
void postConstructorStuff ()
 Adds functionality to constructor of _module at end of constructor.
 
void preActivateAttachments ()
 Does Module::activateAttachments stuff on start of function.
 
void postActivateAttachments ()
 Does Module::activateAttachments stuff on end of function.
 
void preHandleNotification (Field *field)
 Does Module::handleNotification stuff on start of function.
 
void postHandleNotification (Field *field)
 Does Module::handleNotification stuff on end of function.
 
void preCalcOutImageProps (int outIndex)
 Does Module::calculateOutputImageProperties stuff on start of function.
 
void postCalcOutImageProps (int outIndex)
 Does Module::calculateOutputImageProperties stuff on end of function.
 
SubImageBox preCalcInSubImageBox (int inIndex, const SubImageBox &outSubImgBox, int outIndex)
 Does Module::calculateInputSubImageBox stuff on start of function.
 
SubImageBox postCalcInSubImageBox (int inIndex, const SubImageBox &outSubImgBox, const SubImageBox &processedBox, int outIndex)
 Does Module::calculateInputSubImageBox stuff on end of function.
 
void setInSubImageProperties (int outIndex, PagedImage &outImg)
 Sets input subimage properties at end of Module::calculateOutputImageProperties.
 
void preSetFilterParams ()
 Does Module::setFilterParams stuff on start of function.
 
void postSetFilterParams ()
 Does Module::setFilterParams stuff on end of function.
 
void preGetFilterParams ()
 Does Module::getFilterParams stuff on start of function.
 
void postGetFilterParams ()
 Does Module::getFilterParams stuff on end of function.
 
void preCalcOutSubImage (SubImage &outSubImg, int outIndex, SubImage *inSubImgs)
 Does some Module::calculateOutputSubImage stuff on start of function.
 
void postCalcOutSubImage (SubImage &outSubImg, int outIndex, SubImage *inSubImgs)
 Does some Module::calculateOutputSubImage stuff on end of function.
 

Static Public Member Functions

static std::string GetStringFromInt (int intVal, unsigned int reservedSpaces=1)
 Return passed integer value as string.
 
static int GetIntFromString (const std::string &str, bool &isValid)
 Parse string for a valid integer at its beginning and return its value if possible; isValid is set if a valid value could be parsed, otherwise false.
 
static bool isCompiledDim (MLint dim)
 Returns true if filters are implemented for the passed dimension dim, otherwise false.
 
static bool isCompiledType (MLDataType dt)
 Returns true if filters are implemented for the passed data type dt, otherwise false.
 
static void printSubImgBox (const char *str, const SubImageBox &box)
 Prints the passed string and then the parameters of the subimage box box to the ML output.
 
static void printVector (const char *str, const ImageVector &vec)
 Prints the passed string and then the parameters of the vector vec to the ML output.
 
static MLDataType getBestSignedType (MLDataType inDataType, MLdouble minVV, MLdouble maxVV, int preferDouble)
 Selects an adequate replacement type for the case that a signed type is required.
 
static MLDataType getBestIntegerType (MLDataType inDataType, MLdouble minVV, MLdouble maxVV)
 If inDataType is an integer type then inDataType will be returned unchanged.
 
static bool CheckNumberSizes (size_t s1, size_t s2, const std::string &funcName, const std::string &str="Number of parameter should be ")
 Print the error for function funcName with the hint that the number
of parameters should be s2 instead of s1 and returns false if s1 and s2 differ.
 
static void packMemory (void *targetBuffer, void *srcBuffer, size_t setSize, size_t gapSize, size_t numSets)
 Takes memory pointed by srcBuffer, considers it as numSets objects of size setSize.
 
static void packSubImg (SubImage &subImg, const SubImageBox &imgBox)
 Reformat the data buffer of subimage subImg.
 

Detailed Description

Class to implement much functionality used in ML modules wrapping filters.

Definition at line 39 of file mlITKModuleAddOns.h.

Member Enumeration Documentation

◆ ITKModuleAddOnConfigs1

Configuration bits for configMask1 in ITKModuleAddOns constructor.

Enumerator
Empty 
DoNotCompile 
IsInplace 
UseOnlySigned 
UseOnlyDouble 
UseOnlyFloat 
UseOnlyInt 
IsKernelModule 
IsLevelSetModule 
HasFeatureImage 
IsImageFilter 
IsImageMetric 
IsTransform 
IsInterpolator 
IsOptimizer 
IsSource 
UseMemBufInput0 
UseMemBufInput1 
UseMemBufInput2 
Only2D 
Only3D 
NonScalarInput 
NonScalarOutput 
ConvertsPointSet 
UsesComplex 
UsesSCSL 
SuppressGetParams 
ClampOutputValues 
AutoGetInputMinMax 
SetOutputMinMax 
UsesTensor 
UsesCVVectors 
UnUsedMask01_01 

Definition at line 45 of file mlITKModuleAddOns.h.

◆ ITKModuleAddOnConfigs2

Configuration bits for configMask2 in ITKModuleAddOns constructor.

Enumerator
UsesImgDimVecOut 
Uses2OutComps 
Uses3OutComps 
Uses4OutComps 
Uses6OutComps 
Uses8OutComps 
Uses16OutComps 
UsesITK 
UsesVTK 
UsesGlobalPageExt 
UsesImgDimVecIn 
UseFlatKernel 
UsesNonScalarIntConversion 
IdSizedInBox0 
IdSizedInBox1 
IdSizedInBox2 
UnknownMask2_16 
UnknownMask2_17 
UnknownMask2_18 
UnknownMask2_29 
UnknownMask2_20 
UnknownMask2_21 
UnknownMask2_22 
UnknownMask2_23 
UnknownMask2_24 
UnknownMask2_25 
UnknownMask2_26 
UnknownMask2_27 
UnknownMask2_28 
UnknownMask2_39 
UnknownMask2_30 
UnknownMask2_31 

Definition at line 82 of file mlITKModuleAddOns.h.

Constructor & Destructor Documentation

◆ ITKModuleAddOns()

ml::ITKModuleAddOns::ITKModuleAddOns ( Module & module,
unsigned int configMask1 = Empty,
unsigned int configMask2 = Empty )

Create Initialization and configuration with flags in the passed configMask which must be composed from ModuleAddOnConfigs.

Default is configMask=0.

◆ ~ITKModuleAddOns()

ml::ITKModuleAddOns::~ITKModuleAddOns ( )

Destructor.

Member Function Documentation

◆ CheckNumberSizes()

static bool ml::ITKModuleAddOns::CheckNumberSizes ( size_t s1,
size_t s2,
const std::string & funcName,
const std::string & str = "Number of parameter should be " )
static

Print the error for function funcName with the hint that the number
of parameters should be s2 instead of s1 and returns false if s1 and s2 differ.

Otherwise no error is posted and true is returned.

◆ getBestIntegerType()

static MLDataType ml::ITKModuleAddOns::getBestIntegerType ( MLDataType inDataType,
MLdouble minVV,
MLdouble maxVV )
static

If inDataType is an integer type then inDataType will be returned unchanged.

If not then the smallest 8/16/32 bit signed or unsigned integer type which can hold the range [minVV, maxVV] will be returned. If such a type does not exist then -1 will be returned to indicate an invalid data type.

◆ getBestSignedType()

static MLDataType ml::ITKModuleAddOns::getBestSignedType ( MLDataType inDataType,
MLdouble minVV,
MLdouble maxVV,
int preferDouble )
static

Selects an adequate replacement type for the case that a signed type is required.

If inDataType is a signed type then inDataType is returned. If not then the same sized signed version is returned if the range [minVV, maxVV] fits in it. If the range does not fit then the next larger signed integer type is returned. If the next larger integer type would become a 64 bit type then MLfloatType or MLdoubleType are used instead of the 64 bit type. If preferDouble is non 0 (=true) then double is used, otherwise MLfloatType is returned.

◆ getConfigMask1()

unsigned int ml::ITKModuleAddOns::getConfigMask1 ( )
inline

Returns configuration mask 1.

Definition at line 130 of file mlITKModuleAddOns.h.

◆ getConfigMask2()

unsigned int ml::ITKModuleAddOns::getConfigMask2 ( )
inline

Returns configuration mask 2.

Definition at line 133 of file mlITKModuleAddOns.h.

◆ getInputSubImageDataType()

MLDataType ml::ITKModuleAddOns::getInputSubImageDataType ( )

Returns the current input buffer data type for non scalar filters.

◆ getInSubImageTypeInfos()

MLTypeInfos * ml::ITKModuleAddOns::getInSubImageTypeInfos ( )

Returns the pointer to the information struct of the input data type; this pointer is valid or NULL only after executing calculateOutputImageProperties().

Note that it points to the information struct of the data type used in the first input subimage in calculateOutputSubImage; it can differ from the data types of the input image. For example non scalar types require input buffers having other types than the input image.

◆ GetIntFromString()

static int ml::ITKModuleAddOns::GetIntFromString ( const std::string & str,
bool & isValid )
static

Parse string for a valid integer at its beginning and return its value if possible; isValid is set if a valid value could be parsed, otherwise false.

If no value could be parsed then 0 is returned.

◆ getOutputSubImageDataType()

MLDataType ml::ITKModuleAddOns::getOutputSubImageDataType ( int outIndex = 0)

Returns the current output buffer data type for non scalar filters.

◆ getOutSubImageTypeInfos()

MLTypeInfos * ml::ITKModuleAddOns::getOutSubImageTypeInfos ( int outIndex = 0)

Returns the pointer to the information struct of the output data type; this pointer is valid or NULL only after executing calculateOutputImageProperties().

◆ GetStringFromInt()

static std::string ml::ITKModuleAddOns::GetStringFromInt ( int intVal,
unsigned int reservedSpaces = 1 )
static

Return passed integer value as string.

reservedSpaces <=0 does not add leading spaces, values > 0 add spaces until spaces+leading digits are not less than reservedSpaces.

◆ getUsedFilteringDim()

MLint ml::ITKModuleAddOns::getUsedFilteringDim ( )

Returns the dimension the filter shall current work with.

A call requires that preCalcOutImageProps(int outIndex) has been called before.

◆ isCompiledDim()

static bool ml::ITKModuleAddOns::isCompiledDim ( MLint dim)
static

Returns true if filters are implemented for the passed dimension dim, otherwise false.

Dimensions are counted starting with 1.

◆ isCompiledType()

static bool ml::ITKModuleAddOns::isCompiledType ( MLDataType dt)
static

Returns true if filters are implemented for the passed data type dt, otherwise false.


◆ packMemory()

static void ml::ITKModuleAddOns::packMemory ( void * targetBuffer,
void * srcBuffer,
size_t setSize,
size_t gapSize,
size_t numSets )
static

Takes memory pointed by srcBuffer, considers it as numSets objects of size setSize.

Then is removes the last gapSize bytes from each set so that a following set directly starts where formerly were the first gap byte. The result is written into targetBUffer. So the entire srcBuffer is shrunk by removing the gaps in each set and the result is written into targetBuffer. srcBuffer is the pointer to the starting position where the data shall be read from. It must be another buffer than targetBuffer or it must be a higher pointer than targetBuffer to guarantee valid operation. If srcBuffer or targetBuffer are NULL, gapSize is >= setSize or numSets is 0 then calls to this function are ignored. The buffer remaining after the shrunk sets is left undefined.

◆ packSubImg()

static void ml::ITKModuleAddOns::packSubImg ( SubImage & subImg,
const SubImageBox & imgBox )
static

Reformat the data buffer of subimage subImg.

Gaps between real data type fractions of registered data types are removed by packing the data with packMemory. imgBox denotes the are of the image the subimage comes from. Regions in subImg outside imgBox are not packed or unpacked.

◆ postActivateAttachments()

void ml::ITKModuleAddOns::postActivateAttachments ( )

Does Module::activateAttachments stuff on end of function.

◆ postCalcInSubImageBox()

SubImageBox ml::ITKModuleAddOns::postCalcInSubImageBox ( int inIndex,
const SubImageBox & outSubImgBox,
const SubImageBox & processedBox,
int outIndex )

Does Module::calculateInputSubImageBox stuff on end of function.

◆ postCalcOutImageProps()

void ml::ITKModuleAddOns::postCalcOutImageProps ( int outIndex)

Does Module::calculateOutputImageProperties stuff on end of function.

◆ postCalcOutSubImage()

void ml::ITKModuleAddOns::postCalcOutSubImage ( SubImage & outSubImg,
int outIndex,
SubImage * inSubImgs )

Does some Module::calculateOutputSubImage stuff on end of function.

◆ postConstructorStuff()

void ml::ITKModuleAddOns::postConstructorStuff ( )

Adds functionality to constructor of _module at end of constructor.

◆ postGetFilterParams()

void ml::ITKModuleAddOns::postGetFilterParams ( )

Does Module::getFilterParams stuff on end of function.

◆ postHandleNotification()

void ml::ITKModuleAddOns::postHandleNotification ( Field * field)

Does Module::handleNotification stuff on end of function.

◆ postSetFilterParams()

void ml::ITKModuleAddOns::postSetFilterParams ( )

Does Module::setFilterParams stuff on end of function.

◆ preActivateAttachments()

void ml::ITKModuleAddOns::preActivateAttachments ( )

Does Module::activateAttachments stuff on start of function.

◆ preCalcInSubImageBox()

SubImageBox ml::ITKModuleAddOns::preCalcInSubImageBox ( int inIndex,
const SubImageBox & outSubImgBox,
int outIndex )

Does Module::calculateInputSubImageBox stuff on start of function.

◆ preCalcOutImageProps()

void ml::ITKModuleAddOns::preCalcOutImageProps ( int outIndex)

Does Module::calculateOutputImageProperties stuff on start of function.

◆ preCalcOutSubImage()

void ml::ITKModuleAddOns::preCalcOutSubImage ( SubImage & outSubImg,
int outIndex,
SubImage * inSubImgs )

Does some Module::calculateOutputSubImage stuff on start of function.

◆ preConstructorStuff()

void ml::ITKModuleAddOns::preConstructorStuff ( )

Adds functionality to constructor of _module directly after construction.

◆ preGetFilterParams()

void ml::ITKModuleAddOns::preGetFilterParams ( )

Does Module::getFilterParams stuff on start of function.

◆ preHandleNotification()

void ml::ITKModuleAddOns::preHandleNotification ( Field * field)

Does Module::handleNotification stuff on start of function.

◆ preSetFilterParams()

void ml::ITKModuleAddOns::preSetFilterParams ( )

Does Module::setFilterParams stuff on start of function.

◆ printSubImgBox()

static void ml::ITKModuleAddOns::printSubImgBox ( const char * str,
const SubImageBox & box )
static

Prints the passed string and then the parameters of the subimage box box to the ML output.

◆ printVector()

static void ml::ITKModuleAddOns::printVector ( const char * str,
const ImageVector & vec )
static

Prints the passed string and then the parameters of the vector vec to the ML output.

◆ setInSubImageProperties()

void ml::ITKModuleAddOns::setInSubImageProperties ( int outIndex,
PagedImage & outImg )

Sets input subimage properties at end of Module::calculateOutputImageProperties.


The documentation for this class was generated from the following file: