MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlProcessAllPagesHandler.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2009, 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#ifndef ML_PROCESS_ALL_PAGES_HANDLER_H
14#define ML_PROCESS_ALL_PAGES_HANDLER_H
15
17
18// ML-includes
19#include "mlInitSystemML.h"
20
21#include "mlModuleInterfaces.h"
22
23#include <ThirdPartyWarningsDisable.h>
24#include <boost/unordered_map.hpp>
25#include <ThirdPartyWarningsRestore.h>
26
28
38{
39public:
46 virtual void calculateOutputImageProperties(PagedImage* /*outImg*/) {};
47
49 virtual bool wantsProgressUpdates()
50 {
51 return false;
52 }
53
57 virtual void updateProgress(double /*progress*/)
58 {}
59
62
65 virtual const char* getName()
66 {
67 return nullptr;
68 }
69
70private:
72 static void calcOutImagePropsCB(void* userData, PagedImage* outImg)
73 {
74 static_cast<ProcessAllPagesHandler*>(userData)->calculateOutputImageProperties(outImg);
75 }
76};
77
78
79//---------------------------------------------------------------
83{
84public:
86
91
94 virtual MLErrorCode processTile(const SubImage& image) = 0;
95
102
105
108 UserThreadData* /*userThreadData*/) override;
109
110protected:
112
113private:
114 int _inputIndex;
115 MLint _nextPageId;
116
117 boost::unordered_map<MLint, SubImage> _bufferedImages;
118};
119
120//---------------------------------------------------------------
124{
125public:
127
132
136
140
143 UserThreadData* /*userThreadData*/) override;
144
145protected:
147
148private:
149 MLint _nextPageId;
150 int _numInputs;
151
152 boost::unordered_map<MLint, std::vector<SubImage>> _bufferedImages;
153};
154
156
157#endif
Base class for the calculation of pages of an output image (PagedImage) of a Module.
A ProcessAllPages handler that offers ordered tile delivery on any number of input images.
void calculateOutputSubImage(SubImage *outputSubImage, SubImage *inputSubImages, UserThreadData *) override
Internal method, do not reimplement!
void calculateOutputImageProperties(PagedImage *image) override
Reimplement this method to specify the virtual output image's data type/size/page extent.
virtual MLErrorCode processTiles(SubImage *images)=0
Reimplement this method to perform the processing, return ML_RESULT_OK if processing should go on; ot...
SubImageBox calculateInputSubImageBox(int, const SubImageBox &outputSubImageBox) override
Reimplement this method to specify the input image box for the input images.
A ProcessAllPages handler that offers ordered tile delivery on a single input image.
virtual MLErrorCode processTile(const SubImage &image)=0
Reimplement this method to perform the processing, return ML_RESULT_OK if processing should go on; ot...
void calculateOutputImageProperties(PagedImage *image) override
Reimplement this method to specify the virtual output image's data type/size/page extent.
virtual SubImageBox calculateInputSubImageBox(const SubImageBox &outputSubImageBox)
Reimplement this method to specify the input image box for the input image with index == _inputIndex.
OrderedSingleInputProcessAllPagesHandler(int inputIndex=0)
SubImageBox calculateInputSubImageBox(int inputIndex, const SubImageBox &outputSubImageBox) override
Internal method, do not reimplement!
void calculateOutputSubImage(SubImage *outputSubImage, SubImage *inputSubImages, UserThreadData *) override
Internal method, do not reimplement!
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Base class for handlers that are used for the Module::processAllPages facility.
virtual void calculateOutputImageProperties(PagedImage *)
Calculates the (temporary and virtual) output image's properties, which by default has the properties...
virtual void updateProgress(double)
Called in regular intervals if wantsProgressUpdates() == true.
void install(PagedImage *outImg)
Installs the handler on the PagedImage, which is typically called by the ML Host; do not call it your...
virtual const char * getName()
Returns the name of the handler.
virtual bool wantsProgressUpdates()
Returns whether the handler wants to receive progress updates via updateProgress().
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
Base class for thread local data that is passed to CalculateOutputImageHandler::calculateOutputSubIma...
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:772
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489