MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //------------------------------------------------------------------------- 00004 00009 //------------------------------------------------------------------------- 00010 // Prevent multiple including of this file. 00011 #if !defined (__mlKernelBaseModule_H) 00012 #define __mlKernelBaseModule_H 00013 00014 // ML-includes 00015 #ifndef __mlInitSystemKernel_H 00016 #include "mlInitSystemKernel.h" 00017 #endif 00018 #ifndef __mlKernel_H 00019 #include "mlKernel.h" 00020 #endif 00021 #ifndef __mlKernelTools_H 00022 #include "mlKernelTools.h" 00023 #endif 00024 #ifndef __mlKernelMacros_H 00025 #include "mlKernelMacros.h" 00026 #endif 00027 00028 ML_START_NAMESPACE 00029 00030 //--------------------------------------------------------- 00229 //--------------------------------------------------------- 00230 class MLKERNELEXPORT KernelBaseModule : public Module{ 00231 00232 friend class KernelBaseOpCalculateOutputImageHandler; 00233 00234 protected: 00241 KernelBaseModule(int inputNum=1, int outputNum=1); 00242 00243 public: 00244 00246 00247 inline Kernel &getKernel() { return _kernel; } 00248 00250 inline const Kernel &getConstKernel() const { return _kernel; } 00252 00253 00255 00256 00257 00258 00259 inline EnumField *getBorderHandlingFld() const { return _borderHandlingFld; } 00260 00264 inline DoubleField *getFillValueFld() const { return _fillValueFld; } 00265 00266 // The field value describes the number of filtering iterations to be applied 00267 // each page of the output image; the default is 1. Values < 1 are handled as 1. 00268 // Still untested. 00269 //inline IntField *getNumIterationsFld() const { return _numIterationsFld; } 00270 00273 enum InputImageRefExtent { 00275 Overlap = 0, 00276 00279 Input0_ExtWithoutFill, 00280 00283 Input0_ExtWithFill, 00284 00287 MaxExtentsWithoutFill, 00288 00291 MaxExtentsWithFill, 00292 00295 NumImageRefExtents 00296 }; 00297 00301 inline EnumField &getReferenceExtentModeFld() const { return *_referenceExtentFld; } 00303 00304 protected: 00305 00319 virtual void _setCorrectCorrelationMinMax(bool imageIntervalUsed=false, 00320 MLdouble intervalMin=0, 00321 MLdouble intervalMax=0, 00322 MLint inIdx=0, 00323 MLint outIdx=0); 00324 00327 virtual ImageVector _getCalculatedReferenceInputExt() const; 00328 00330 00331 00332 00333 00334 virtual void calculateOutputImageProperties(int outIndex); 00335 00340 virtual SubImageBox calculateInputSubImageBox(int inIndex, const SubImageBox& outSubImgBox, int outIndex); 00341 00348 virtual void calcInSubImagePreparation(int outIndex, SubImage *inSubImgs); 00349 00355 virtual void calcOutSubImagePostProcessing(SubImage *outSubImg, int outIndex, SubImage *inSubImgs); 00356 00359 virtual void _connectToAllOutputs(Field *field); 00361 00362 00363 protected: 00366 virtual void _calcKernelPage(SubImage *outSubImg, 00367 int outIndex, 00368 SubImage *inSubImgs, 00369 int numInSubImgs, 00370 MLsoffset *indexTab, 00371 size_t indexTabSize, 00372 MLsoffset srcVoxelOffset, 00373 size_t loopIdx, 00374 size_t iteration, 00375 const ImageVector &ov1, 00376 const ImageVector &ov2, 00377 const ImageVector &pOf, 00378 size_t numVox)=0; 00379 00380 private: 00386 virtual void calculateOutputSubImage(SubImage *realOutSubImg, int outIndex, SubImage *inSubImgs, UserThreadData* userThreadData); 00387 00389 virtual CalculateOutputImageHandler* createCalculateOutputImageHandler(PagedImage* outImg); 00390 00394 virtual UserThreadData* createUserThreadData(PagedImage* outImg); 00395 00409 static SubImageBox expandBox(const SubImageBox& inBox, const ImageVector &negFilterExt, 00410 const ImageVector &posFilterExt, 00411 bool isSeparable, 00412 MLint numIterations); 00413 00414 private: 00415 00417 00418 00422 EnumField *_borderHandlingFld; 00423 00427 DoubleField *_fillValueFld; 00428 00429 // Specifies the number of iterations of the algorithm 00430 // onto the page; default is 1. 00431 // Still not tested. 00432 //IntField *_numIterationsFld; 00433 00437 EnumField *_referenceExtentFld; 00439 00441 Kernel _kernel; 00442 00445 ImageVector _calculatedReferenceInputExt; 00446 00451 ImageVector _calcReferenceInputExt() const; 00452 00457 ML_ABSTRACT_MODULE_CLASS_HEADER(KernelBaseModule); 00458 }; 00459 00460 00461 #ifdef ML_DEPRECATED 00462 00463 // disable deprecation warnings 00464 #ifdef WIN32 00465 #pragma warning(push) 00466 #pragma warning(disable : 4996 ) 00467 #endif 00468 00471 class MLKERNELEXPORT ML_DEPRECATED KernelBaseOp : public KernelBaseModule 00472 { 00473 public: 00474 KernelBaseOp(int inputNum=1, int outputNum=1):KernelBaseModule(inputNum,outputNum) 00475 {}; 00476 00477 ML_ABSTRACT_MODULE_CLASS_HEADER(KernelBaseOp) 00478 }; 00479 00480 // re-enable deprecation warnings 00481 #ifdef WIN32 00482 #pragma warning(pop) 00483 #endif 00484 00485 #endif // ML_DEPRECATED 00486 00487 ML_END_NAMESPACE 00488 00489 #endif //of __mlKernelBaseModule_H 00490 00491 00492 00493 00494