MeVisLab Toolbox Reference
mlITKModuleAddOns.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#pragma once
14
16// Include dll-specific settings.
18
20#include "mlModuleIncludes.h"
21
22// Disable warning 4263 which complains about function overwrites which do not have same
23// argument type(s) or same number of arguments, and which hides the base class function.
24// This happens often if a template function overwrites a non-template function as it is done
25// in generated ITK modules typically. This should normally be no problem in the generated
26// code, and since it cannot be fixed easilyit is disabled therefore.
27#if defined(_MSC_VER)
28 #pragma warning(disable : 4263)
29#endif
30
32
33// Forward declaration of the internally used structure to managed fields and members.
34class AddOnState;
35
36//----------------------------------------------------------------------------------
38//----------------------------------------------------------------------------------
40{
41
42public:
43
46 Empty = 0x00000000,
47 DoNotCompile = 0x00000001,
48 IsInplace = 0x00000002,
49 UseOnlySigned = 0x00000004,
50 UseOnlyDouble = 0x00000008,
51 UseOnlyFloat = 0x00000010,
52 UseOnlyInt = 0x00000020,
53 IsKernelModule = 0x00000040,
54 IsLevelSetModule = 0x00000080,
55 HasFeatureImage = 0x00000100,
56 IsImageFilter = 0x00000200,
57 IsImageMetric = 0x00000400,
58 IsTransform = 0x00000800,
59 IsInterpolator = 0x00001000,
60 IsOptimizer = 0x00002000,
61 IsSource = 0x00004000,
62 UseMemBufInput0 = 0x00008000,
63 UseMemBufInput1 = 0x00010000,
64 UseMemBufInput2 = 0x00020000,
65 Only2D = 0x00040000,
66 Only3D = 0x00080000,
67 NonScalarInput = 0x00100000,
68 NonScalarOutput = 0x00200000,
69 ConvertsPointSet = 0x00400000,
70 UsesComplex = 0x00800000,
71 UsesSCSL = 0x01000000,
72 SuppressGetParams = 0x02000000,
73 ClampOutputValues = 0x04000000,
74 AutoGetInputMinMax = 0x08000000,
75 SetOutputMinMax = 0x10000000,
76 UsesTensor = 0x20000000,
77 UsesCVVectors = 0x40000000,
78 UnUsedMask01_01 = 0x80000000
79 };
80
83 UsesImgDimVecOut = 0x00000001,
84 Uses2OutComps = 0x00000002,
85 Uses3OutComps = 0x00000004,
86 Uses4OutComps = 0x00000008,
87 Uses6OutComps = 0x00000010,
88 Uses8OutComps = 0x00000020,
89 Uses16OutComps = 0x00000040,
90 UsesITK = 0x00000080,
91 UsesVTK = 0x00000100,
92 UsesGlobalPageExt = 0x00000200,
93 UsesImgDimVecIn = 0x00000400,
94 UseFlatKernel = 0x00000800,
95 UsesNonScalarIntConversion = 0x00001000,
96 IdSizedInBox0 = 0x00002000,
97 IdSizedInBox1 = 0x00004000,
98 IdSizedInBox2 = 0x00008000,
99 UnknownMask2_16 = 0x00010000,
100 UnknownMask2_17 = 0x00020000,
101 UnknownMask2_18 = 0x00040000,
102 UnknownMask2_29 = 0x00080000,
103 UnknownMask2_20 = 0x00100000,
104 UnknownMask2_21 = 0x00200000,
105 UnknownMask2_22 = 0x00400000,
106 UnknownMask2_23 = 0x00800000,
107 UnknownMask2_24 = 0x01000000,
108 UnknownMask2_25 = 0x02000000,
109 UnknownMask2_26 = 0x04000000,
110 UnknownMask2_27 = 0x08000000,
111 UnknownMask2_28 = 0x10000000,
112 UnknownMask2_39 = 0x20000000,
113 UnknownMask2_30 = 0x40000000,
114 UnknownMask2_31 = 0x80000000
115 };
116
119 ITKModuleAddOns(Module &module, unsigned int configMask1=Empty, unsigned int configMask2=Empty);
120
123
124
125 //-------------------------------
127 //-------------------------------
128
130 inline unsigned int getConfigMask1() { return _configMask1; }
131
133 inline unsigned int getConfigMask2() { return _configMask2; }
134
135
138
141
142
150
155
159
160
161 //----------------------------------------
163 //----------------------------------------
164
167
170
171
174
177
178
181
184
185
188
191
192
195
198
199
202
203
206
209
210
213
216
217
220
224
225
226 //------------------------------------
228 //------------------------------------
229
233 static std::string GetStringFromInt(int intVal, unsigned int reservedSpaces=1);
234
238 static int GetIntFromString(const std::string &str, bool &isValid);
239
242 static bool isCompiledDim(MLint dim);
243
247
250 static void printSubImgBox(const char *str, const SubImageBox &box);
251
254 static void printVector(const char *str, const ImageVector &vec);
255
269 int preferDouble);
270
279
284 static bool CheckNumberSizes(size_t s1, size_t s2,
285 const std::string &funcName,
286 const std::string &str="Number of parameter should be ");
287
299 static void packMemory(void *targetBuffer, void *srcBuffer, size_t setSize, size_t gapSize, size_t numSets);
300
308
309
310private:
313
315 ITKModuleAddOns &operator=(const ITKModuleAddOns &);
316
318 Module &_module;
319
321 unsigned int _configMask1;
322
324 unsigned int _configMask2;
325
329 AddOnState *_addOnState;
330};
331
Base class for all fields used in the ML.
Definition mlField.h:73
Class to implement much functionality used in ML modules wrapping filters.
MLTypeInfos * getInSubImageTypeInfos()
Returns the pointer to the information struct of the input data type; this pointer is valid or NULL o...
ITKModuleAddOnConfigs2
Configuration bits for configMask2 in ITKModuleAddOns constructor.
void postGetFilterParams()
Does Module::getFilterParams stuff on end of function.
ITKModuleAddOnConfigs1
Configuration bits for configMask1 in ITKModuleAddOns constructor.
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.
void setInSubImageProperties(int outIndex, PagedImage &outImg)
Sets input subimage properties at end of Module::calculateOutputImageProperties.
unsigned int getConfigMask2()
Returns configuration mask 2.
MLDataType getOutputSubImageDataType(int outIndex=0)
Returns the current output buffer data type for non scalar filters.
void preConstructorStuff()
Adds functionality to constructor of _module directly after construction.
void preActivateAttachments()
Does Module::activateAttachments stuff on start of function.
MLTypeInfos * getOutSubImageTypeInfos(int outIndex=0)
Returns the pointer to the information struct of the output data type; this pointer is valid or NULL ...
static void packSubImg(SubImage &subImg, const SubImageBox &imgBox)
Reformat the data buffer of subimage subImg.
void postCalcOutImageProps(int outIndex)
Does Module::calculateOutputImageProperties stuff on end of function.
void preCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs)
Does some Module::calculateOutputSubImage stuff on start of function.
void postSetFilterParams()
Does Module::setFilterParams stuff on end of function.
void postHandleNotification(Field *field)
Does Module::handleNotification stuff on end of function.
static MLDataType getBestIntegerType(MLDataType inDataType, MLdouble minVV, MLdouble maxVV)
If inDataType is an integer type then inDataType will be returned unchanged.
void preCalcOutImageProps(int outIndex)
Does Module::calculateOutputImageProperties stuff on start of function.
static bool isCompiledDim(MLint dim)
Returns true if filters are implemented for the passed dimension dim, otherwise false.
void postConstructorStuff()
Adds functionality to constructor of _module at end of constructor.
static std::string GetStringFromInt(int intVal, unsigned int reservedSpaces=1)
Return passed integer value as string.
void preHandleNotification(Field *field)
Does Module::handleNotification stuff on start of function.
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 fr...
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.
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 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...
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.
~ITKModuleAddOns()
Destructor.
MLDataType getInputSubImageDataType()
Returns the current input buffer data type for non scalar filters.
void postActivateAttachments()
Does Module::activateAttachments stuff on end of function.
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 inst...
void preSetFilterParams()
Does Module::setFilterParams stuff on start of function.
MLint getUsedFilteringDim()
Returns the dimension the filter shall current work with.
unsigned int getConfigMask1()
Returns configuration mask 1.
void postCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs)
Does some Module::calculateOutputSubImage stuff on end of function.
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 bool isCompiledType(MLDataType dt)
Returns true if filters are implemented for the passed data type dt, otherwise false.
void preGetFilterParams()
Does Module::getFilterParams stuff on start of function.
Base class for an image processing module of the ML.
Definition mlModule.h:151
Class which represents an image, which manages properties of an image and image data which is located...
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition mlSubImage.h:75
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:596
#define MLITK_SUPPORT_EXPORT
When included by other libraries MLITK_SUPPORT_EXPORT is compiled as import symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490
Structure containing all data type features and pointers to all functions needed to implement operati...