MeVisLab Toolbox Reference
ml::GetTileJob Class Reference

Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor. More...

#include <mlGetTileJob.h>

Inheritance diagram for ml::GetTileJob:
ml::GetTileJobBase

Public Member Functions

 GetTileJob (PagedImage &image, const SubImageBox &box, MLDataType datatype, const ScaleShiftData &scaleShiftData=ScaleShiftData())
 ~GetTileJob () override
 Destructor.
MLErrorCode init (PageRequestProcessor &processor) override
void setAllocationPolicy (TileRequest::AllocationPolicy policy)
void setRequestAsReadOnlyPage ()
void setExternalDataBuffer (void *data)
const SubImagegetSubImage ()
 Returns access to the stored subimage including the data, which is allocated using the AllocationPolicy.
Public Member Functions inherited from ml::GetTileJobBase
 GetTileJobBase ()
virtual ~GetTileJobBase ()
double getProgress () const
 Returns the current progress of the tile request ([0..1] range).
bool hasFinished ()
bool hasError () const
 Returns whether the request has an error and the data is thus unusable/invalid.
MLErrorCode getError () const
 Returns the error that happened. It returns ML_RESULT_OK if everything is ok.
void setTileRequestFinishedCB (TileRequestFinishedCB *cb, void *data)
 Sets the tile request finished callback that is called when the tile is ready.
void cancel ()
 Cancels the GetTileJob. This only sets the flag, the real cancellation needs to be done on the PageRequestProcessor.
void updateProgress ()
virtual void delegateProgressUpdate (double)
 Emits the progress when it changes, to be reimplemented in derived classes.
void setProgressCB (MLRequestProgressCB *progressCallback, void *progressCallbackUserData)
 Sets the progress callback. It will be called when updateProgress() is called.

Additional Inherited Members

Protected Attributes inherited from ml::GetTileJobBase
TileRequest_request
 The root TileRequest that is used internally.
MLRequestProgressCB_progressCB
void * _progressCBUserData
double _lastProgress

Detailed Description

Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor.

Definition at line 81 of file mlGetTileJob.h.

Constructor & Destructor Documentation

◆ GetTileJob()

ml::GetTileJob::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, and optional shifting/scaling. After creation, the job needs to be initialized using init(), see below.

◆ ~GetTileJob()

ml::GetTileJob::~GetTileJob ( )
override

Destructor.

Member Function Documentation

◆ getSubImage()

const SubImage & ml::GetTileJob::getSubImage ( )
inline

Returns access to the stored subimage including the data, which is allocated using the AllocationPolicy.

Definition at line 119 of file mlGetTileJob.h.

References ml::GetTileJobBase::_request.

◆ init()

MLErrorCode ml::GetTileJob::init ( PageRequestProcessor & processor)
overridevirtual

Initializes the tile request and adds it to the processor if no error occurs. It returns ML_REQUEST_OUTSIDE_OF_IMAGE if the request lies completely outside of the image. In that case, the data is allocated as uninitialized memory according to the allocation policy.

Implements ml::GetTileJobBase.

◆ setAllocationPolicy()

void ml::GetTileJob::setAllocationPolicy ( TileRequest::AllocationPolicy policy)
inline

Sets which allocation policy should be used. Note: This can only be changed directly after the constructor of the class, it has no effect when the data is already allocated. The default policy is to use the MLMemoryManager.

Definition at line 102 of file mlGetTileJob.h.

References ml::GetTileJobBase::_request.

Referenced by setRequestAsReadOnlyPage().

◆ setExternalDataBuffer()

void ml::GetTileJob::setExternalDataBuffer ( void * data)
inline

This allows to set the data buffer from an external buffer. The buffer will not be managed by the GetTileJob, the ownership stays with the user.

Definition at line 113 of file mlGetTileJob.h.

References ml::GetTileJobBase::_request, and ml::TileRequest::ExternalBuffer.

◆ setRequestAsReadOnlyPage()

void ml::GetTileJob::setRequestAsReadOnlyPage ( )
inline

Sets that the tile is used read-only so that an ML page can be passed directly as tile data. This will only work under special conditions: The tile's box/datatype/shiftScale needs to exactly match the input page. This sets the allocation policy to NoAllocation, since the data should be taken from the existing page. If it fails to get the data read-only, no data will be received.

Definition at line 109 of file mlGetTileJob.h.

References ml::GetTileJobBase::_request, ml::TileRequest::NoAllocation, and setAllocationPolicy().


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