MeVisLab Toolbox Reference
|
TypedCalculateOutputImageHandler can be used as a base class for an own CalculateOutputImageHandler and supports up to 4 variable types. More...
#include <mlTypedHandlers.h>
Additional Inherited Members | |
Public Types inherited from ml::internal::TypedHandlerBase< CalculateOutputImageHandler, Derived, NumberOfInputImages > | |
enum | |
Public Member Functions inherited from ml::internal::TypedHandlerBase< CalculateOutputImageHandler, Derived, NumberOfInputImages > | |
TypedHandlerBase () | |
void | calculateOutputSubImage (SubImage *outImg, SubImage *inImgs, UserThreadData *userThreadData) override |
Overrides the calculateOutputSubImage of CalculateOutputImageHandler. More... | |
Public Member Functions inherited from ml::CalculateOutputImageHandler | |
virtual | ~CalculateOutputImageHandler () |
Destructor. More... | |
virtual SubImageBox | calculateInputSubImageBox (int, const SubImageBox &outputSubImageBox) |
Called by the host to determine which input image region (tile) of input inputIndex is required to calculate a certain output image region (page) of output image. More... | |
virtual UserThreadData * | createUserThreadData () |
Create the thread local user data for a thread. More... | |
Static Public Member Functions inherited from ml::internal::TypedHandlerBase< CalculateOutputImageHandler, Derived, NumberOfInputImages > | |
static void | setupKnownProperties (PagedImage *outImg) |
Setup the properties of the outImg and its input sub images according to the settings of OutputSubImage_Type, InputSubImage[0-9]_Type, ... More... | |
static bool | verifyProperties (PagedImage *outImg) |
Verify the properties of the outImg (its datatype and the datatypes of the input sub images compared with the static properties of the variable types and fixed datatypes). More... | |
TypedCalculateOutputImageHandler can be used as a base class for an own CalculateOutputImageHandler and supports up to 4 variable types.
Its main feature is that it provides a mapping of the untyped SubImage instances of CalculateOutputImageHandler::calculateOutputSubImage to a call to a method called typedCalculateOutputSubImage() with typed sub images (TSubImage).
A derived class can pass up to 4 VariableType classes as template parameters and assign assigning either variable types or fixed types to the each output and input sub images. This configuration is given by an anonymous enum, that you need to provide in your derived handler class (this is due to the template magic that is done underneath, since all this needs to be known at compile time).
In addition to that, the class has two static methods:
which can be called from Module::calculateOutputImageProperties() to setup the datatypes and readonly flags that are known via the static information and to verify if the given datatypes are valid and will work with the VariableTypes that are used (this allows auto-invalidation of the output image, if the current datatype is not supported by the typedCalculateOutputSubImage instantiations).
Below follows a simple handler which supports an output and 1 input sub image of the same type:
If the above handler should support all datatypes, use AllTypes instead of StandardTypes as template argument.
Now to a more complex example, having different output/input types (only showing the configuration parts):
If the above input sub image should support all standard types, you could pass StandardTypes as second argument. Note that it is important that each template argument specifies on MLVariantType[0-3] and if each output/input sub image should support a different datatype on its own (compared to having the same datatype for all sub images), you need to pass the same VariableType multiple times (instead of, e.g., passing StandardTypes once, you need to pass it two times if input and output datatype shall/may be different).
Another useful configuration is to have a fixed datatype on the output image (e.g., because it always generates a MLint16 mask), but to support a variable datatype on the input images. The example below illustrates this:
And now finally a more complex example, using all features of the typed handler:
Definition at line 943 of file mlTypedHandlers.h.