MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlGetTileJob.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_GET_TILE_JOB_H
14#define ML_GET_TILE_JOB_H
15
17
18// ML-includes
19#include "mlInitSystemML.h"
20
21#include "mlPagedImage.h"
22#include "mlTileRequest.h"
23#include "mlPageRequestCursor.h"
24
26
27class PageRequest;
28class PageRequestProcessor;
29
32{
33public:
35
36 virtual ~GetTileJobBase();
37
40
42 double getProgress() const;
43
47 {
48 return _request->hasFinished();
49 }
50
52 bool hasError() const
53 {
54 return _request->hasError();
55 }
56
59 {
60 return _request->getError();
61 }
62
64 void setTileRequestFinishedCB(TileRequestFinishedCB* cb, void* data)
65 {
66 _request->setTileRequestFinishedCB(cb, data);
67 }
68
71 void cancel();
72
76
78 virtual void delegateProgressUpdate(double /*progress*/) {};
79
82
83protected:
89};
90
91//-------------------------------------------------------------------------------------------
93//-------------------------------------------------------------------------------------------
95{
96public:
102
104 ~GetTileJob() override;
105
111
116 {
117 _request->setAllocationPolicy(policy);
118 }
119
126 {
127 _request->setUseTileReadOnly(true);
128 setAllocationPolicy(TileRequest::NoAllocation);
129 }
130
133 void setExternalDataBuffer(void* data)
134 {
135 _request->setAllocationPolicy(TileRequest::ExternalBuffer);
136 _request->setExternalDataBuffer(data);
137 }
138
141 {
142 return _request->getSubImage();
143 }
144};
145
147
148#endif // of __mlGetTileJob_H
Base class for TileRequest based jobs.
void updateProgress()
Called by host to allow custom progress updates.
TileRequest * _request
The root TileRequest that is used internally.
bool hasFinished()
Returns whether the request has finished.
void setTileRequestFinishedCB(TileRequestFinishedCB *cb, void *data)
Sets the tile request finished callback that is called when the tile is ready.
MLRequestProgressCB * _progressCB
virtual MLErrorCode init(PageRequestProcessor &processor)=0
Initializes the tile request and adds it to the processor if no error occurs.
virtual void delegateProgressUpdate(double)
Emits the progress when it changes, to be reimplemented in derived classes.
bool hasError() const
Returns whether the request has an error and the data is thus unusable/invalid.
virtual ~GetTileJobBase()
MLErrorCode getError() const
Returns the error that happened. It returns ML_RESULT_OK if everything is ok.
void setProgressCB(MLRequestProgressCB *progressCallback, void *progressCallbackUserData)
Sets the progress callback. It will be called when updateProgress() is called.
double getProgress() const
Returns the current progress of the tile request ([0..1] range).
void cancel()
Cancels the GetTileJob.
Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor.
MLErrorCode init(PageRequestProcessor &processor) override
Initializes the tile request and adds it to the processor if no error occurs.
const SubImage & getSubImage()
Returns access to the stored subimage including the data, which is allocated using the AllocationPoli...
GetTileJob(PagedImage &image, const SubImageBox &box, MLDataType datatype, const ScaleShiftData &scaleShiftData=ScaleShiftData())
Creates a GetTileJob for the given PagedImage image with the requested box, datatype,...
void setAllocationPolicy(TileRequest::AllocationPolicy policy)
Sets which allocation policy should be used.
void setRequestAsReadOnlyPage()
Sets that the tile is used read-only so that an ML page can be passed directly as tile data.
void setExternalDataBuffer(void *data)
This allows to set the data buffer from an external buffer.
~GetTileJob() override
Destructor.
Abstract base class for page request processors.
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
A TileRequest either represents the input subimage that is needed by a PageRequest or if it is a root...
AllocationPolicy
Defines how the TileRequest will allocate its memory.
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:592
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.
void MLRequestProgressCB(void *usrData, double progress)