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
31ML_START_NAMESPACE
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,
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
187 void preCalcOutImageProps(int outIndex);
188
190 void postCalcOutImageProps(int outIndex);
191
192
194 SubImageBox preCalcInSubImageBox(int inIndex, const SubImageBox& outSubImgBox, int outIndex);
195
197 SubImageBox postCalcInSubImageBox(int inIndex, const SubImageBox& outSubImgBox, const SubImageBox& processedBox, int outIndex);
198
199
201 void setInSubImageProperties(int outIndex, PagedImage &outImg);
202
203
206
209
210
213
216
217
219 void preCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs);
220
222 void postCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs);
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
246 static bool isCompiledType(MLDataType dt);
247
250 static void printSubImgBox(const char *str, const SubImageBox &box);
251
254 static void printVector(const char *str, const ImageVector &vec);
255
267 MLdouble minVV,
268 MLdouble maxVV,
269 int preferDouble);
270
277 MLdouble minVV,
278 MLdouble maxVV);
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
306 static void packSubImg(SubImage &subImg, const SubImageBox &imgBox);
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
332ML_END_NAMESPACE
MLTypeInfos * getInSubImageTypeInfos()
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)
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)
static void packSubImg(SubImage &subImg, const SubImageBox &imgBox)
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)
void preCalcOutImageProps(int outIndex)
Does Module::calculateOutputImageProperties stuff on start of function.
static bool isCompiledDim(MLint dim)
void postConstructorStuff()
Adds functionality to constructor of _module at end of constructor.
static std::string GetStringFromInt(int intVal, unsigned int reservedSpaces=1)
void preHandleNotification(Field *field)
Does Module::handleNotification stuff on start of function.
ITKModuleAddOns(Module &module, unsigned int configMask1=Empty, unsigned int configMask2=Empty)
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)
static int GetIntFromString(const std::string &str, bool &isValid)
static void packMemory(void *targetBuffer, void *srcBuffer, size_t setSize, size_t gapSize, size_t numSets)
~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 ")
void preSetFilterParams()
Does Module::setFilterParams stuff on start of function.
MLint getUsedFilteringDim()
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)
static bool isCompiledType(MLDataType dt)
void preGetFilterParams()
Does Module::getFilterParams stuff on start of function.
MLint32 MLDataType
Definition mlTypeDefs.h:595
#define MLITK_SUPPORT_EXPORT
double MLdouble
Definition mlTypeDefs.h:216
MLint64 MLint
Definition mlTypeDefs.h:489
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.