MeVisLab Toolbox 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. | |
MLTypeInfos * | getInSubImageTypeInfos () |
Returns the pointer to the information struct of the input data type; this pointer is valid or NULL only after executing calculateOutputImageProperties(). | |
MLTypeInfos * | 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(). | |
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. | |
Class to implement much functionality used in ML modules wrapping filters.
Definition at line 39 of file mlITKModuleAddOns.h.
Configuration bits for configMask1 in ITKModuleAddOns constructor.
Definition at line 45 of file mlITKModuleAddOns.h.
Configuration bits for configMask2 in ITKModuleAddOns constructor.
Definition at line 82 of file mlITKModuleAddOns.h.
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.
ml::ITKModuleAddOns::~ITKModuleAddOns | ( | ) |
Destructor.
|
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.
|
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.
|
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.
Returns configuration mask 1.
Definition at line 130 of file mlITKModuleAddOns.h.
Returns configuration mask 2.
Definition at line 133 of file mlITKModuleAddOns.h.
MLDataType ml::ITKModuleAddOns::getInputSubImageDataType | ( | ) |
Returns the current input buffer data type for non scalar filters.
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.
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.
MLDataType ml::ITKModuleAddOns::getOutputSubImageDataType | ( | int | outIndex = 0 | ) |
Returns the current output buffer data type for non scalar filters.
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().
|
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.
MLint ml::ITKModuleAddOns::getUsedFilteringDim | ( | ) |
Returns the dimension the filter shall current work with.
A call requires that preCalcOutImageProps(int outIndex) has been called before.
Returns true if filters are implemented for the passed dimension dim, otherwise false.
Dimensions are counted starting with 1.
|
static |
Returns true if filters are implemented for the passed data type dt, otherwise false.
|
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.
|
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.
void ml::ITKModuleAddOns::postActivateAttachments | ( | ) |
Does Module::activateAttachments stuff on end of function.
SubImageBox ml::ITKModuleAddOns::postCalcInSubImageBox | ( | int | inIndex, |
const SubImageBox & | outSubImgBox, | ||
const SubImageBox & | processedBox, | ||
int | outIndex ) |
Does Module::calculateInputSubImageBox stuff on end of function.
Does Module::calculateOutputImageProperties stuff on end of function.
void ml::ITKModuleAddOns::postCalcOutSubImage | ( | SubImage & | outSubImg, |
int | outIndex, | ||
SubImage * | inSubImgs ) |
Does some Module::calculateOutputSubImage stuff on end of function.
void ml::ITKModuleAddOns::postConstructorStuff | ( | ) |
Adds functionality to constructor of _module at end of constructor.
void ml::ITKModuleAddOns::postGetFilterParams | ( | ) |
Does Module::getFilterParams stuff on end of function.
Does Module::handleNotification stuff on end of function.
void ml::ITKModuleAddOns::postSetFilterParams | ( | ) |
Does Module::setFilterParams stuff on end of function.
void ml::ITKModuleAddOns::preActivateAttachments | ( | ) |
Does Module::activateAttachments stuff on start of function.
SubImageBox ml::ITKModuleAddOns::preCalcInSubImageBox | ( | int | inIndex, |
const SubImageBox & | outSubImgBox, | ||
int | outIndex ) |
Does Module::calculateInputSubImageBox stuff on start of function.
Does Module::calculateOutputImageProperties stuff on start of function.
void ml::ITKModuleAddOns::preCalcOutSubImage | ( | SubImage & | outSubImg, |
int | outIndex, | ||
SubImage * | inSubImgs ) |
Does some Module::calculateOutputSubImage stuff on start of function.
void ml::ITKModuleAddOns::preConstructorStuff | ( | ) |
Adds functionality to constructor of _module directly after construction.
void ml::ITKModuleAddOns::preGetFilterParams | ( | ) |
Does Module::getFilterParams stuff on start of function.
Does Module::handleNotification stuff on start of function.
void ml::ITKModuleAddOns::preSetFilterParams | ( | ) |
Does Module::setFilterParams stuff on start of function.
|
static |
Prints the passed string and then the parameters of the subimage box box to the ML output.
Prints the passed string and then the parameters of the vector vec to the ML output.
void ml::ITKModuleAddOns::setInSubImageProperties | ( | int | outIndex, |
PagedImage & | outImg ) |
Sets input subimage properties at end of Module::calculateOutputImageProperties.