MeVisLab Toolbox Reference
mlBackgroundTaskMessages.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_BACKGROUND_TASK_MESSAGES_H
14#define ML_BACKGROUND_TASK_MESSAGES_H
15
16// Local includes
21
22ML_START_NAMESPACE
23
24class GetTileJobBase;
25class ProcessAllPagesHandler;
26
34
35//--------------------------------------------------------------------------------------
37public:
41
43
44 void executeSynchronous() override;
45
46 bool finishedProcessing() override;
47
48 void taskWillBeDestroyed() override;
49
50 static void tileRequestFinishedCB(void* data, TileRequest* request);
51
52 virtual void sendFinishedRequest() = 0;
53
54 virtual void sendFailedRequest() = 0;
55
56 virtual void sendProgress() = 0;
57
58protected:
63};
64
65//--------------------------------------------------------------------------------------
66
68public:
70 int inputImageIndex, MLDataType type, const SubImageBox& box, const ScaleShiftData& shift = ScaleShiftData(),
71 int getTileFlags = 0, ManagedSubImage* externalBuffer = nullptr);
72
74
75 void execute() override;
76
77 void sendFinishedRequest() override;
78
79 void sendFailedRequest() override;
80
81 void sendProgress() override;
82
83private:
84 ManagedSubImage* _externalBuffer;
85 int _inputImageIndex;
86 MLDataType _type;
87 SubImageBox _box;
88 ScaleShiftData _shift;
89 int _getTileFlags;
90};
91
92//--------------------------------------------------------------------------------------
93
95public:
97
99
100 void execute() override;
101
102 void sendFinishedRequest() override;
103
104 void sendFailedRequest() override;
105
106 void sendProgress() override;
107
108private:
109 ProcessAllPagesHandler* _handler;
110 SubImageBox _box;
111 bool _ownsHandler;
112};
113
114//--------------------------------------------------------------------------------------
115
117public:
119 _task = task;
120 _image = img;
121 _tileId = tileId;
122 }
124
125 void execute() override;
126
127private:
128 BackgroundRequestId _tileId;
129 ManagedSubImage* _image;
131};
132
133
134//--------------------------------------------------------------------------------------
135
137public:
139 _task = task;
140 _handler = handler;
141 _requestId = requestId;
142 }
144
145 void execute() override;
146
147private:
148 BackgroundRequestId _requestId;
149 ProcessAllPagesHandler* _handler;
151};
152
153ML_END_NAMESPACE
154
155#endif
156
157
#define MLBACKGROUNDTASKS_EXPORT
BackgroundTaskFinishedMessage(BackgroundTask *task)
BackgroundTaskMLGetTileBaseMessage(BackgroundRequestId tileId, Module *module)
void taskWillBeDestroyed() override
This needs to be implemented if the message uses finishedProcessing() and the task is finished while ...
static void tileRequestFinishedCB(void *data, TileRequest *request)
BackgroundTaskMLGetTileMessage(BackgroundRequestId tileId, Module *module, int inputImageIndex, MLDataType type, const SubImageBox &box, const ScaleShiftData &shift=ScaleShiftData(), int getTileFlags=0, ManagedSubImage *externalBuffer=nullptr)
BackgroundTaskMLGetTileResultMessage(ImagingBackgroundTask *task, BackgroundRequestId tileId, ManagedSubImage *img)
BackgroundTaskMLProcessAllPagesMessage(BackgroundRequestId tileId, Module *module, ProcessAllPagesHandler *handler, const SubImageBox &box)
BackgroundTaskMLProcessAllPagesResultMessage(ImagingBackgroundTask *task, BackgroundRequestId requestId, ProcessAllPagesHandler *handler)
void setSender(BackgroundTask *task)
Sets who sends the message. Default is NULL and this means that the message's sender is not a Backgro...
Base class for TileRequest based jobs.
MLint32 MLDataType
Definition mlTypeDefs.h:595
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
MLuint32 BackgroundRequestId
The ID of a tile request.