MeVisLabToolboxReference
FMEwork/ITK/Sources/ITK/MLITK/ITKSupport/mlITKModuleAddOns.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00008 //----------------------------------------------------------------------------------
00009 #ifndef __mlITKModuleAddOns_H
00010 #define __mlITKModuleAddOns_H
00011 
00013 // Include dll-specific settings.
00014 #include "mlInitSystemITKSupport.h"
00015 
00017 #ifndef __mlModuleIncludes_H
00018 #include "mlModuleIncludes.h"
00019 #endif
00020 
00021 ML_START_NAMESPACE
00022 
00023 // Forward declaration of the internally used structure to managed fields and members.
00024 class AddOnState;
00025 
00026 //----------------------------------------------------------------------------------
00028 //----------------------------------------------------------------------------------
00029 class MLITK_SUPPORT_EXPORT ITKModuleAddOns
00030 {
00031 
00032 public:
00033 
00035   enum ITKModuleAddOnConfigs1 {
00036     Empty                      = 0x00000000,
00037     DoNotCompile               = 0x00000001,
00038     IsInplace                  = 0x00000002,
00039     UseOnlySigned              = 0x00000004,
00040     UseOnlyDouble              = 0x00000008,
00041     UseOnlyFloat               = 0x00000010,
00042     UseOnlyInt                 = 0x00000020,
00043     IsKernelModule             = 0x00000040,
00044     IsLevelSetModule           = 0x00000080,
00045     HasFeatureImage            = 0x00000100,
00046     IsImageFilter              = 0x00000200,
00047     IsImageMetric              = 0x00000400,
00048     IsTransform                = 0x00000800,
00049     IsInterpolator             = 0x00001000,
00050     IsOptimizer                = 0x00002000,
00051     IsSource                   = 0x00004000,
00052     UseMemBufInput0            = 0x00008000,
00053     UseMemBufInput1            = 0x00010000,
00054     UseMemBufInput2            = 0x00020000,
00055     Only2D                     = 0x00040000,
00056     Only3D                     = 0x00080000,
00057     NonScalarInput             = 0x00100000,
00058     NonScalarOutput            = 0x00200000,
00059     ConvertsPointSet           = 0x00400000,
00060     UsesComplex                = 0x00800000,
00061     UsesSCSL                   = 0x01000000,
00062     SuppressGetParams          = 0x02000000,
00063     ClampOutputValues          = 0x04000000,
00064     AutoGetInputMinMax         = 0x08000000,
00065     SetOutputMinMax            = 0x10000000,
00066     UsesTensor                 = 0x20000000,
00067     UsesCVVectors              = 0x40000000,
00068     UnUsedMask01_01            = 0x80000000
00069   };
00070 
00072   enum ITKModuleAddOnConfigs2 {
00073     UsesImgDimVecOut           = 0x00000001,
00074     Uses2OutComps              = 0x00000002,
00075     Uses3OutComps              = 0x00000004,
00076     Uses4OutComps              = 0x00000008,
00077     Uses6OutComps              = 0x00000010,
00078     Uses8OutComps              = 0x00000020,
00079     Uses16OutComps             = 0x00000040,
00080     UsesITK                    = 0x00000080,
00081     UsesVTK                    = 0x00000100,
00082     UsesGlobalPageExt          = 0x00000200,
00083     UsesImgDimVecIn            = 0x00000400,
00084     UseFlatKernel              = 0x00000800,
00085     UsesNonScalarIntConversion = 0x00001000,
00086     IdSizedInBox0              = 0x00002000,
00087     IdSizedInBox1              = 0x00004000,
00088     IdSizedInBox2              = 0x00008000,
00089     UnknownMask2_16            = 0x00010000,
00090     UnknownMask2_17            = 0x00020000,
00091     UnknownMask2_18            = 0x00040000,
00092     UnknownMask2_29            = 0x00080000,
00093     UnknownMask2_20            = 0x00100000,
00094     UnknownMask2_21            = 0x00200000,
00095     UnknownMask2_22            = 0x00400000,
00096     UnknownMask2_23            = 0x00800000,
00097     UnknownMask2_24            = 0x01000000,
00098     UnknownMask2_25            = 0x02000000,
00099     UnknownMask2_26            = 0x04000000,
00100     UnknownMask2_27            = 0x08000000,
00101     UnknownMask2_28            = 0x10000000,
00102     UnknownMask2_39            = 0x20000000,
00103     UnknownMask2_30            = 0x40000000,
00104     UnknownMask2_31            = 0x80000000
00105   };
00106 
00109   ITKModuleAddOns(Module &module, unsigned int configMask1=Empty, unsigned int configMask2=Empty);
00110 
00112   ~ITKModuleAddOns();
00113 
00114 
00115   //-------------------------------
00117   //-------------------------------
00118 
00120   inline unsigned int getConfigMask1() { return _configMask1; }
00121 
00123   inline unsigned int getConfigMask2() { return _configMask2; }
00124 
00125 
00127   MLDataType getInputSubImageDataType();
00128 
00130   MLDataType getOutputSubImageDataType();
00131 
00132 
00139   MLTypeInfos *getInSubImageTypeInfos();
00140 
00143   MLTypeInfos *getOutSubImageTypeInfos();
00145 
00148   MLint getUsedFilteringDim();
00149 
00150 
00151   //----------------------------------------
00153   //----------------------------------------
00154 
00156   void      preConstructorStuff();
00157 
00159   void      postConstructorStuff();
00160 
00161 
00163   void      preActivateAttachments();
00164 
00166   void      postActivateAttachments();
00167 
00168 
00170   void      preHandleNotification(Field *field);
00171 
00173   void      postHandleNotification(Field *field);
00174 
00175 
00177   void      preCalcOutImageProps(int outIndex);
00178 
00180   void      postCalcOutImageProps(int outIndex);
00181 
00182 
00184   SubImageBox preCalcInSubImageBox(int inIndex, const SubImageBox& outSubImgBox, int outIndex);
00185 
00187   SubImageBox postCalcInSubImageBox(int inIndex, const SubImageBox& outSubImgBox, const SubImageBox& processedBox, int outIndex);
00188 
00189 
00191   void      setInSubImageProperties(int outIndex, PagedImage &outImg);
00192 
00193 
00195   void      preSetFilterParams();
00196 
00198   void      postSetFilterParams();
00199 
00200 
00202   void      preGetFilterParams();
00203 
00205   void      postGetFilterParams();
00206 
00207 
00209   void      preCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs);
00210 
00212   void      postCalcOutSubImage(SubImage &outSubImg, int outIndex, SubImage *inSubImgs);
00214 
00215 
00216   //------------------------------------
00218   //------------------------------------
00219 
00223   static std::string GetStringFromInt(int intVal, unsigned int reservedSpaces=1);
00224 
00228   static int GetIntFromString(const std::string &str, bool &isValid);
00229 
00232   static bool isCompiledDim(MLint dim);
00233 
00236   static bool isCompiledType(MLDataType dt);
00237 
00240   static void printSubImgBox(const char *str, const SubImageBox &box);
00241 
00244   static void printVector(const char *str, const ImageVector &vec);
00245 
00256   static MLDataType getBestSignedType(MLDataType inDataType,
00257                                       MLdouble minVV,
00258                                       MLdouble maxVV,
00259                                       int preferDouble);
00260 
00266   static MLDataType getBestIntegerType(MLDataType inDataType,
00267                                        MLdouble minVV,
00268                                        MLdouble maxVV);
00269 
00274   static bool CheckNumberSizes(size_t s1, size_t s2, 
00275                                const std::string &funcName,
00276                                const std::string &str="Number of parameter should be ");
00277 
00289   static void packMemory(void *targetBuffer, void *srcBuffer, size_t setSize, size_t gapSize, size_t numSets);
00290 
00296   static void packSubImg(SubImage &subImg, const SubImageBox &imgBox);
00298 
00299 
00300 private:
00302   ITKModuleAddOns(const ITKModuleAddOns &);
00303 
00305   ITKModuleAddOns &operator=(const ITKModuleAddOns &);
00306 
00308   Module      &_module;
00309 
00311   unsigned int _configMask1;
00312 
00314   unsigned int _configMask2;
00315 
00319   AddOnState  *_addOnState;
00320 };
00321 
00322 ML_END_NAMESPACE
00323 
00324 #endif // __mlITKModuleAddOns_H
00325