ML Reference
ml::CalculateOutputImageHandler Class Referenceabstract

Base class for the calculation of pages of an output image (PagedImage) of a Module. More...

#include <mlModuleInterfaces.h>

Inheritance diagram for ml::CalculateOutputImageHandler:
ml::internal::TypedHandlerBase< CalculateOutputImageHandler, Derived, NumberOfInputImages > ml::ProcessAllPagesHandler ml::TypedCalculateOutputImageHandler< Derived, NumberOfInputImages, VariableType0, VariableType1, VariableType2, VariableType3 > ml::internal::TypedHandlerBase< ProcessAllPagesHandler, Derived, NumberOfInputImages > ml::OrderedProcessAllPagesHandler ml::OrderedSingleInputProcessAllPagesHandler ml::TypedProcessAllPagesHandler< Derived, NumberOfInputImages, VariableType0, VariableType1, VariableType2, VariableType3 >

Public Member Functions

virtual ~CalculateOutputImageHandler ()
 Destructor.
 
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.
 
virtual void calculateOutputSubImage (SubImage *outputSubImage, SubImage *inputSubImages, UserThreadData *userThreadData)=0
 Calculate page outputSubImage of output image given the input image tiles in array inputSubImages.
 
virtual UserThreadDatacreateUserThreadData ()
 Create the thread local user data for a thread.
 

Detailed Description

Base class for the calculation of pages of an output image (PagedImage) of a Module.

To use a CalculateOutputImageHandler as the handler of a Module output image, reimplement Module::createCalculateOutputImageHandler() and return a derived handler class with reimplemented virtual methods. By default, a handler does not store the output index nor the associated output image pointer itself, since there can be an individual handler class for each output image. If you want to use the same handler for different output images, you can store the output index of the PagedImage via PagedImage::getOutputIndex(). Please note that a new handler instance is created for each output image, so the same handler instance will never be called for different output images.

Note
If you are looking for a way to implement this handler with typed sub images (TSubImage), please have a look at the TypedCalculateOutputImageHandler template.

Definition at line 50 of file mlModuleInterfaces.h.

Constructor & Destructor Documentation

◆ ~CalculateOutputImageHandler()

virtual ml::CalculateOutputImageHandler::~CalculateOutputImageHandler ( )
inlinevirtual

Destructor.

Definition at line 53 of file mlModuleInterfaces.h.

Member Function Documentation

◆ calculateInputSubImageBox()

virtual SubImageBox ml::CalculateOutputImageHandler::calculateInputSubImageBox ( int ,
const SubImageBox & outputSubImageBox )
inlinevirtual

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.

Default is that a region with position and location of outputSubImageBox is requested from input image inputIndex.

Reimplemented in ml::OrderedSingleInputProcessAllPagesHandler, and ml::OrderedProcessAllPagesHandler.

Definition at line 59 of file mlModuleInterfaces.h.

◆ calculateOutputSubImage()

virtual void ml::CalculateOutputImageHandler::calculateOutputSubImage ( SubImage * outputSubImage,
SubImage * inputSubImages,
UserThreadData * userThreadData )
pure virtual

Calculate page outputSubImage of output image given the input image tiles in array inputSubImages.

inputSubImages contains as many images as inputs of the module exists (see Module::getNumInputImages()). If Module::handleInput() is reimplemented and returns Module::ALLOW_INVALID_INPUT for an invalid input image (either not connected or connected and invalid), the input sub image at that index will be empty and contain no data. If not reimplemented, the outputSubImage will contain undefined data values.

Note
If you are looking for a way to implement this method with typed sub images (TSubImage), please have a look at the TypedCalculateOutputImageHandler template.

Implemented in ml::internal::TypedHandlerBase< CalculateOutputImageHandler, Derived, NumberOfInputImages >, ml::internal::TypedHandlerBase< ProcessAllPagesHandler, Derived, NumberOfInputImages >, ml::OrderedSingleInputProcessAllPagesHandler, and ml::OrderedProcessAllPagesHandler.

◆ createUserThreadData()

virtual UserThreadData * ml::CalculateOutputImageHandler::createUserThreadData ( )
inlinevirtual

Create the thread local user data for a thread.

This method will be called before calculateOutputSubImage() is called the first time for a given thread and is passed as parameter into all calculateOutputSubImage() calls. The ownership of the UserThreadData is passed to the caller. The default implementation returns NULL. Reimplementing this method allows to have per-thread data that is shared for multiple calculateOutputSubImage() calls on that thread, for example to store a temporary buffer that is reused for multiple pages.

Definition at line 80 of file mlModuleInterfaces.h.


The documentation for this class was generated from the following file: