MeVisLab Toolbox Reference
mlKernelBaseModule.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
15
16#if !defined (__mlKernelBaseModule_H)
17#define __mlKernelBaseModule_H
18
19// ML-includes
20#include "mlInitSystemKernel.h"
21#include "mlKernel.h"
22#include "mlKernelTools.h"
23#include "mlKernelMacros.h"
24
26
27 //---------------------------------------------------------
226 //---------------------------------------------------------
228
229 friend class KernelBaseOpCalculateOutputImageHandler;
230
231 protected:
239
240 public:
241
244 inline Kernel &getKernel() { return _kernel; }
245
247 inline const Kernel &getConstKernel() const { return _kernel; }
249
250
256 inline EnumField *getBorderHandlingFld() const { return _borderHandlingFld; }
257
261 inline DoubleField *getFillValueFld() const { return _fillValueFld; }
262
263 // The field value describes the number of filtering iterations to be applied
264 // each page of the output image; the default is 1. Values < 1 are handled as 1.
265 // Still untested.
266 //inline IntField *getNumIterationsFld() const { return _numIterationsFld; }
267
294
298 inline EnumField &getReferenceExtentModeFld() const { return *_referenceExtentFld; }
300
301 protected:
302
322 MLint inIdx=0,
323 MLint outIdx=0);
324
328
340
346
354
361
374
379
380
381 protected:
384 virtual void _calcKernelPage(SubImage *outSubImg,
385 int outIndex,
387 int numInSubImgs,
389 size_t indexTabSize,
391 size_t loopIdx,
392 size_t iteration,
393 const ImageVector &ov1,
394 const ImageVector &ov2,
395 const ImageVector &pOf,
396 size_t numVox)=0;
397
398 private:
405
408
412 virtual UserThreadData* createUserThreadData(PagedImage* outImg);
413
427 static SubImageBox expandBox(const SubImageBox& inBox, const ImageVector &negFilterExt,
429 bool isSeparable,
431
432 private:
433
436
440 EnumField *_borderHandlingFld;
441
445 DoubleField *_fillValueFld;
446
447 // Specifies the number of iterations of the algorithm
448 // onto the page; default is 1.
449 // Still not tested.
450 //IntField *_numIterationsFld;
451
455 EnumField *_referenceExtentFld;
457
459 Kernel _kernel;
460
463 ImageVector _calculatedReferenceInputExt;
464
469 ImageVector _calcReferenceInputExt() const;
470
476 };
477
479
480#endif //of __mlKernelBaseModule_H
Base class for the calculation of pages of an output image (PagedImage) of a Module.
Field to encapsulate a double value.
Definition mlFields.h:538
Field to encapsulate an enumerated value.
Definition mlFields.h:195
Base class for all fields used in the ML.
Definition mlField.h:73
The module base class to apply kernels to an image.
virtual SubImageBox calculateValidDestArea(const SubImageBox &validDestArea, const SubImageBox &outSubImageBox)
Function called after the Kernel Framework calculated the valid area in the global destination image.
EnumField & getReferenceExtentModeFld() const
Returns how the reference extent for input images is calculated; valid values are InputImageRefExtent...
virtual void _connectToAllOutputs(Field *field)
Helper function to connect a field field to all output fields.
SubImageBox calculateInputSubImageBox(int inIndex, const SubImageBox &outSubImgBox, int outIndex) override
Calculates the region of the input image needed for the calculation of the output image region define...
EnumField * getBorderHandlingFld() const
virtual void _calcKernelPage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs, int numInSubImgs, MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, size_t loopIdx, size_t iteration, const ImageVector &ov1, const ImageVector &ov2, const ImageVector &pOf, size_t numVox)=0
This method is not intended to be overloaded directly, because it is subject to change.
virtual void calcOutSubImagePostProcessing(SubImage *outSubImg, int outIndex, SubImage *inSubImgs)
Called to postProcess the output image outSubImg with the index outIndex from the input subimage inSu...
virtual ImageVector _getCalculatedReferenceInputExt() const
Return the reference extent of input image dependent on the current value of _referenceExtentFld.
virtual void _setCorrectCorrelationMinMax(bool imageIntervalUsed=false, MLdouble intervalMin=0, MLdouble intervalMax=0, MLint inIdx=0, MLint outIdx=0)
This method calculates and sets the possible min/max values for output image outIdx if a correlation ...
InputImageRefExtent
Enumerator specifying the calculation mode for the extent of the reference extent of the input image.
@ Input0_ExtWithFill
Input 0 defines the reference extent of the input image, filling undefined input areas with fill valu...
@ MaxExtentsWithFill
Maximum component wise extent of all inputs, filling undefined input areas with fill value.
@ Input0_ExtWithoutFill
Input 0 defines the reference extent of the input image, leaving undefined input areas undefined.
@ MaxExtentsWithoutFill
Maximum component wise extent of all inputs, leaving undefined input areas undefined.
virtual void calcInSubImagePreparation(int outIndex, SubImage *inSubImgs)
Does some preprocessing on input subimages if we have more than one.
virtual ImageVector calculateOutInCoordShift(const ImageVector shift, const SubImageBox &outSubImageBox)
Function called after the Kernel Framework calculated the shift vector between input and output.
void calculateOutputImageProperties(int outputIndex, PagedImage *outputImage) override
Set properties of output image outputImage with output index outputIndex.
const Kernel & getConstKernel() const
Method to access the kernel as constant object. See also getKernel().
DoubleField * getFillValueFld() const
The field value is value written in input or output image borders where a border handling requires fi...
KernelBaseModule(int inputNum=1, int outputNum=1)
Constructor.
virtual SubImageBox calculateAreaToBeCalculated(const SubImageBox &areaToBeCalculated, const SubImageBox &outSubImageBox)
Function called after the Kernel Framework calculated which box needs to be calculated for the curren...
Base class for an image processing module of the ML.
Definition mlModule.h:151
virtual CalculateOutputImageHandler * createCalculateOutputImageHandler(PagedImage *outputImage)
Creates the CalculateOutputImageHandler for the given output image outputImage.
virtual void calculateOutputSubImage(SubImage *outputSubImage, int outputIndex, SubImage *inputSubImages)
Calculate page outputSubImage of output image with index outputIndex given the input image tiles in a...
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
Base class for thread local data that is passed to CalculateOutputImageHandler::calculateOutputSubIma...
#define ML_ABSTRACT_MODULE_CLASS_HEADER(className)
Like ML_ABSTRACT_CLASS_HEADER for the usage of derived classes from Module.
#define MLKERNELEXPORT
Includes files used in many parts of the dll, defined dll-specific macros and controls any system dep...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint MLsoffset
Signed ML offset type which is a 32 bit signed integer on 32 bit platforms and a 64 bit integer on 64...
Definition mlTypeDefs.h:562
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